Changeset - r23583:f6bffb252509
[Not reviewed]
master
0 5 0
glx22 - 5 years ago 2019-04-05 13:11:52
glx22@users.noreply.github.com
Fix #7439: don't overwrite CompanyRemoveReason with ClientID (#7465)
5 files changed with 11 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -1282,7 +1282,7 @@ struct AIDebugWindow : public Window {
 
			case WID_AID_RELOAD_TOGGLE:
 
				if (ai_debug_company == OWNER_DEITY) break;
 
				/* First kill the company of the AI, then start a new one. This should start the current AI again */
 
				DoCommandP(0, CCA_DELETE | ai_debug_company << 16, CRR_MANUAL, CMD_COMPANY_CTRL);
 
				DoCommandP(0, CCA_DELETE | ai_debug_company << 16 | CRR_MANUAL << 24, 0, CMD_COMPANY_CTRL);
 
				DoCommandP(0, CCA_NEW_AI | ai_debug_company << 16, 0, CMD_COMPANY_CTRL);
 
				break;
 

	
src/company_cmd.cpp
Show inline comments
 
@@ -807,10 +807,9 @@ void CompanyAdminRemove(CompanyID compan
 
 * @param flags operation to perform
 
 * @param p1 various functionality
 
 * - bits 0..15: CompanyCtrlAction
 
 * - bits 16..24: CompanyID
 
 * @param p2 various depending on CompanyCtrlAction
 
 * - bits 0..31: ClientID (with CCA_NEW)
 
 * - bits 0..1: CompanyRemoveReason (with CCA_DELETE)
 
 * - bits 16..23: CompanyID
 
 * - bits 24..31: CompanyRemoveReason (with CCA_DELETE)
 
 * @param p2 ClientID
 
 * @param text unused
 
 * @return the cost of this operation or an error
 
 */
 
@@ -880,7 +879,7 @@ CommandCost CmdCompanyCtrl(TileIndex til
 
		}
 

	
 
		case CCA_DELETE: { // Delete a company
 
			CompanyRemoveReason reason = (CompanyRemoveReason)GB(p2, 0, 2);
 
			CompanyRemoveReason reason = (CompanyRemoveReason)GB(p1, 24, 8);
 
			if (reason >= CRR_END) return CMD_ERROR;
 

	
 
			Company *c = Company::GetIfValid(company_id);
src/console_cmds.cpp
Show inline comments
 
@@ -825,7 +825,7 @@ DEF_CONSOLE_CMD(ConResetCompany)
 
	}
 

	
 
	/* It is safe to remove this company */
 
	DoCommandP(0, CCA_DELETE | index << 16, CRR_MANUAL, CMD_COMPANY_CTRL);
 
	DoCommandP(0, CCA_DELETE | index << 16 | CRR_MANUAL << 24, 0, CMD_COMPANY_CTRL);
 
	IConsolePrint(CC_DEFAULT, "Company deleted.");
 

	
 
	return true;
 
@@ -1200,7 +1200,7 @@ DEF_CONSOLE_CMD(ConReloadAI)
 
	}
 

	
 
	/* First kill the company of the AI, then start a new one. This should start the current AI again */
 
	DoCommandP(0, CCA_DELETE | company_id << 16, CRR_MANUAL, CMD_COMPANY_CTRL);
 
	DoCommandP(0, CCA_DELETE | company_id << 16 | CRR_MANUAL << 24, 0,CMD_COMPANY_CTRL);
 
	DoCommandP(0, CCA_NEW_AI | company_id << 16, 0, CMD_COMPANY_CTRL);
 
	IConsolePrint(CC_DEFAULT, "AI reloaded.");
 

	
 
@@ -1237,7 +1237,7 @@ DEF_CONSOLE_CMD(ConStopAI)
 
	}
 

	
 
	/* Now kill the company of the AI. */
 
	DoCommandP(0, CCA_DELETE | company_id << 16, CRR_MANUAL, CMD_COMPANY_CTRL);
 
	DoCommandP(0, CCA_DELETE | company_id << 16 | CRR_MANUAL << 24, 0, CMD_COMPANY_CTRL);
 
	IConsolePrint(CC_DEFAULT, "AI stopped, company deleted.");
 

	
 
	return true;
src/economy.cpp
Show inline comments
 
@@ -640,7 +640,7 @@ static void CompanyCheckBankrupt(Company
 
			 * that changing the current company is okay. In case of single
 
			 * player we are sure (the above check) that we are not the local
 
			 * company and thus we won't be moved. */
 
			if (!_networking || _network_server) DoCommandP(0, CCA_DELETE | (c->index << 16), CRR_BANKRUPT, CMD_COMPANY_CTRL);
 
			if (!_networking || _network_server) DoCommandP(0, CCA_DELETE | (c->index << 16) | (CRR_BANKRUPT << 24), 0, CMD_COMPANY_CTRL);
 
			break;
 
		}
 
	}
src/network/network_server.cpp
Show inline comments
 
@@ -1673,7 +1673,7 @@ static void NetworkAutoCleanCompanies()
 
			/* Is the company empty for autoclean_unprotected-months, and is there no protection? */
 
			if (_settings_client.network.autoclean_unprotected != 0 && _network_company_states[c->index].months_empty > _settings_client.network.autoclean_unprotected && StrEmpty(_network_company_states[c->index].password)) {
 
				/* Shut the company down */
 
				DoCommandP(0, CCA_DELETE | c->index << 16, CRR_AUTOCLEAN, CMD_COMPANY_CTRL);
 
				DoCommandP(0, CCA_DELETE | c->index << 16 | CRR_AUTOCLEAN << 24, 0, CMD_COMPANY_CTRL);
 
				IConsolePrintF(CC_DEFAULT, "Auto-cleaned company #%d with no password", c->index + 1);
 
			}
 
			/* Is the company empty for autoclean_protected-months, and there is a protection? */
 
@@ -1687,7 +1687,7 @@ static void NetworkAutoCleanCompanies()
 
			/* Is the company empty for autoclean_novehicles-months, and has no vehicles? */
 
			if (_settings_client.network.autoclean_novehicles != 0 && _network_company_states[c->index].months_empty > _settings_client.network.autoclean_novehicles && vehicles_in_company[c->index] == 0) {
 
				/* Shut the company down */
 
				DoCommandP(0, CCA_DELETE | c->index << 16, CRR_AUTOCLEAN, CMD_COMPANY_CTRL);
 
				DoCommandP(0, CCA_DELETE | c->index << 16 | CRR_AUTOCLEAN << 24, 0, CMD_COMPANY_CTRL);
 
				IConsolePrintF(CC_DEFAULT, "Auto-cleaned company #%d with no vehicles", c->index + 1);
 
			}
 
		} else {
0 comments (0 inline, 0 general)