(svn r16868) -Codechange: unify UpdateAll[Station|Waypoint]VirtCoords

pull/155/head
rubidium 15 years ago
parent 12ea92a257
commit b4f5a1eebb

@ -216,7 +216,6 @@ static bool InitializeWindowsAndCaches()
UpdateAllStationVirtCoords(); UpdateAllStationVirtCoords();
UpdateAllSignVirtCoords(); UpdateAllSignVirtCoords();
UpdateAllTownVirtCoords(); UpdateAllTownVirtCoords();
UpdateAllWaypointVirtCoords();
Company *c; Company *c;
FOR_ALL_COMPANIES(c) { FOR_ALL_COMPANIES(c) {

@ -322,7 +322,6 @@ struct GameOptionsWindow : Window {
ReadLanguagePack(index); ReadLanguagePack(index);
CheckForMissingGlyphsInLoadedLanguagePack(); CheckForMissingGlyphsInLoadedLanguagePack();
UpdateAllStationVirtCoords(); UpdateAllStationVirtCoords();
UpdateAllWaypointVirtCoords();
ReInitAllWindows(); ReInitAllWindows();
MarkWholeScreenDirty(); MarkWholeScreenDirty();
break; break;

@ -119,6 +119,11 @@ struct BaseStation {
*/ */
virtual uint32 GetNewGRFVariable(const struct ResolverObject *object, byte variable, byte parameter, bool *available) const = 0; 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. * Get the base station belonging to a specific tile.
* @param tile The tile to get the base station from. * @param tile The tile to get the base station from.

@ -33,6 +33,7 @@
#include "elrail_func.h" #include "elrail_func.h"
#include "station_base.h" #include "station_base.h"
#include "roadstop_base.h" #include "roadstop_base.h"
#include "waypoint.h"
#include "table/strings.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. */ /** Update the virtual coords needed to draw the station sign for all stations. */
void UpdateAllStationVirtCoords() void UpdateAllStationVirtCoords()
{ {
Station *st; BaseStation *st;
FOR_ALL_STATIONS(st) { FOR_ALL_STATIONS(st) {
st->UpdateVirtCoord(); st->UpdateVirtCoord();
} }
FOR_ALL_WAYPOINTS(st) {
st->UpdateVirtCoord();
}
} }
/** Get a mask of the cargo types that the station accepts. /** Get a mask of the cargo types that the station accepts.

@ -2286,7 +2286,6 @@ CommandCost CmdRenameTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
t->UpdateVirtCoord(); t->UpdateVirtCoord();
InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1); InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1);
UpdateAllStationVirtCoords(); UpdateAllStationVirtCoords();
UpdateAllWaypointVirtCoords();
} }
return CommandCost(); return CommandCost();
} }

@ -17,18 +17,6 @@
WaypointPool _waypoint_pool("Waypoint"); WaypointPool _waypoint_pool("Waypoint");
INSTANTIATE_POOL_METHODS(Waypoint) INSTANTIATE_POOL_METHODS(Waypoint)
/**
* Update all signs
*/
void UpdateAllWaypointVirtCoords()
{
Waypoint *wp;
FOR_ALL_WAYPOINTS(wp) {
wp->UpdateVirtCoord();
}
}
/** /**
* Daily loop for waypoints * Daily loop for waypoints
*/ */

@ -51,6 +51,5 @@ struct Waypoint : WaypointPool::PoolItem<&_waypoint_pool>, BaseStation {
CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove); CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove);
void ShowWaypointWindow(const Waypoint *wp); void ShowWaypointWindow(const Waypoint *wp);
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype); void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype);
void UpdateAllWaypointVirtCoords();
#endif /* WAYPOINT_H */ #endif /* WAYPOINT_H */

Loading…
Cancel
Save