Merge branch 'master' into jgrpp
# Conflicts: # src/ai/ai_gui.cpp # src/company_cmd.cpp # src/lang/estonian.txt # src/lang/german.txt # src/lang/hungarian.txt # src/lang/korean.txt # src/lang/slovak.txt # src/main_gui.cpp # src/video/sdl2_v.cpp
This commit is contained in:
@@ -883,9 +883,16 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
}
|
||||
|
||||
case CCA_NEW_AI: { // Make a new AI company
|
||||
if (company_id != INVALID_COMPANY && company_id >= MAX_COMPANIES) return CMD_ERROR;
|
||||
|
||||
/* For network games, company deletion is delayed. */
|
||||
if (!_networking && company_id != INVALID_COMPANY && Company::IsValidID(company_id)) return CMD_ERROR;
|
||||
|
||||
if (!(flags & DC_EXEC)) return CommandCost();
|
||||
|
||||
if (company_id != INVALID_COMPANY && (company_id >= MAX_COMPANIES || Company::IsValidID(company_id))) return CMD_ERROR;
|
||||
/* For network game, just assume deletion happened. */
|
||||
assert(company_id == INVALID_COMPANY || !Company::IsValidID(company_id));
|
||||
|
||||
Company *c = DoStartupNewCompany(DSNC_AI, company_id);
|
||||
if (c != nullptr) {
|
||||
NetworkServerNewCompany(c, nullptr);
|
||||
@@ -898,6 +905,9 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
CompanyRemoveReason reason = (CompanyRemoveReason)GB(p1, 24, 8);
|
||||
if (reason >= CRR_END) return CMD_ERROR;
|
||||
|
||||
/* We can't delete the last existing company in singleplayer mode. */
|
||||
if (!_networking && Company::GetNumItems() == 1) return CMD_ERROR;
|
||||
|
||||
Company *c = Company::GetIfValid(company_id);
|
||||
if (c == nullptr) return CMD_ERROR;
|
||||
|
||||
|
Reference in New Issue
Block a user