Merge remote-tracking branch 'upstream/master' into 13.0

This commit is contained in:
dP
2023-02-03 15:48:54 +04:00
159 changed files with 6991 additions and 4963 deletions
+16 -22
View File
@@ -870,18 +870,6 @@ bool AfterLoadGame()
* version. It didn't show up before r12070. */
if (IsSavegameVersionBefore(SLV_87)) UpdateVoidTiles();
/* If Load Scenario / New (Scenario) Game is used,
* a company does not exist yet. So create one here.
* 1 exception: network-games. Those can have 0 companies
* But this exception is not true for non-dedicated network servers! */
if (!_networking || (_networking && _network_server && !_network_dedicated)) {
CompanyID first_human_company = GetFirstPlayableCompanyID();
if (!Company::IsValidID(first_human_company)) {
Company *c = DoStartupNewCompany(false, first_human_company);
c->settings = _settings_client.company;
}
}
/* Fix the cache for cargo payments. */
for (CargoPayment *cp : CargoPayment::Iterate()) {
cp->front->cargo_payment = cp;
@@ -2037,13 +2025,6 @@ bool AfterLoadGame()
}
}
if (IsSavegameVersionBefore(SLV_102)) {
for (TileIndex t = 0; t < map_size; t++) {
/* Now all crossings should be in correct state */
if (IsLevelCrossingTile(t)) UpdateLevelCrossing(t, false);
}
}
if (IsSavegameVersionBefore(SLV_103)) {
/* Non-town-owned roads now store the closest town */
UpdateNearestTownForRoadTiles(false);
@@ -3250,9 +3231,9 @@ bool AfterLoadGame()
}
}
/* Refresh all level crossings to bar adjacent crossing tiles. */
/* Refresh all level crossings to bar adjacent crossing tiles, if needed. */
for (TileIndex tile = 0; tile < MapSize(); tile++) {
if (IsLevelCrossingTile(tile)) UpdateLevelCrossing(tile, false, true);
if (IsLevelCrossingTile(tile)) UpdateLevelCrossing(tile, false);
}
}
@@ -3280,9 +3261,22 @@ bool AfterLoadGame()
if ((!_networking || _network_server ) && _settings_client.gui.cm_pause_after_load) _pause_mode = PM_PAUSED_NORMAL;
/* Start the scripts. This MUST happen after everything else. */
/* Start the scripts. This MUST happen after everything else except
* starting a new company. */
StartScripts();
/* If Load Scenario / New (Scenario) Game is used,
* a company does not exist yet. So create one here.
* 1 exception: network-games. Those can have 0 companies
* But this exception is not true for non-dedicated network servers! */
if (!_networking || (_networking && _network_server && !_network_dedicated)) {
CompanyID first_human_company = GetFirstPlayableCompanyID();
if (!Company::IsValidID(first_human_company)) {
Company *c = DoStartupNewCompany(false, first_human_company);
c->settings = _settings_client.company;
}
}
return true;
}