Changeset - r12419:6524c12a7c0b
[Not reviewed]
master
0 5 0
rubidium - 15 years ago 2009-07-17 20:51:24
rubidium@openttd.org
(svn r16863) -Codechange: GetWaypointByTile -> Waypoint::GetByTile, like used for e.g. stations
5 files changed with 16 insertions and 18 deletions:
0 comments (0 inline, 0 general)
src/order_gui.cpp
Show inline comments
 
@@ -352,7 +352,7 @@ static Order GetOrderCmdFromTile(const V
 
	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;
 
	}
src/rail_cmd.cpp
Show inline comments
 
@@ -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_Tr
 
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;
 
	}
 
}
src/waypoint.cpp
Show inline comments
 
@@ -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. */
src/waypoint.h
Show inline comments
 
@@ -39,23 +39,21 @@ struct Waypoint : WaypointPool::PoolItem
 
	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);
src/waypoint_cmd.cpp
Show inline comments
 
@@ -224,7 +224,7 @@ CommandCost RemoveTrainWaypoint(TileInde
 

	
 
	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();
0 comments (0 inline, 0 general)