summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main_gui.cpp4
-rw-r--r--src/saveload/afterload.cpp4
-rw-r--r--src/settings.cpp4
-rw-r--r--src/settings_gui.cpp4
-rw-r--r--src/signs.cpp15
-rw-r--r--src/signs_base.h2
-rw-r--r--src/signs_cmd.cpp4
-rw-r--r--src/signs_func.h1
-rw-r--r--src/station_cmd.cpp6
-rw-r--r--src/station_func.h2
-rw-r--r--src/town.h5
-rw-r--r--src/town_cmd.cpp28
-rw-r--r--src/waypoint.cpp4
-rw-r--r--src/waypoint.h5
-rw-r--r--src/waypoint_cmd.cpp16
15 files changed, 51 insertions, 53 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index c6cfb1262..ceaa94788 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -183,7 +183,7 @@ void ZoomInOrOutToCursorWindow(bool in, Window *w)
}
}
-extern void UpdateAllStationVirtCoord();
+extern void UpdateAllStationVirtCoords();
struct MainWindow : Window
{
@@ -268,7 +268,7 @@ struct MainWindow : Window
break;
case '2' | WKC_ALT: // Update the coordinates of all station signs
- UpdateAllStationVirtCoord();
+ UpdateAllStationVirtCoords();
break;
#endif
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index bfba2cdd5..db6573292 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -213,10 +213,10 @@ static bool InitializeWindowsAndCaches()
ResetViewportAfterLoadGame();
/* Update coordinates of the signs. */
- UpdateAllStationVirtCoord();
+ UpdateAllStationVirtCoords();
UpdateAllSignVirtCoords();
UpdateAllTownVirtCoords();
- UpdateAllWaypointSigns();
+ UpdateAllWaypointVirtCoords();
Company *c;
FOR_ALL_COMPANIES(c) {
diff --git a/src/settings.cpp b/src/settings.cpp
index 57ac57bed..eca75e727 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -645,9 +645,7 @@ static bool v_PositionMainToolbar(int32 p1)
static bool PopulationInLabelActive(int32 p1)
{
- Town *t;
- FOR_ALL_TOWNS(t) UpdateTownVirtCoord(t);
-
+ UpdateAllTownVirtCoords();
return true;
}
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 587a664a2..4098a94fa 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -321,8 +321,8 @@ struct GameOptionsWindow : Window {
case GOW_LANG_DROPDOWN: // Change interface language
ReadLanguagePack(index);
CheckForMissingGlyphsInLoadedLanguagePack();
- UpdateAllStationVirtCoord();
- UpdateAllWaypointSigns();
+ UpdateAllStationVirtCoords();
+ UpdateAllWaypointVirtCoords();
ReInitAllWindows();
MarkWholeScreenDirty();
break;
diff --git a/src/signs.cpp b/src/signs.cpp
index 2744c31c4..ae5ef4d7c 100644
--- a/src/signs.cpp
+++ b/src/signs.cpp
@@ -33,16 +33,13 @@ Sign::~Sign()
}
/**
- *
* Update the coordinate of one sign
- * @param si Pointer to the Sign
- *
*/
-void UpdateSignVirtCoords(Sign *si)
+void Sign::UpdateVirtCoord()
{
- Point pt = RemapCoords(si->x, si->y, si->z);
- SetDParam(0, si->index);
- si->sign.UpdatePosition(pt.x, pt.y - 6, STR_SIGN_WHITE);
+ Point pt = RemapCoords(this->x, this->y, this->z);
+ SetDParam(0, this->index);
+ this->sign.UpdatePosition(pt.x, pt.y - 6, STR_SIGN_WHITE);
}
/** Update the coordinates of all signs */
@@ -50,7 +47,9 @@ void UpdateAllSignVirtCoords()
{
Sign *si;
- FOR_ALL_SIGNS(si) UpdateSignVirtCoords(si);
+ FOR_ALL_SIGNS(si) {
+ si->UpdateVirtCoord();
+ }
}
/**
diff --git a/src/signs_base.h b/src/signs_base.h
index 131816eea..0bb8a78bd 100644
--- a/src/signs_base.h
+++ b/src/signs_base.h
@@ -28,6 +28,8 @@ struct Sign : SignPool::PoolItem<&_sign_pool> {
/** Destroy the sign */
~Sign();
+
+ void UpdateVirtCoord();
};
#define FOR_ALL_SIGNS_FROM(var, start) FOR_ALL_ITEMS_FROM(Sign, sign_index, var, start)
diff --git a/src/signs_cmd.cpp b/src/signs_cmd.cpp
index b07e4b204..968885533 100644
--- a/src/signs_cmd.cpp
+++ b/src/signs_cmd.cpp
@@ -46,7 +46,7 @@ CommandCost CmdPlaceSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
if (!StrEmpty(text)) {
si->name = strdup(text);
}
- UpdateSignVirtCoords(si);
+ si->UpdateVirtCoord();
si->sign.MarkDirty();
InvalidateWindowData(WC_SIGN_LIST, 0, 0);
_new_sign_id = si->index;
@@ -82,7 +82,7 @@ CommandCost CmdRenameSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* Update; mark sign dirty twice, because it can either become longer, or shorter */
si->sign.MarkDirty();
- UpdateSignVirtCoords(si);
+ si->UpdateVirtCoord();
si->sign.MarkDirty();
InvalidateWindowData(WC_SIGN_LIST, 0, 1);
}
diff --git a/src/signs_func.h b/src/signs_func.h
index 9dd81110a..44a3237d2 100644
--- a/src/signs_func.h
+++ b/src/signs_func.h
@@ -11,7 +11,6 @@ extern SignID _new_sign_id;
void UpdateAllSignVirtCoords();
void PlaceProc_Sign(TileIndex tile);
-void UpdateSignVirtCoords(Sign *si);
/* signs_gui.cpp */
void ShowRenameSignWindow(const Sign *si);
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 890191682..a47655736 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -367,9 +367,7 @@ static Station *GetClosestDeletedStation(TileIndex tile)
}
/**
- * Update the virtual coords needed to draw the station sign and
- * mark the station sign dirty.
- * @ingroup dirty
+ * Update the virtual coords needed to draw the station sign.
*/
void Station::UpdateVirtCoord()
{
@@ -384,7 +382,7 @@ void Station::UpdateVirtCoord()
}
/** Update the virtual coords needed to draw the station sign for all stations. */
-void UpdateAllStationVirtCoord()
+void UpdateAllStationVirtCoords()
{
Station *st;
diff --git a/src/station_func.h b/src/station_func.h
index 1f1ea408b..44e037c90 100644
--- a/src/station_func.h
+++ b/src/station_func.h
@@ -20,7 +20,7 @@ typedef SmallVector<Station*, 1> StationList;
void FindStationsAroundTiles(TileIndex tile, int w_prod, int h_prod, StationList *stations);
void ShowStationViewWindow(StationID station);
-void UpdateAllStationVirtCoord();
+void UpdateAllStationVirtCoords();
CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad);
CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad);
diff --git a/src/town.h b/src/town.h
index 1f02afa8d..38327fa41 100644
--- a/src/town.h
+++ b/src/town.h
@@ -48,7 +48,7 @@ struct Town : TownPool::PoolItem<&_town_pool> {
uint32 townnameparts;
char *name;
- /* NOSAVE: Location of name sign, UpdateTownVirtCoord updates this. */
+ /* NOSAVE: Location of name sign, UpdateVirtCoord updates this. */
ViewportSign sign;
/* Makes sure we don't build certain house types twice.
@@ -136,6 +136,8 @@ struct Town : TownPool::PoolItem<&_town_pool> {
return ((this->population / _settings_game.economy.town_noise_population[_settings_game.difficulty.town_council_tolerance]) + 3);
}
+ void UpdateVirtCoord();
+
static FORCEINLINE Town *GetByTile(TileIndex tile)
{
return Town::Get(GetTownIndex(tile));
@@ -147,7 +149,6 @@ struct Town : TownPool::PoolItem<&_town_pool> {
uint32 GetWorldPopulation();
-void UpdateTownVirtCoord(Town *t);
void UpdateAllTownVirtCoords();
void InitializeTown();
void ShowTownViewWindow(TownID town);
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 2b5b3afd6..cc806f238 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -324,25 +324,25 @@ static bool IsCloseToTown(TileIndex tile, uint dist)
/**
* Resize the sign(label) of the town after changes in
* population (creation or growth or else)
- * @param t Town to update
*/
-void UpdateTownVirtCoord(Town *t)
+void Town::UpdateVirtCoord()
{
- t->sign.MarkDirty();
- Point pt = RemapCoords2(TileX(t->xy) * TILE_SIZE, TileY(t->xy) * TILE_SIZE);
- SetDParam(0, t->index);
- SetDParam(1, t->population);
- t->sign.UpdatePosition(pt.x, pt.y - 24,
+ this->sign.MarkDirty();
+ Point pt = RemapCoords2(TileX(this->xy) * TILE_SIZE, TileY(this->xy) * TILE_SIZE);
+ SetDParam(0, this->index);
+ SetDParam(1, this->population);
+ this->sign.UpdatePosition(pt.x, pt.y - 24,
_settings_client.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL);
- t->sign.MarkDirty();
+ this->sign.MarkDirty();
}
/** Update the virtual coords needed to draw the town sign for all towns. */
void UpdateAllTownVirtCoords()
{
Town *t;
+
FOR_ALL_TOWNS(t) {
- UpdateTownVirtCoord(t);
+ t->UpdateVirtCoord();
}
}
@@ -355,7 +355,7 @@ static void ChangePopulation(Town *t, int mod)
{
t->population += mod;
InvalidateWindow(WC_TOWN_VIEW, t->index);
- UpdateTownVirtCoord(t);
+ t->UpdateVirtCoord();
InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1);
}
@@ -1505,7 +1505,7 @@ static void DoCreateTown(Town *t, TileIndex tile, uint32 townnameparts, TownSize
}
t->townnameparts = townnameparts;
- UpdateTownVirtCoord(t);
+ t->UpdateVirtCoord();
InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 0);
t->InitializeLayout(layout);
@@ -2285,10 +2285,10 @@ CommandCost CmdRenameTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
free(t->name);
t->name = reset ? NULL : strdup(text);
- UpdateTownVirtCoord(t);
+ t->UpdateVirtCoord();
InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1);
- UpdateAllStationVirtCoord();
- UpdateAllWaypointSigns();
+ UpdateAllStationVirtCoords();
+ UpdateAllWaypointVirtCoords();
MarkWholeScreenDirty();
}
return CommandCost();
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index f1ba662a0..853ddbebd 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -20,12 +20,12 @@ INSTANTIATE_POOL_METHODS(Waypoint)
/**
* Update all signs
*/
-void UpdateAllWaypointSigns()
+void UpdateAllWaypointVirtCoords()
{
Waypoint *wp;
FOR_ALL_WAYPOINTS(wp) {
- UpdateWaypointSign(wp);
+ wp->UpdateVirtCoord();
}
}
diff --git a/src/waypoint.h b/src/waypoint.h
index 6094c20c5..40b5822e1 100644
--- a/src/waypoint.h
+++ b/src/waypoint.h
@@ -37,6 +37,8 @@ struct Waypoint : WaypointPool::PoolItem<&_waypoint_pool> {
Waypoint(TileIndex tile = INVALID_TILE) : xy(tile) { }
~Waypoint();
+
+ void UpdateVirtCoord();
};
#define FOR_ALL_WAYPOINTS_FROM(var, start) FOR_ALL_ITEMS_FROM(Waypoint, waypoint_index, var, start)
@@ -58,7 +60,6 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justre
Station *ComposeWaypointStation(TileIndex tile);
void ShowWaypointWindow(const Waypoint *wp);
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype);
-void UpdateAllWaypointSigns();
-void UpdateWaypointSign(Waypoint *wp);
+void UpdateAllWaypointVirtCoords();
#endif /* WAYPOINT_H */
diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp
index 986579c83..e2ad292ba 100644
--- a/src/waypoint_cmd.cpp
+++ b/src/waypoint_cmd.cpp
@@ -26,13 +26,13 @@
#include "table/strings.h"
/**
- * Update the sign for the waypoint
- * @param wp Waypoint to update sign */
-void UpdateWaypointSign(Waypoint *wp)
+ * Update the virtual coords needed to draw the waypoint sign.
+ */
+void Waypoint::UpdateVirtCoord()
{
- Point pt = RemapCoords2(TileX(wp->xy) * TILE_SIZE, TileY(wp->xy) * TILE_SIZE);
- SetDParam(0, wp->index);
- wp->sign.UpdatePosition(pt.x, pt.y - 0x20, STR_WAYPOINT_VIEWPORT);
+ Point pt = RemapCoords2(TileX(this->xy) * TILE_SIZE, TileY(this->xy) * TILE_SIZE);
+ SetDParam(0, this->index);
+ this->sign.UpdatePosition(pt.x, pt.y - 0x20, STR_WAYPOINT_VIEWPORT);
}
/**
@@ -211,7 +211,7 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1
if (wp->town_index == INVALID_TOWN) MakeDefaultWaypointName(wp);
- UpdateWaypointSign(wp);
+ wp->UpdateVirtCoord();
wp->sign.MarkDirty();
YapfNotifyTrackLayoutChange(tile, AxisToTrack(axis));
}
@@ -319,7 +319,7 @@ CommandCost CmdRenameWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
wp->name = strdup(text);
}
- UpdateWaypointSign(wp);
+ wp->UpdateVirtCoord();
MarkWholeScreenDirty();
}
return CommandCost();