mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-08 23:34:15 +00:00
Codechange: Avoid copying function parameters by using const references
This commit is contained in:
parent
0c80ae5288
commit
4552b17691
@ -589,7 +589,7 @@ struct AISettingsWindow : public Window {
|
||||
}
|
||||
|
||||
private:
|
||||
bool IsEditableItem(const ScriptConfigItem config_item) const
|
||||
bool IsEditableItem(const ScriptConfigItem &config_item) const
|
||||
{
|
||||
return _game_mode == GM_MENU || ((this->slot != OWNER_DEITY) && !Company::IsValidID(this->slot)) || (config_item.flags & SCRIPTCONFIG_INGAME) != 0;
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ bool CheckCompanyHasMoney(CommandCost &cost)
|
||||
* @param c Company to pay the bill.
|
||||
* @param cost Money to pay.
|
||||
*/
|
||||
static void SubtractMoneyFromAnyCompany(Company *c, CommandCost cost)
|
||||
static void SubtractMoneyFromAnyCompany(Company *c, const CommandCost &cost)
|
||||
{
|
||||
if (cost.GetCost() == 0) return;
|
||||
assert(cost.GetExpensesType() != INVALID_EXPENSES);
|
||||
@ -237,7 +237,7 @@ static void SubtractMoneyFromAnyCompany(Company *c, CommandCost cost)
|
||||
* Subtract money from the #_current_company, if the company is valid.
|
||||
* @param cost Money to pay.
|
||||
*/
|
||||
void SubtractMoneyFromCompany(CommandCost cost)
|
||||
void SubtractMoneyFromCompany(const CommandCost &cost)
|
||||
{
|
||||
Company *c = Company::GetIfValid(_current_company);
|
||||
if (c != nullptr) SubtractMoneyFromAnyCompany(c, cost);
|
||||
@ -248,7 +248,7 @@ void SubtractMoneyFromCompany(CommandCost cost)
|
||||
* @param company Company paying the bill.
|
||||
* @param cst Cost of a command.
|
||||
*/
|
||||
void SubtractMoneyFromCompanyFract(CompanyID company, CommandCost cst)
|
||||
void SubtractMoneyFromCompanyFract(CompanyID company, const CommandCost &cst)
|
||||
{
|
||||
Company *c = Company::Get(company);
|
||||
byte m = c->money_fraction;
|
||||
|
@ -25,8 +25,8 @@ void CompanyAdminBankrupt(CompanyID company_id);
|
||||
void UpdateLandscapingLimits();
|
||||
|
||||
bool CheckCompanyHasMoney(CommandCost &cost);
|
||||
void SubtractMoneyFromCompany(CommandCost cost);
|
||||
void SubtractMoneyFromCompanyFract(CompanyID company, CommandCost cost);
|
||||
void SubtractMoneyFromCompany(const CommandCost& cost);
|
||||
void SubtractMoneyFromCompanyFract(CompanyID company, const CommandCost& cost);
|
||||
CommandCost CheckOwnership(Owner owner, TileIndex tile = 0);
|
||||
CommandCost CheckTileOwnership(TileIndex tile);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user