summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-22 08:52:41 +0000
committerrubidium <rubidium@openttd.org>2009-07-22 08:52:41 +0000
commit2646a99d29535a44c5998f080131cbca2e85bdcf (patch)
treef0cc43c544b806d042c7a7989b2634da7c76ca00 /src
parent8405d7d7e762546e3e78d1e0c16bb226c36266fa (diff)
downloadopenttd-2646a99d29535a44c5998f080131cbca2e85bdcf.tar.xz
(svn r16908) -Codechange: s/DepotWaypointReservation/DepotReservation/
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_station.cpp2
-rw-r--r--src/pbs.cpp12
-rw-r--r--src/rail_cmd.cpp4
-rw-r--r--src/rail_map.h26
-rw-r--r--src/saveload/afterload.cpp4
-rw-r--r--src/train_cmd.cpp14
-rw-r--r--src/vehicle.cpp2
-rw-r--r--src/waypoint_cmd.cpp6
8 files changed, 34 insertions, 36 deletions
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 3cd21e985..032e2f5e3 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -452,7 +452,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
case 0x43: return st->owner; // Station owner
case 0x44:
if (IsRailWaypointTile(tile)) {
- return HasDepotWaypointReservation(tile) ? 7 : 4;
+ return HasDepotReservation(tile) ? 7 : 4;
} else {
return HasStationReservation(tile) ? 7 : 4; // PBS status
}
diff --git a/src/pbs.cpp b/src/pbs.cpp
index b74cfa419..1309d01ee 100644
--- a/src/pbs.cpp
+++ b/src/pbs.cpp
@@ -17,7 +17,7 @@ TrackBits GetReservedTrackbits(TileIndex t)
{
switch (GetTileType(t)) {
case MP_RAILWAY:
- if (IsRailWaypoint(t) || IsRailDepot(t)) return GetWaypointReservationTrackBits(t);
+ if (IsRailDepot(t)) return GetDepotReservationTrackBits(t);
if (IsPlainRail(t)) return GetRailReservationTrackBits(t);
break;
@@ -80,9 +80,9 @@ bool TryReserveRailTrack(TileIndex tile, Track t)
switch (GetTileType(tile)) {
case MP_RAILWAY:
if (IsPlainRail(tile)) return TryReserveTrack(tile, t);
- if (IsRailWaypoint(tile) || IsRailDepot(tile)) {
- if (!HasDepotWaypointReservation(tile)) {
- SetDepotWaypointReservation(tile, true);
+ if (IsRailDepot(tile)) {
+ if (!HasDepotReservation(tile)) {
+ SetDepotReservation(tile, true);
MarkTileDirtyByTile(tile); // some GRFs change their appearance when tile is reserved
return true;
}
@@ -134,8 +134,8 @@ bool TryReserveRailTrack(TileIndex tile, Track t)
switch (GetTileType(tile)) {
case MP_RAILWAY:
- if (IsRailWaypoint(tile) || IsRailDepot(tile)) {
- SetDepotWaypointReservation(tile, false);
+ if (IsRailDepot(tile)) {
+ SetDepotReservation(tile, false);
MarkTileDirtyByTile(tile);
break;
}
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 6a58f2827..d3bb22ba1 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -1439,7 +1439,7 @@ static CommandCost RemoveTrainDepot(TileIndex tile, DoCommandFlag flags)
Owner owner = GetTileOwner(tile);
Train *v = NULL;
- if (HasDepotWaypointReservation(tile)) {
+ if (HasDepotReservation(tile)) {
v = GetTrainForReservation(tile, DiagDirToDiagTrack(dir));
if (v != NULL) FreeTrainTrackReservation(v);
}
@@ -1983,7 +1983,7 @@ default_waypoint:
DrawGroundSprite(image, GroundSpritePaletteTransform(image, pal, _drawtile_track_palette));
/* PBS debugging, draw reserved tracks darker */
- if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && HasDepotWaypointReservation(ti->tile) &&
+ if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && HasDepotReservation(ti->tile) &&
(!IsRailDepot(ti->tile) || GetRailDepotDirection(ti->tile) == DIAGDIR_SW || GetRailDepotDirection(ti->tile) == DIAGDIR_SE)) {
DrawGroundSprite(GetWaypointAxis(ti->tile) == AXIS_X ? rti->base_sprites.single_y : rti->base_sprites.single_x, PALETTE_CRASH);
}
diff --git a/src/rail_map.h b/src/rail_map.h
index 8fe1bf2ba..1fd3212e6 100644
--- a/src/rail_map.h
+++ b/src/rail_map.h
@@ -312,28 +312,26 @@ static inline void UnreserveTrack(TileIndex tile, Track t)
}
/**
- * Get the reservation state of the waypoint or depot
- * @note Works for both waypoints and rail depots
- * @pre IsRailWaypoint(t) || IsRailDepot(t)
- * @param t the waypoint/depot tile
+ * Get the reservation state of the depot
+ * @pre IsRailDepot(t)
+ * @param t the depot tile
* @return reservation state
*/
-static inline bool HasDepotWaypointReservation(TileIndex t)
+static inline bool HasDepotReservation(TileIndex t)
{
- assert(IsRailWaypoint(t) || IsRailDepot(t));
+ assert(IsRailDepot(t));
return HasBit(_m[t].m5, 4);
}
/**
- * Set the reservation state of the waypoint or depot
- * @note Works for both waypoints and rail depots
- * @pre IsRailWaypoint(t) || IsRailDepot(t)
- * @param t the waypoint/depot tile
+ * Set the reservation state of the depot
+ * @pre IsRailDepot(t)
+ * @param t the depot tile
* @param b the reservation state
*/
-static inline void SetDepotWaypointReservation(TileIndex t, bool b)
+static inline void SetDepotReservation(TileIndex t, bool b)
{
- assert(IsRailWaypoint(t) || IsRailDepot(t));
+ assert(IsRailDepot(t));
SB(_m[t].m5, 4, 1, (byte)b);
}
@@ -345,7 +343,7 @@ static inline void SetDepotWaypointReservation(TileIndex t, bool b)
*/
static inline TrackBits GetWaypointReservationTrackBits(TileIndex t)
{
- return HasDepotWaypointReservation(t) ? GetRailWaypointBits(t) : TRACK_BIT_NONE;
+ return HasDepotReservation(t) ? GetRailWaypointBits(t) : TRACK_BIT_NONE;
}
/**
@@ -356,7 +354,7 @@ static inline TrackBits GetWaypointReservationTrackBits(TileIndex t)
*/
static inline TrackBits GetDepotReservationTrackBits(TileIndex t)
{
- return HasDepotWaypointReservation(t) ? TrackToTrackBits(GetRailDepotTrack(t)) : TRACK_BIT_NONE;
+ return HasDepotReservation(t) ? TrackToTrackBits(GetRailDepotTrack(t)) : TRACK_BIT_NONE;
}
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 35337866d..452dbb997 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -1668,8 +1668,8 @@ bool AfterLoadGame()
}
/* Clear PBS reservation on track */
- if (IsRailDepot(t) ||IsRailWaypoint(t)) {
- SetDepotWaypointReservation(t, false);
+ if (IsRailDepot(t)) {
+ SetDepotReservation(t, false);
} else {
SetTrackReservation(t, TRACK_BIT_NONE);
}
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index fb3f3c268..5dfc29626 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2459,7 +2459,7 @@ static bool CheckTrainStayInDepot(Train *v)
v->load_unload_time_rem = 0;
seg_state = _settings_game.pf.reserve_paths ? SIGSEG_PBS : UpdateSignalsOnSegment(v->tile, INVALID_DIAGDIR, v->owner);
- if (seg_state == SIGSEG_FULL || HasDepotWaypointReservation(v->tile)) {
+ if (seg_state == SIGSEG_FULL || HasDepotReservation(v->tile)) {
/* Full and no PBS signal in block or depot reserved, can't exit. */
InvalidateWindowClasses(WC_TRAINS_LIST);
return true;
@@ -2471,8 +2471,8 @@ static bool CheckTrainStayInDepot(Train *v)
/* We are leaving a depot, but have to go to the exact same one; re-enter */
if (v->current_order.IsType(OT_GOTO_DEPOT) && v->tile == v->dest_tile) {
/* We need to have a reservation for this to work. */
- if (HasDepotWaypointReservation(v->tile)) return true;
- SetDepotWaypointReservation(v->tile, true);
+ if (HasDepotReservation(v->tile)) return true;
+ SetDepotReservation(v->tile, true);
VehicleEnterDepot(v);
return true;
}
@@ -2485,7 +2485,7 @@ static bool CheckTrainStayInDepot(Train *v)
return true;
}
- SetDepotWaypointReservation(v->tile, true);
+ SetDepotReservation(v->tile, true);
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(v->tile);
VehicleServiceInDepot(v);
@@ -3137,7 +3137,7 @@ bool TryPathReserve(Train *v, bool mark_as_stuck, bool first_tile_okay)
* at the depot tile itself but starts from the next tile. If we are still
* inside the depot, a depot reservation can never be ours. */
if (v->track == TRACK_BIT_DEPOT) {
- if (HasDepotWaypointReservation(v->tile)) {
+ if (HasDepotReservation(v->tile)) {
if (mark_as_stuck) MarkTrainAsStuck(v);
return false;
} else {
@@ -3181,7 +3181,7 @@ bool TryPathReserve(Train *v, bool mark_as_stuck, bool first_tile_okay)
/* If we are in a depot, tentativly reserve the depot. */
if (v->track == TRACK_BIT_DEPOT) {
- SetDepotWaypointReservation(v->tile, true);
+ SetDepotReservation(v->tile, true);
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(v->tile);
}
@@ -3196,7 +3196,7 @@ bool TryPathReserve(Train *v, bool mark_as_stuck, bool first_tile_okay)
if (!res_made) {
/* Free the depot reservation as well. */
- if (v->track == TRACK_BIT_DEPOT) SetDepotWaypointReservation(v->tile, false);
+ if (v->track == TRACK_BIT_DEPOT) SetDepotReservation(v->tile, false);
return false;
}
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 3562a2b58..a5d67ccdc 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -952,7 +952,7 @@ void VehicleEnterDepot(Vehicle *v)
Train *t = Train::From(v);
InvalidateWindowClasses(WC_TRAINS_LIST);
/* Clear path reservation */
- SetDepotWaypointReservation(t->tile, false);
+ SetDepotReservation(t->tile, false);
if (_settings_client.gui.show_track_reservation) MarkTileDirtyByTile(t->tile);
if (!t->IsFrontEngine()) t = t->First();
diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp
index 1f82f17f0..8f2804a35 100644
--- a/src/waypoint_cmd.cpp
+++ b/src/waypoint_cmd.cpp
@@ -187,7 +187,7 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1
bool reserved = HasBit(GetRailReservationTrackBits(tile), AxisToTrack(axis));
MakeRailWaypoint(tile, owner, axis, GetRailType(tile), wp->index);
- SetDepotWaypointReservation(tile, reserved);
+ SetDepotReservation(tile, reserved);
MarkTileDirtyByTile(tile);
AllocateSpecToStation(GetCustomStationSpec(STAT_CLASS_WAYP, p1), wp, true);
@@ -234,12 +234,12 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justre
Train *v = NULL;
if (justremove) {
TrackBits tracks = GetRailWaypointBits(tile);
- bool reserved = HasDepotWaypointReservation(tile);
+ bool reserved = HasDepotReservation(tile);
MakeRailNormal(tile, wp->owner, tracks, GetRailType(tile));
if (reserved) SetTrackReservation(tile, tracks);
MarkTileDirtyByTile(tile);
} else {
- if (HasDepotWaypointReservation(tile)) {
+ if (HasDepotReservation(tile)) {
v = GetTrainForReservation(tile, track);
if (v != NULL) FreeTrainTrackReservation(v);
}