Codechange: use std::source_location over __FILE__ and __LINE__ for Backup

This commit is contained in:
Rubidium
2024-01-17 03:33:23 +01:00
committed by rubidium42
parent 381dee2e01
commit bab5a8a787
26 changed files with 65 additions and 70 deletions

View File

@@ -336,14 +336,14 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
/* We need to set _current_company to old_owner before we try to move
* the client. This is needed as it needs to know whether "you" really
* are the current local company. */
Backup<CompanyID> cur_company(_current_company, old_owner, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, old_owner);
/* In all cases, make spectators of clients connected to that company */
if (_networking) NetworkClientsToSpectators(old_owner);
if (old_owner == _local_company) {
/* Single player cheated to AI company.
* There are no spectators in singleplayer mode, so we must pick some other company. */
assert(!_networking);
Backup<CompanyID> cur_company2(_current_company, FILE_LINE);
Backup<CompanyID> cur_company2(_current_company);
for (const Company *c : Company::Iterate()) {
if (c->index != old_owner) {
SetLocalCompany(c->index);
@@ -661,7 +661,7 @@ static void CompaniesGenStatistics()
CompanyCheckBankrupt(c);
}
Backup<CompanyID> cur_company(_current_company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company);
/* Pay Infrastructure Maintenance, if enabled */
if (_settings_game.economy.infrastructure_maintenance) {
@@ -824,7 +824,7 @@ void RecomputePrices()
/** Let all companies pay the monthly interest on their loan. */
static void CompaniesPayInterest()
{
Backup<CompanyID> cur_company(_current_company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company);
for (const Company *c : Company::Iterate()) {
cur_company.Change(c->index);
@@ -1205,7 +1205,7 @@ CargoPayment::~CargoPayment()
if (this->visual_profit == 0 && this->visual_transfer == 0) return;
Backup<CompanyID> cur_company(_current_company, this->front->owner, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, this->front->owner);
SubtractMoneyFromCompany(CommandCost(this->front->GetExpenseType(true), -this->route_profit));
this->front->profit_this_year += (this->visual_profit + this->visual_transfer) << 8;
@@ -1496,7 +1496,7 @@ static void HandleStationRefit(Vehicle *v, CargoArray &consist_capleft, Station
Vehicle *v_start = v->GetFirstEnginePart();
if (!IterateVehicleParts(v_start, IsEmptyAction())) return;
Backup<CompanyID> cur_company(_current_company, v->owner, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, v->owner);
CargoTypes refit_mask = v->GetEngine()->info.refit_mask;