Update to 12.0-beta1

This commit is contained in:
dP
2021-08-15 14:57:29 +03:00
parent ac7d3eba75
commit 9df4f2c4fc
666 changed files with 61302 additions and 20466 deletions

View File

@@ -179,7 +179,7 @@ static void UpdateExclusiveRights()
* Build an array town_blocked[ town_id ][ company_id ]
* that stores if at least one station in that town is blocked for a company
* 2.) Go through that array, if you find a town that is not blocked for
* one company, but for all others, then give him exclusivity.
* one company, but for all others, then give it exclusivity.
*/
}
@@ -402,9 +402,11 @@ static void CDECL HandleSavegameLoadCrash(int signum)
for (const GRFConfig *c = _grfconfig; c != nullptr; c = c->next) {
if (HasBit(c->flags, GCF_COMPATIBLE)) {
const GRFIdentifier *replaced = GetOverriddenIdentifier(c);
char buf[40];
md5sumToString(buf, lastof(buf), replaced->md5sum);
p += seprintf(p, lastof(buffer), "NewGRF %08X (checksum %s) not found.\n Loaded NewGRF \"%s\" with same GRF ID instead.\n", BSWAP32(c->ident.grfid), buf, c->filename);
char original_md5[40];
char replaced_md5[40];
md5sumToString(original_md5, lastof(original_md5), c->original_md5sum);
md5sumToString(replaced_md5, lastof(replaced_md5), replaced->md5sum);
p += seprintf(p, lastof(buffer), "NewGRF %08X (checksum %s) not found.\n Loaded NewGRF \"%s\" (checksum %s) with same GRF ID instead.\n", BSWAP32(c->ident.grfid), original_md5, c->filename, replaced_md5);
}
if (c->status == GCS_NOT_FOUND) {
char buf[40];
@@ -566,8 +568,8 @@ bool AfterLoadGame()
if (IsSavegameVersionBefore(SLV_119)) {
_pause_mode = (_pause_mode == 2) ? PM_PAUSED_NORMAL : PM_UNPAUSED;
} else if (_network_dedicated && (_pause_mode & PM_PAUSED_ERROR) != 0) {
DEBUG(net, 0, "The loading savegame was paused due to an error state.");
DEBUG(net, 0, " The savegame cannot be used for multiplayer!");
Debug(net, 0, "The loading savegame was paused due to an error state");
Debug(net, 0, " This savegame cannot be used for multiplayer");
/* Restore the signals */
ResetSignalHandlers();
return false;
@@ -731,7 +733,7 @@ bool AfterLoadGame()
if (IsSavegameVersionBefore(SLV_6, 1)) _settings_game.pf.forbid_90_deg = false;
if (IsSavegameVersionBefore(SLV_21)) _settings_game.vehicle.train_acceleration_model = 0;
if (IsSavegameVersionBefore(SLV_90)) _settings_game.vehicle.plane_speed = 4;
if (IsSavegameVersionBefore(SLV_95)) _settings_game.vehicle.dynamic_engines = 0;
if (IsSavegameVersionBefore(SLV_95)) _settings_game.vehicle.dynamic_engines = false;
if (IsSavegameVersionBefore(SLV_96)) _settings_game.economy.station_noise_level = false;
if (IsSavegameVersionBefore(SLV_133)) {
_settings_game.vehicle.train_slope_steepness = 3;
@@ -1413,7 +1415,7 @@ bool AfterLoadGame()
c->avail_roadtypes = GetCompanyRoadTypes(c->index);
}
if (!IsSavegameVersionBefore(SLV_27)) AfterLoadStations();
AfterLoadStations();
/* Time starts at 0 instead of 1920.
* Account for this in older games by adding an offset */
@@ -1855,7 +1857,7 @@ bool AfterLoadGame()
}
} else if (IsTileType(t, MP_ROAD)) {
/* works for all RoadTileType */
FOR_ALL_ROADTRAMTYPES(rtt) {
for (RoadTramType rtt : _roadtramtypes) {
/* update even non-existing road types to update tile owner too */
Owner o = GetRoadOwner(t, rtt);
if (o < MAX_COMPANIES && !Company::IsValidID(o)) SetRoadOwner(t, rtt, OWNER_NONE);
@@ -2306,7 +2308,7 @@ bool AfterLoadGame()
/* At some point, invalid depots were saved into the game (possibly those removed in the past?)
* Remove them here, so they don't cause issues further down the line */
if (!IsDepotTile(d->xy)) {
DEBUG(sl, 0, "Removing invalid depot %d at %d, %d", d->index, TileX(d->xy), TileY(d->xy));
Debug(sl, 0, "Removing invalid depot {} at {}, {}", d->index, TileX(d->xy), TileY(d->xy));
delete d;
d = nullptr;
continue;
@@ -3104,7 +3106,7 @@ bool AfterLoadGame()
}
}
if (IsSavegameVersionUntil(SLV_ENDING_YEAR)) {
if (IsSavegameVersionBeforeOrAt(SLV_ENDING_YEAR)) {
/* Update station docking tiles. Was only needed for pre-SLV_MULTITLE_DOCKS
* savegames, but a bug in docking tiles touched all savegames between
* SLV_MULTITILE_DOCKS and SLV_ENDING_YEAR. */
@@ -3128,6 +3130,23 @@ bool AfterLoadGame()
}
}
if (IsSavegameVersionBefore(SLV_GROUP_REPLACE_WAGON_REMOVAL)) {
/* Propagate wagon removal flag for compatibility */
/* Temporary bitmask of company wagon removal setting */
uint16 wagon_removal = 0;
for (const Company *c : Company::Iterate()) {
if (c->settings.renew_keep_length) SetBit(wagon_removal, c->index);
}
for (Group *g : Group::Iterate()) {
if (g->flags != 0) {
/* Convert old replace_protection value to flag. */
g->flags = 0;
SetBit(g->flags, GroupFlags::GF_REPLACE_PROTECTION);
}
if (HasBit(wagon_removal, g->owner)) SetBit(g->flags, GroupFlags::GF_REPLACE_WAGON_REMOVAL);
}
}
/* Compute station catchment areas. This is needed here in case UpdateStationAcceptance is called below. */
Station::RecomputeCatchmentForAll();