summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-18 08:41:58 +0000
committerrubidium <rubidium@openttd.org>2009-07-18 08:41:58 +0000
commit8c17c6cb2bba037e0e7cbe5f97bc2e025bed9a6f (patch)
tree6925fe6d155eb8661a45e2a66524d94de520076f
parentf129634f524b38bcb00f5e7b24ccd8a982a16ca9 (diff)
downloadopenttd-8c17c6cb2bba037e0e7cbe5f97bc2e025bed9a6f.tar.xz
(svn r16868) -Codechange: unify UpdateAll[Station|Waypoint]VirtCoords
-rw-r--r--src/saveload/afterload.cpp1
-rw-r--r--src/settings_gui.cpp1
-rw-r--r--src/station_base.h5
-rw-r--r--src/station_cmd.cpp7
-rw-r--r--src/town_cmd.cpp1
-rw-r--r--src/waypoint.cpp12
-rw-r--r--src/waypoint.h1
7 files changed, 11 insertions, 17 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 798503f2c..052d3d6e3 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -216,7 +216,6 @@ static bool InitializeWindowsAndCaches()
UpdateAllStationVirtCoords();
UpdateAllSignVirtCoords();
UpdateAllTownVirtCoords();
- UpdateAllWaypointVirtCoords();
Company *c;
FOR_ALL_COMPANIES(c) {
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index ae1dc9122..d56537a04 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -322,7 +322,6 @@ struct GameOptionsWindow : Window {
ReadLanguagePack(index);
CheckForMissingGlyphsInLoadedLanguagePack();
UpdateAllStationVirtCoords();
- UpdateAllWaypointVirtCoords();
ReInitAllWindows();
MarkWholeScreenDirty();
break;
diff --git a/src/station_base.h b/src/station_base.h
index b9efcc1ae..9d092f057 100644
--- a/src/station_base.h
+++ b/src/station_base.h
@@ -120,6 +120,11 @@ struct BaseStation {
virtual uint32 GetNewGRFVariable(const struct ResolverObject *object, byte variable, byte parameter, bool *available) const = 0;
/**
+ * Update the coordinated of the sign (as shown in the viewport).
+ */
+ virtual void UpdateVirtCoord() = 0;
+
+ /**
* Get the base station belonging to a specific tile.
* @param tile The tile to get the base station from.
* @return the station associated with that tile.
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index bb1db7152..c6e98c612 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -33,6 +33,7 @@
#include "elrail_func.h"
#include "station_base.h"
#include "roadstop_base.h"
+#include "waypoint.h"
#include "table/strings.h"
@@ -384,11 +385,15 @@ void Station::UpdateVirtCoord()
/** Update the virtual coords needed to draw the station sign for all stations. */
void UpdateAllStationVirtCoords()
{
- Station *st;
+ BaseStation *st;
FOR_ALL_STATIONS(st) {
st->UpdateVirtCoord();
}
+
+ FOR_ALL_WAYPOINTS(st) {
+ st->UpdateVirtCoord();
+ }
}
/** Get a mask of the cargo types that the station accepts.
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 843e639be..463435943 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -2286,7 +2286,6 @@ CommandCost CmdRenameTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
t->UpdateVirtCoord();
InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1);
UpdateAllStationVirtCoords();
- UpdateAllWaypointVirtCoords();
}
return CommandCost();
}
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index acfda8334..e56fbca0d 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -18,18 +18,6 @@ WaypointPool _waypoint_pool("Waypoint");
INSTANTIATE_POOL_METHODS(Waypoint)
/**
- * Update all signs
- */
-void UpdateAllWaypointVirtCoords()
-{
- Waypoint *wp;
-
- FOR_ALL_WAYPOINTS(wp) {
- wp->UpdateVirtCoord();
- }
-}
-
-/**
* Daily loop for waypoints
*/
void WaypointsDailyLoop()
diff --git a/src/waypoint.h b/src/waypoint.h
index 1ffb74fe2..ee3122fe4 100644
--- a/src/waypoint.h
+++ b/src/waypoint.h
@@ -51,6 +51,5 @@ struct Waypoint : WaypointPool::PoolItem<&_waypoint_pool>, BaseStation {
CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove);
void ShowWaypointWindow(const Waypoint *wp);
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype);
-void UpdateAllWaypointVirtCoords();
#endif /* WAYPOINT_H */