Merge branch 'master' into jgrpp

# Conflicts:
#	src/bridge_map.h
#	src/crashlog.cpp
#	src/industry.h
#	src/linkgraph/linkgraph_type.h
#	src/order_type.h
#	src/saveload/afterload.cpp
#	src/settings.cpp
#	src/settings_type.h
#	src/smallmap_gui.cpp
#	src/spritecache.cpp
#	src/stdafx.h
#	src/table/settings.h.preamble
#	src/train.h
#	src/vehicle.cpp
#	src/viewport.cpp
#	src/viewport_func.h
#	src/widgets/station_widget.h
#	src/zoom_func.h
#	src/zoom_type.h
This commit is contained in:
Jonathan G Rennison
2019-07-08 16:19:07 +01:00
136 changed files with 706 additions and 501 deletions

View File

@@ -297,14 +297,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<CompanyByte> cur_company(_current_company, old_owner, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, old_owner, FILE_LINE);
/* 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 single player, so we must pick some other company. */
assert(!_networking);
Backup<CompanyByte> cur_company2(_current_company, FILE_LINE);
Backup<CompanyID> cur_company2(_current_company, FILE_LINE);
Company *c;
FOR_ALL_COMPANIES(c) {
if (c->index != old_owner) {
@@ -340,7 +340,7 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
}
/* Sell all the shares that people have on this company */
Backup<CompanyByte> cur_company2(_current_company, FILE_LINE);
Backup<CompanyID> cur_company2(_current_company, FILE_LINE);
c = Company::Get(old_owner);
for (i = 0; i < 4; i++) {
cur_company2.Change(c->share_owners[i]);
@@ -709,7 +709,7 @@ static void CompaniesGenStatistics()
CompanyCheckBankrupt(c);
}
Backup<CompanyByte> cur_company(_current_company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, FILE_LINE);
if (!_settings_game.economy.infrastructure_maintenance) {
Station *st;
@@ -879,7 +879,7 @@ static void CompaniesPayInterest()
{
const Company *c;
Backup<CompanyByte> cur_company(_current_company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, FILE_LINE);
FOR_ALL_COMPANIES(c) {
cur_company.Change(c->index);
@@ -1235,7 +1235,7 @@ CargoPayment::~CargoPayment()
if (this->visual_profit == 0 && this->visual_transfer == 0) return;
Backup<CompanyByte> cur_company(_current_company, this->front->owner, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, this->front->owner, FILE_LINE);
SubtractMoneyFromCompany(CommandCost(this->front->GetExpenseType(true), -this->route_profit));
this->front->profit_this_year += (this->visual_profit + this->visual_transfer) << 8;
@@ -1578,7 +1578,7 @@ static void HandleStationRefit(Vehicle *v, CargoArray &consist_capleft, Station
if (!IterateVehicleParts(v_start, IsEmptyAction())) return;
if (v->type == VEH_TRAIN && !IterateVehicleParts(v_start, ThroughLoadTrainInPlatformAction())) return;
Backup<CompanyByte> cur_company(_current_company, v->owner, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, v->owner, FILE_LINE);
CargoTypes refit_mask = v->GetEngine()->info.refit_mask;
@@ -2287,7 +2287,7 @@ CommandCost CmdBuyShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1,
cost.AddCost(CalculateCompanyValue(c) >> 2);
if (flags & DC_EXEC) {
OwnerByte *b = c->share_owners;
Owner *b = c->share_owners;
while (*b != COMPANY_SPECTATOR) b++; // share owners is guaranteed to contain at least one COMPANY_SPECTATOR
*b = _current_company;
@@ -2334,7 +2334,7 @@ CommandCost CmdSellShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1
cost = -(cost - (cost >> 7));
if (flags & DC_EXEC) {
OwnerByte *b = c->share_owners;
Owner *b = c->share_owners;
while (*b != _current_company) b++; // share owners is guaranteed to contain company
*b = COMPANY_SPECTATOR;
InvalidateWindowData(WC_COMPANY, target_company);