1
0
Fork 0

Change: Apply some consistency to singleplayer related comments

pull/8603/head
glx22 2021-01-22 16:24:29 +01:00 committed by Loïc Guilloux
parent 07385c3662
commit 6b8ad5a9b1
8 changed files with 12 additions and 12 deletions

View File

@ -882,7 +882,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
CompanyRemoveReason reason = (CompanyRemoveReason)GB(p1, 24, 8); CompanyRemoveReason reason = (CompanyRemoveReason)GB(p1, 24, 8);
if (reason >= CRR_END) return CMD_ERROR; if (reason >= CRR_END) return CMD_ERROR;
/* We can't delete the last existing company in offline mode. */ /* We can't delete the last existing company in singleplayer mode. */
if (!_networking && Company::GetNumItems() == 1) return CMD_ERROR; if (!_networking && Company::GetNumItems() == 1) return CMD_ERROR;
Company *c = Company::GetIfValid(company_id); Company *c = Company::GetIfValid(company_id);

View File

@ -147,7 +147,7 @@ DEF_CONSOLE_HOOK(ConHookNeedNetwork)
} }
/** /**
* Check whether we are in single player mode. * Check whether we are in singleplayer mode.
* @return True when no network is active. * @return True when no network is active.
*/ */
DEF_CONSOLE_HOOK(ConHookNoNetwork) DEF_CONSOLE_HOOK(ConHookNoNetwork)
@ -1248,7 +1248,7 @@ DEF_CONSOLE_CMD(ConReloadAI)
return true; return true;
} }
/* In offline mode the player can be in an AI company, after cheating or loading network save with an AI in first slot. */ /* In singleplayer mode the player can be in an AI company, after cheating or loading network save with an AI in first slot. */
if (Company::IsHumanID(company_id) || company_id == _local_company) { if (Company::IsHumanID(company_id) || company_id == _local_company) {
IConsoleWarning("Company is not controlled by an AI."); IConsoleWarning("Company is not controlled by an AI.");
return true; return true;
@ -1286,7 +1286,7 @@ DEF_CONSOLE_CMD(ConStopAI)
return true; return true;
} }
/* In offline mode the player can be in an AI company, after cheating or loading network save with an AI in first slot. */ /* In singleplayer mode the player can be in an AI company, after cheating or loading network save with an AI in first slot. */
if (Company::IsHumanID(company_id) || company_id == _local_company) { if (Company::IsHumanID(company_id) || company_id == _local_company) {
IConsoleWarning("Company is not controlled by an AI."); IConsoleWarning("Company is not controlled by an AI.");
return true; return true;

View File

@ -289,7 +289,7 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
if (_networking) NetworkClientsToSpectators(old_owner); if (_networking) NetworkClientsToSpectators(old_owner);
if (old_owner == _local_company) { if (old_owner == _local_company) {
/* Single player cheated to AI company. /* Single player cheated to AI company.
* There are no spectators in single player, so we must pick some other company. */ * There are no spectators in singleplayer mode, so we must pick some other company. */
assert(!_networking); assert(!_networking);
Backup<CompanyID> cur_company2(_current_company, FILE_LINE); Backup<CompanyID> cur_company2(_current_company, FILE_LINE);
for (const Company *c : Company::Iterate()) { for (const Company *c : Company::Iterate()) {
@ -605,7 +605,7 @@ static void CompanyCheckBankrupt(Company *c)
default: default:
case 10: { case 10: {
if (!_networking && _local_company == c->index) { if (!_networking && _local_company == c->index) {
/* If we are in offline mode, leave the company playing. Eg. there /* If we are in singleplayer mode, leave the company playing. Eg. there
* is no THE-END, otherwise mark the client as spectator to make sure * is no THE-END, otherwise mark the client as spectator to make sure
* he/she is no long in control of this company. However... when you * he/she is no long in control of this company. However... when you
* join another company (cheat) the "unowned" company can bankrupt. */ * join another company (cheat) the "unowned" company can bankrupt. */
@ -2114,7 +2114,7 @@ CommandCost CmdBuyCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* Disable takeovers when not asked */ /* Disable takeovers when not asked */
if (!HasBit(c->bankrupt_asked, _current_company)) return CMD_ERROR; if (!HasBit(c->bankrupt_asked, _current_company)) return CMD_ERROR;
/* Disable taking over the local company in single player */ /* Disable taking over the local company in singleplayer mode */
if (!_networking && _local_company == c->index) return CMD_ERROR; if (!_networking && _local_company == c->index) return CMD_ERROR;
/* Do not allow companies to take over themselves */ /* Do not allow companies to take over themselves */

View File

@ -113,7 +113,7 @@ struct EndGameWindow : EndGameHighScoreBaseWindow {
this->window_number = SP_MULTIPLAYER; this->window_number = SP_MULTIPLAYER;
this->rank = SaveHighScoreValueNetwork(); this->rank = SaveHighScoreValueNetwork();
} else { } else {
/* in single player _local company is always valid */ /* in singleplayer mode _local company is always valid */
const Company *c = Company::Get(_local_company); const Company *c = Company::Get(_local_company);
this->window_number = SP_CUSTOM; this->window_number = SP_CUSTOM;
this->rank = SaveHighScoreValue(c); this->rank = SaveHighScoreValue(c);

View File

@ -313,7 +313,7 @@ struct MainWindow : Window
break; break;
case GHK_MONEY: // Gimme money case GHK_MONEY: // Gimme money
/* You can only cheat for money in single player. */ /* You can only cheat for money in singleplayer mode. */
if (!_networking) DoCommandP(0, 10000000, 0, CMD_MONEY_CHEAT); if (!_networking) DoCommandP(0, 10000000, 0, CMD_MONEY_CHEAT);
break; break;

View File

@ -298,7 +298,7 @@ const char *NetworkGameSocketHandler::ReceiveCommand(Packet *p, CommandPacket *c
cp->company = (CompanyID)p->Recv_uint8(); cp->company = (CompanyID)p->Recv_uint8();
cp->cmd = p->Recv_uint32(); cp->cmd = p->Recv_uint32();
if (!IsValidCommand(cp->cmd)) return "invalid command"; if (!IsValidCommand(cp->cmd)) return "invalid command";
if (GetCommandFlags(cp->cmd) & CMD_OFFLINE) return "offline only command"; if (GetCommandFlags(cp->cmd) & CMD_OFFLINE) return "single-player only command";
if ((cp->cmd & CMD_FLAGS_MASK) != 0) return "invalid command flag"; if ((cp->cmd & CMD_FLAGS_MASK) != 0) return "invalid command flag";
cp->p1 = p->Recv_uint32(); cp->p1 = p->Recv_uint32();

View File

@ -1131,7 +1131,7 @@ void SwitchToMode(SwitchMode new_mode)
break; break;
case SM_SAVE_GAME: // Save game. case SM_SAVE_GAME: // Save game.
/* Make network saved games on pause compatible to singleplayer */ /* Make network saved games on pause compatible to singleplayer mode */
if (SaveOrLoad(_file_to_saveload.name, SLO_SAVE, DFT_GAME_FILE, NO_DIRECTORY) != SL_OK) { if (SaveOrLoad(_file_to_saveload.name, SLO_SAVE, DFT_GAME_FILE, NO_DIRECTORY) != SL_OK) {
SetDParamStr(0, GetSaveLoadErrorString()); SetDParamStr(0, GetSaveLoadErrorString());
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR); ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);

View File

@ -571,7 +571,7 @@ bool AfterLoadGame()
ResetSignalHandlers(); ResetSignalHandlers();
return false; return false;
} else if (!_networking || _network_server) { } else if (!_networking || _network_server) {
/* If we are in single player, i.e. not networking, and loading the /* If we are in singleplayer mode, i.e. not networking, and loading the
* savegame or we are loading the savegame as network server we do * savegame or we are loading the savegame as network server we do
* not want to be bothered by being paused because of the automatic * not want to be bothered by being paused because of the automatic
* reason of a network server, e.g. joining clients or too few * reason of a network server, e.g. joining clients or too few