Update to 1.11.0-beta1
This commit is contained in:
+30
-29
@@ -599,8 +599,8 @@ bool AfterLoadGame()
|
||||
int dx = TileX(t) - TileX(st->train_station.tile);
|
||||
int dy = TileY(t) - TileY(st->train_station.tile);
|
||||
assert(dx >= 0 && dy >= 0);
|
||||
st->train_station.w = max<uint>(st->train_station.w, dx + 1);
|
||||
st->train_station.h = max<uint>(st->train_station.h, dy + 1);
|
||||
st->train_station.w = std::max<uint>(st->train_station.w, dx + 1);
|
||||
st->train_station.h = std::max<uint>(st->train_station.h, dy + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -645,20 +645,20 @@ bool AfterLoadGame()
|
||||
if (IsSavegameVersionBefore(SLV_84)) {
|
||||
for (Company *c : Company::Iterate()) {
|
||||
c->name = CopyFromOldName(c->name_1);
|
||||
if (c->name != nullptr) c->name_1 = STR_SV_UNNAMED;
|
||||
if (!c->name.empty()) c->name_1 = STR_SV_UNNAMED;
|
||||
c->president_name = CopyFromOldName(c->president_name_1);
|
||||
if (c->president_name != nullptr) c->president_name_1 = SPECSTR_PRESIDENT_NAME;
|
||||
if (!c->president_name.empty()) c->president_name_1 = SPECSTR_PRESIDENT_NAME;
|
||||
}
|
||||
|
||||
for (Station *st : Station::Iterate()) {
|
||||
st->name = CopyFromOldName(st->string_id);
|
||||
/* generating new name would be too much work for little effect, use the station name fallback */
|
||||
if (st->name != nullptr) st->string_id = STR_SV_STNAME_FALLBACK;
|
||||
if (!st->name.empty()) st->string_id = STR_SV_STNAME_FALLBACK;
|
||||
}
|
||||
|
||||
for (Town *t : Town::Iterate()) {
|
||||
t->name = CopyFromOldName(t->townnametype);
|
||||
if (t->name != nullptr) t->townnametype = SPECSTR_TOWNNAME_START + _settings_game.game_creation.town_name;
|
||||
if (!t->name.empty()) t->townnametype = SPECSTR_TOWNNAME_START + _settings_game.game_creation.town_name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -755,12 +755,7 @@ bool AfterLoadGame()
|
||||
_settings_game.linkgraph.distribution_default = DT_MANUAL;
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_105)) {
|
||||
extern int32 _old_ending_year_slv_105; // in date.cpp
|
||||
_settings_game.game_creation.ending_year = _old_ending_year_slv_105 - 1;
|
||||
} else if (IsSavegameVersionBefore(SLV_ENDING_YEAR)) {
|
||||
/* Ending year was a GUI setting before SLV_105, was removed in revision 683b65ee1 (svn r14755). */
|
||||
/* This also converts scenarios, both when loading them into the editor, and when starting a new game. */
|
||||
if (IsSavegameVersionBefore(SLV_ENDING_YEAR)) {
|
||||
_settings_game.game_creation.ending_year = DEF_END_YEAR;
|
||||
}
|
||||
|
||||
@@ -932,19 +927,19 @@ bool AfterLoadGame()
|
||||
break;
|
||||
|
||||
case STATION_OILRIG: {
|
||||
/* The internal encoding of oil rigs was changed twice.
|
||||
* It was 3 (till 2.2) and later 5 (till 5.1).
|
||||
* DeleteOilRig asserts on the correct type, and
|
||||
* setting it unconditionally does not hurt.
|
||||
*/
|
||||
Station::GetByTile(t)->airport.type = AT_OILRIG;
|
||||
|
||||
/* Very old savegames sometimes have phantom oil rigs, i.e.
|
||||
* an oil rig which got shut down, but not completely removed from
|
||||
* the map
|
||||
*/
|
||||
TileIndex t1 = TILE_ADDXY(t, 0, 1);
|
||||
if (IsTileType(t1, MP_INDUSTRY) &&
|
||||
GetIndustryGfx(t1) == GFX_OILRIG_1) {
|
||||
/* The internal encoding of oil rigs was changed twice.
|
||||
* It was 3 (till 2.2) and later 5 (till 5.1).
|
||||
* Setting it unconditionally does not hurt.
|
||||
*/
|
||||
Station::GetByTile(t)->airport.type = AT_OILRIG;
|
||||
} else {
|
||||
if (!IsTileType(t1, MP_INDUSTRY) || GetIndustryGfx(t1) != GFX_OILRIG_1) {
|
||||
DeleteOilRig(t);
|
||||
}
|
||||
break;
|
||||
@@ -1733,8 +1728,7 @@ bool AfterLoadGame()
|
||||
|
||||
v->current_order.ConvertFromOldSavegame();
|
||||
if (v->type == VEH_ROAD && v->IsPrimaryVehicle() && v->FirstShared() == v) {
|
||||
Order* order;
|
||||
FOR_VEHICLE_ORDERS(v, order) order->SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
|
||||
for (Order *order : v->Orders()) order->SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
|
||||
}
|
||||
}
|
||||
} else if (IsSavegameVersionBefore(SLV_94)) {
|
||||
@@ -2183,7 +2177,7 @@ bool AfterLoadGame()
|
||||
for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end(); ++iter) {
|
||||
/* There are always as many CargoPayments as Vehicles. We need to make the
|
||||
* assert() in Pool::GetNew() happy by calling CanAllocateItem(). */
|
||||
assert_compile(CargoPaymentPool::MAX_SIZE == VehiclePool::MAX_SIZE);
|
||||
static_assert(CargoPaymentPool::MAX_SIZE == VehiclePool::MAX_SIZE);
|
||||
assert(CargoPayment::CanAllocateItem());
|
||||
Vehicle *v = *iter;
|
||||
if (v->cargo_payment == nullptr) v->cargo_payment = new CargoPayment(v);
|
||||
@@ -2458,7 +2452,7 @@ bool AfterLoadGame()
|
||||
uint per_proc = _me[t].m7;
|
||||
_me[t].m7 = GB(_me[t].m6, 2, 6) | (GB(_m[t].m3, 5, 1) << 6);
|
||||
SB(_m[t].m3, 5, 1, 0);
|
||||
SB(_me[t].m6, 2, 6, min(per_proc, 63));
|
||||
SB(_me[t].m6, 2, 6, std::min(per_proc, 63U));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2502,11 +2496,11 @@ bool AfterLoadGame()
|
||||
* highest possible number to get them numbered in the
|
||||
* order they have in the pool. */
|
||||
for (Waypoint *wp : Waypoint::Iterate()) {
|
||||
if (wp->name != nullptr) wp->town_cn = UINT16_MAX;
|
||||
if (!wp->name.empty()) wp->town_cn = UINT16_MAX;
|
||||
}
|
||||
|
||||
for (Waypoint* wp : Waypoint::Iterate()) {
|
||||
if (wp->name != nullptr) MakeDefaultName(wp);
|
||||
if (!wp->name.empty()) MakeDefaultName(wp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2714,7 +2708,7 @@ bool AfterLoadGame()
|
||||
_settings_game.pf.reverse_at_signals = IsSavegameVersionBefore(SLV_100) || (_settings_game.pf.wait_oneway_signal != 255 && _settings_game.pf.wait_twoway_signal != 255 && _settings_game.pf.wait_for_pbs_path != 255);
|
||||
|
||||
for (Train *t : Train::Iterate()) {
|
||||
_settings_game.vehicle.max_train_length = max<uint8>(_settings_game.vehicle.max_train_length, CeilDiv(t->gcache.cached_total_length, TILE_SIZE));
|
||||
_settings_game.vehicle.max_train_length = std::max<uint8>(_settings_game.vehicle.max_train_length, CeilDiv(t->gcache.cached_total_length, TILE_SIZE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2924,8 +2918,7 @@ bool AfterLoadGame()
|
||||
cur_skip = prev_tile_skip;
|
||||
}
|
||||
|
||||
/*C++17: uint &this_skip = */ skip_frames.push_back(prev_tile_skip);
|
||||
uint &this_skip = skip_frames.back();
|
||||
uint &this_skip = skip_frames.emplace_back(prev_tile_skip);
|
||||
|
||||
/* The following 3 curves now take longer than before */
|
||||
switch (u->state) {
|
||||
@@ -3126,6 +3119,14 @@ bool AfterLoadGame()
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure all industries exclusive supplier/consumer set correctly. */
|
||||
if (IsSavegameVersionBefore(SLV_GS_INDUSTRY_CONTROL)) {
|
||||
for (Industry *i : Industry::Iterate()) {
|
||||
i->exclusive_supplier = INVALID_OWNER;
|
||||
i->exclusive_consumer = INVALID_OWNER;
|
||||
}
|
||||
}
|
||||
|
||||
/* Compute station catchment areas. This is needed here in case UpdateStationAcceptance is called below. */
|
||||
Station::RecomputeCatchmentForAll();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user