summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-16 20:15:28 +0000
committerrubidium <rubidium@openttd.org>2009-07-16 20:15:28 +0000
commitdea1144bcb52b6c5f2c985395b2775cedcbff5ce (patch)
tree3cebb6aa3ae76df53289dc9feae68b253ea6a101
parent1f29e38b8372484d51d852b89fc957eb53635ecb (diff)
downloadopenttd-dea1144bcb52b6c5f2c985395b2775cedcbff5ce.tar.xz
(svn r16850) -Codechange: unify some naming of variables between waypoints and stations.
-rw-r--r--src/saveload/afterload.cpp6
-rw-r--r--src/saveload/waypoint_sl.cpp10
-rw-r--r--src/viewport.cpp2
-rw-r--r--src/waypoint.cpp2
-rw-r--r--src/waypoint.h4
-rw-r--r--src/waypoint_cmd.cpp6
6 files changed, 15 insertions, 15 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 3d5af563c..9d1537a7d 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -447,8 +447,8 @@ bool AfterLoadGame()
Waypoint *wp;
FOR_ALL_WAYPOINTS(wp) {
- wp->name = CopyFromOldName(wp->string);
- wp->string = STR_EMPTY;
+ wp->name = CopyFromOldName(wp->string_id);
+ wp->string_id = STR_NULL;
}
}
@@ -1005,7 +1005,7 @@ bool AfterLoadGame()
Waypoint *wp;
FOR_ALL_WAYPOINTS(wp) {
- if (wp->deleted == 0) {
+ if (wp->delete_ctr == 0) {
const StationSpec *statspec = NULL;
if (HasBit(_m[wp->xy].m3, 4))
diff --git a/src/saveload/waypoint_sl.cpp b/src/saveload/waypoint_sl.cpp
index 48c1c92f1..46a2ddb2a 100644
--- a/src/saveload/waypoint_sl.cpp
+++ b/src/saveload/waypoint_sl.cpp
@@ -45,9 +45,9 @@ void FixOldWaypoints()
FOR_ALL_WAYPOINTS(wp) {
wp->town_index = ClosestTownFromTile(wp->xy, UINT_MAX)->index;
wp->town_cn = 0;
- if (wp->string & 0xC000) {
- wp->town_cn = wp->string & 0x3F;
- wp->string = STR_NULL;
+ if (wp->string_id & 0xC000) {
+ wp->town_cn = wp->string_id & 0x3F;
+ wp->string_id = STR_NULL;
}
}
}
@@ -58,9 +58,9 @@ static const SaveLoad _waypoint_desc[] = {
SLE_CONDVAR(Waypoint, town_index, SLE_UINT16, 12, SL_MAX_VERSION),
SLE_CONDVAR(Waypoint, town_cn, SLE_FILE_U8 | SLE_VAR_U16, 12, 88),
SLE_CONDVAR(Waypoint, town_cn, SLE_UINT16, 89, SL_MAX_VERSION),
- SLE_CONDVAR(Waypoint, string, SLE_STRINGID, 0, 83),
+ SLE_CONDVAR(Waypoint, string_id, SLE_STRINGID, 0, 83),
SLE_CONDSTR(Waypoint, name, SLE_STR, 0, 84, SL_MAX_VERSION),
- SLE_VAR(Waypoint, deleted, SLE_UINT8),
+ SLE_VAR(Waypoint, delete_ctr, SLE_UINT8),
SLE_CONDVAR(Waypoint, build_date, SLE_FILE_U16 | SLE_VAR_I32, 3, 30),
SLE_CONDVAR(Waypoint, build_date, SLE_INT32, 31, SL_MAX_VERSION),
diff --git a/src/viewport.cpp b/src/viewport.cpp
index e881edf64..ceb2d6be0 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -1218,7 +1218,7 @@ static void ViewportAddSigns(DrawPixelInfo *dpi)
static void AddWaypoint(const Waypoint *wp, StringID str, uint16 width)
{
- AddStringToDraw(wp->sign.left + 1, wp->sign.top + 1, str, wp->index, 0, (wp->deleted ? 0xE : _company_colours[wp->owner]), width);
+ AddStringToDraw(wp->sign.left + 1, wp->sign.top + 1, str, wp->index, 0, (wp->delete_ctr != 0 ? 0xE : _company_colours[wp->owner]), width);
}
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index 853ddbebd..d970bb14c 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -38,7 +38,7 @@ void WaypointsDailyLoop()
/* Check if we need to delete a waypoint */
FOR_ALL_WAYPOINTS(wp) {
- if (wp->deleted != 0 && --wp->deleted == 0) delete wp;
+ if (wp->delete_ctr != 0 && --wp->delete_ctr == 0) delete wp;
}
}
diff --git a/src/waypoint.h b/src/waypoint.h
index 40b5822e1..59b2d1830 100644
--- a/src/waypoint.h
+++ b/src/waypoint.h
@@ -22,7 +22,7 @@ struct Waypoint : WaypointPool::PoolItem<&_waypoint_pool> {
TownID town_index; ///< Town associated with the waypoint
uint16 town_cn; ///< The Nth waypoint for this town (consecutive number)
- StringID string; ///< C000-C03F have special meaning in old games
+ StringID string_id;///< C000-C03F have special meaning in old games
char *name; ///< Custom name. If not set, town + town_cn is used for naming
ViewportSign sign; ///< Dimensions of sign (not saved)
@@ -33,7 +33,7 @@ struct Waypoint : WaypointPool::PoolItem<&_waypoint_pool> {
uint32 grfid; ///< ID of GRF file
byte localidx; ///< Index of station within GRF file
- byte deleted; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted.
+ byte delete_ctr; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted.
Waypoint(TileIndex tile = INVALID_TILE) : xy(tile) { }
~Waypoint();
diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp
index ded31903c..493953020 100644
--- a/src/waypoint_cmd.cpp
+++ b/src/waypoint_cmd.cpp
@@ -104,7 +104,7 @@ static Waypoint *FindDeletedWaypointCloseTo(TileIndex tile)
uint thres = 8;
FOR_ALL_WAYPOINTS(wp) {
- if (wp->deleted && wp->owner == _current_company) {
+ if (wp->delete_ctr != 0 && wp->owner == _current_company) {
uint cur_dist = DistanceManhattan(tile, wp->xy);
if (cur_dist < thres) {
@@ -205,7 +205,7 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1
wp->localidx = 0;
}
- wp->deleted = 0;
+ wp->delete_ctr = 0;
wp->build_date = _date;
if (wp->town_index == INVALID_TOWN) MakeDefaultWaypointName(wp);
@@ -239,7 +239,7 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justre
Track track = GetRailWaypointTrack(tile);
wp = GetWaypointByTile(tile);
- wp->deleted = 30; // let it live for this many days before we do the actual deletion.
+ wp->delete_ctr = 30; // let it live for this many days before we do the actual deletion.
wp->sign.MarkDirty();
Train *v = NULL;