Add: move "New Company" inside the Online Players GUI

This commit is contained in:
Patric Stout
2021-04-23 16:22:01 +02:00
committed by Patric Stout
parent c2e116a3d3
commit a924b2ff81
3 changed files with 54 additions and 26 deletions

View File

@@ -204,8 +204,7 @@ static void PopupMainToolbMenu(Window *w, int widget, StringID string, int count
/** Enum for the Company Toolbar's network related buttons */
static const int CTMN_CLIENT_LIST = -1; ///< Show the client list
static const int CTMN_NEW_COMPANY = -2; ///< Create a new company
static const int CTMN_SPECTATOR = -3; ///< Show a company window as spectator
static const int CTMN_SPECTATOR = -2; ///< Show a company window as spectator
/**
* Pop up a generic company list menu.
@@ -223,10 +222,6 @@ static void PopupMainCompanyToolbMenu(Window *w, int widget, int grey = 0)
/* Add the client list button for the companies menu */
list.emplace_back(new DropDownListStringItem(STR_NETWORK_COMPANY_LIST_CLIENT_LIST, CTMN_CLIENT_LIST, false));
if (_local_company == COMPANY_SPECTATOR) {
list.emplace_back(new DropDownListStringItem(STR_NETWORK_COMPANY_LIST_NEW_COMPANY, CTMN_NEW_COMPANY, NetworkMaxCompaniesReached()));
}
break;
case WID_TN_STORY:
@@ -608,14 +603,6 @@ static CallBackFunction MenuClickCompany(int index)
case CTMN_CLIENT_LIST:
ShowClientList();
return CBF_NONE;
case CTMN_NEW_COMPANY:
if (_network_server) {
DoCommandP(0, CCA_NEW, _network_own_client_id, CMD_COMPANY_CTRL);
} else {
NetworkSendCommand(0, CCA_NEW, 0, CMD_COMPANY_CTRL, nullptr, nullptr, _local_company);
}
return CBF_NONE;
}
}
ShowCompany((CompanyID)index);