summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-11-25 20:20:16 +0000
committerrubidium <rubidium@openttd.org>2007-11-25 20:20:16 +0000
commitd736a04b59a202023c0c72ff1d2347c0eb83ecff (patch)
treea31c7fedefb93556d61a465412c7d2f8318928e2 /src
parent77b6a2674e9e9d7acbe969b26622e67d40bbf579 (diff)
downloadopenttd-d736a04b59a202023c0c72ff1d2347c0eb83ecff.tar.xz
(svn r11525) -Fix: do not do all kinds of 'updates' for town, waypoint, station and other signs when you haven't converted the map to the 'current' format as that means you are going to read data in the 'old' format when you assume that it is in the 'current' format.
Diffstat (limited to 'src')
-rw-r--r--src/openttd.cpp36
-rw-r--r--src/town.h1
-rw-r--r--src/town_cmd.cpp10
3 files changed, 27 insertions, 20 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 156f563f3..e877b08b2 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1312,16 +1312,10 @@ bool AfterLoadGame()
/* Update all waypoints */
if (CheckSavegameVersion(12)) FixOldWaypoints();
- UpdateAllWaypointSigns();
-
/* in version 2.2 of the savegame, we have new airports */
if (CheckSavegameVersionOldStyle(2, 2)) UpdateOldAircraft();
- UpdateAllStationVirtCoord();
-
- /* Setup town coords */
AfterLoadTown();
- UpdateAllSignVirtCoords();
/* make sure there is a town in the game */
if (_game_mode == GM_NORMAL && !ClosestTownFromTile(0, (uint)-1)) {
@@ -1815,19 +1809,6 @@ bool AfterLoadGame()
if (!CheckSavegameVersion(27)) AfterLoadStations();
- {
- /* Set up the engine count for all players */
- Player *players[MAX_PLAYERS];
- const Vehicle *v;
-
- for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) players[i] = GetPlayer(i);
-
- FOR_ALL_VEHICLES(v) {
- if (!IsEngineCountable(v)) continue;
- players[v->owner]->num_engines[v->engine_type]++;
- }
- }
-
/* Time starts at 0 instead of 1920.
* Account for this in older games by adding an offset */
if (CheckSavegameVersion(31)) {
@@ -2205,6 +2186,12 @@ bool AfterLoadGame()
DoZoomInOutWindow(ZOOM_NONE, w); // update button status
MarkWholeScreenDirty();
+ /* Update coordinates of the signs. */
+ UpdateAllStationVirtCoord();
+ UpdateAllSignVirtCoords();
+ UpdateAllTownVirtCoords();
+ UpdateAllWaypointSigns();
+
/* Recalculate */
Group *g;
FOR_ALL_GROUPS(g) {
@@ -2218,6 +2205,17 @@ bool AfterLoadGame()
}
}
+ /* Set up the engine count for all players */
+ Player *players[MAX_PLAYERS];
+ const Vehicle *v;
+
+ for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) players[i] = GetPlayer(i);
+
+ FOR_ALL_VEHICLES(v) {
+ if (!IsEngineCountable(v)) continue;
+ players[v->owner]->num_engines[v->engine_type]++;
+ }
+
return true;
}
diff --git a/src/town.h b/src/town.h
index 7f196ccbf..d59c6c03e 100644
--- a/src/town.h
+++ b/src/town.h
@@ -207,6 +207,7 @@ VARDEF HouseSpec _house_specs[HOUSE_MAX];
uint32 GetWorldPopulation();
void UpdateTownVirtCoord(Town *t);
+void UpdateAllTownVirtCoords();
void InitializeTown();
void ShowTownViewWindow(TownID town);
void ExpandTown(Town *t);
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 71568d430..6dcac49d4 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -311,6 +311,15 @@ void UpdateTownVirtCoord(Town *t)
MarkTownSignDirty(t);
}
+/** Update the virtual coords needed to draw the town sign for all towns. */
+void UpdateAllTownVirtCoords()
+{
+ Town *t;
+ FOR_ALL_TOWNS(t) {
+ UpdateTownVirtCoord(t);
+ }
+}
+
/**
* Change the towns population
* @param t Town which polulation has changed
@@ -2521,7 +2530,6 @@ void AfterLoadTown()
Town *t;
FOR_ALL_TOWNS(t) {
UpdateTownRadius(t);
- UpdateTownVirtCoord(t);
}
_town_sort_dirty = true;
}