diff options
author | rubidium <rubidium@openttd.org> | 2009-07-17 20:51:24 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-07-17 20:51:24 +0000 |
commit | d8f16ea1994ecebdb153c58350b3a044a6d43e57 (patch) | |
tree | 1af8506b6b3e5656b1ccbd30d75f04571c191306 /src | |
parent | c9cab7ba1967a42b90b44bca865db33c66a20c72 (diff) | |
download | openttd-d8f16ea1994ecebdb153c58350b3a044a6d43e57.tar.xz |
(svn r16863) -Codechange: GetWaypointByTile -> Waypoint::GetByTile, like used for e.g. stations
Diffstat (limited to 'src')
-rw-r--r-- | src/order_gui.cpp | 2 | ||||
-rw-r--r-- | src/rail_cmd.cpp | 6 | ||||
-rw-r--r-- | src/waypoint.cpp | 2 | ||||
-rw-r--r-- | src/waypoint.h | 22 | ||||
-rw-r--r-- | src/waypoint_cmd.cpp | 2 |
5 files changed, 16 insertions, 18 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 96bb000a8..4548fbbc1 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -352,7 +352,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) if (IsRailWaypointTile(tile) && v->type == VEH_TRAIN && IsTileOwner(tile, _local_company)) { - order.MakeGoToWaypoint(GetWaypointByTile(tile)->index); + order.MakeGoToWaypoint(Waypoint::GetByTile(tile)->index); if (_settings_client.gui.new_nonstop != _ctrl_pressed) order.SetNonStopType(ONSF_NO_STOP_AT_ANY_STATION); return order; } diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index a67b553b1..c2fe324b9 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -1938,7 +1938,7 @@ static void DrawTile_Track(TileInfo *ti) } } else { /* look for customization */ - const Waypoint *wp = GetWaypointByTile(ti->tile); + const Waypoint *wp = Waypoint::GetByTile(ti->tile); if (wp->num_specs != 0) { const StationSpec *statspec = wp->speclist->spec; @@ -2315,8 +2315,8 @@ static TrackStatus GetTileTrackStatus_Track(TileIndex tile, TransportType mode, static bool ClickTile_Track(TileIndex tile) { switch (GetRailTileType(tile)) { - case RAIL_TILE_DEPOT: ShowDepotWindow(tile, VEH_TRAIN); return true; - case RAIL_TILE_WAYPOINT: ShowWaypointWindow(GetWaypointByTile(tile)); return true; + case RAIL_TILE_DEPOT: ShowDepotWindow(tile, VEH_TRAIN); return true; + case RAIL_TILE_WAYPOINT: ShowWaypointWindow(Waypoint::GetByTile(tile)); return true; default: return false; } } diff --git a/src/waypoint.cpp b/src/waypoint.cpp index 791822eda..04b71056e 100644 --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -49,7 +49,7 @@ void WaypointsDailyLoop() */ Station *ComposeWaypointStation(TileIndex tile) { - Waypoint *wp = GetWaypointByTile(tile); + Waypoint *wp = Waypoint::GetByTile(tile); /* instead of 'static Station stat' use byte array to avoid Station's destructor call upon exit. As * a side effect, the station is not constructed now. */ diff --git a/src/waypoint.h b/src/waypoint.h index 7e540ecc2..f8f733ad8 100644 --- a/src/waypoint.h +++ b/src/waypoint.h @@ -39,23 +39,21 @@ struct Waypoint : WaypointPool::PoolItem<&_waypoint_pool> { void UpdateVirtCoord(); void AssignStationSpec(uint index); + + /** + * Fetch a waypoint by tile + * @param tile Tile of waypoint + * @return Waypoint + */ + static FORCEINLINE Waypoint *GetByTile(TileIndex tile) + { + return Waypoint::Get(GetWaypointIndex(tile)); + } }; #define FOR_ALL_WAYPOINTS_FROM(var, start) FOR_ALL_ITEMS_FROM(Waypoint, waypoint_index, var, start) #define FOR_ALL_WAYPOINTS(var) FOR_ALL_WAYPOINTS_FROM(var, 0) - -/** - * Fetch a waypoint by tile - * @param tile Tile of waypoint - * @return Waypoint - */ -static inline Waypoint *GetWaypointByTile(TileIndex tile) -{ - assert(IsRailWaypointTile(tile)); - return Waypoint::Get(GetWaypointIndex(tile)); -} - CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove); Station *ComposeWaypointStation(TileIndex tile); void ShowWaypointWindow(const Waypoint *wp); diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index 1e8094162..2f10c7dea 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -224,7 +224,7 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justre if (flags & DC_EXEC) { Track track = GetRailWaypointTrack(tile); - wp = GetWaypointByTile(tile); + wp = Waypoint::GetByTile(tile); wp->delete_ctr = 30; // let it live for this many days before we do the actual deletion. wp->sign.MarkDirty(); |