Merge branch 'openttd'

This commit is contained in:
dP
2023-02-03 15:06:09 +04:00
157 changed files with 4980 additions and 3101 deletions

View File

@@ -828,18 +828,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;
@@ -1995,13 +1983,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);
@@ -3208,9 +3189,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);
}
}
@@ -3234,9 +3215,22 @@ bool AfterLoadGame()
AfterLoadLinkGraphs();
/* 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;
}