1
0
Fork 0

(svn r16990) -Codechange: unify some (command) naming w.r.t. stations/waypoints.

release/1.0
rubidium 2009-07-29 22:32:20 +00:00
parent a52cd653d4
commit 37e6f6a003
6 changed files with 34 additions and 34 deletions

View File

@ -138,7 +138,7 @@
uint32 p1 = GetCurrentRailType() | (platform_length << 16) | (num_platforms << 8); uint32 p1 = GetCurrentRailType() | (platform_length << 16) | (num_platforms << 8);
if (direction == RAILTRACK_NW_SE) p1 |= (1 << 4); if (direction == RAILTRACK_NW_SE) p1 |= (1 << 4);
if (station_id != AIStation::STATION_JOIN_ADJACENT) p1 |= (1 << 24); if (station_id != AIStation::STATION_JOIN_ADJACENT) p1 |= (1 << 24);
return AIObject::DoCommand(tile, p1, (AIStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16, CMD_BUILD_RAILROAD_STATION); return AIObject::DoCommand(tile, p1, (AIStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16, CMD_BUILD_RAIL_STATION);
} }
/* static */ bool AIRail::BuildNewGRFRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id, CargoID cargo_id, IndustryType source_industry, IndustryType goal_industry, int distance, bool source_station) /* static */ bool AIRail::BuildNewGRFRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id, CargoID cargo_id, IndustryType source_industry, IndustryType goal_industry, int distance, bool source_station)
@ -167,7 +167,7 @@
} }
} }
return AIObject::DoCommand(tile, p1, p2, CMD_BUILD_RAILROAD_STATION); return AIObject::DoCommand(tile, p1, p2, CMD_BUILD_RAIL_STATION);
} }
/* static */ bool AIRail::BuildRailWaypoint(TileIndex tile) /* static */ bool AIRail::BuildRailWaypoint(TileIndex tile)
@ -177,7 +177,7 @@
EnforcePrecondition(false, GetRailTracks(tile) == RAILTRACK_NE_SW || GetRailTracks(tile) == RAILTRACK_NW_SE); EnforcePrecondition(false, GetRailTracks(tile) == RAILTRACK_NE_SW || GetRailTracks(tile) == RAILTRACK_NW_SE);
EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType())); EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
return AIObject::DoCommand(tile, 0, 0, CMD_BUILD_TRAIN_WAYPOINT); return AIObject::DoCommand(tile, 0, 0, CMD_BUILD_RAIL_WAYPOINT);
} }
/* static */ bool AIRail::RemoveRailWaypoint(TileIndex tile) /* static */ bool AIRail::RemoveRailWaypoint(TileIndex tile)
@ -185,7 +185,7 @@
EnforcePrecondition(false, ::IsValidTile(tile)); EnforcePrecondition(false, ::IsValidTile(tile));
EnforcePrecondition(false, IsRailWaypointTile(tile)); EnforcePrecondition(false, IsRailWaypointTile(tile));
return AIObject::DoCommand(tile, 0, 0, CMD_REMOVE_TRAIN_WAYPOINT); return AIObject::DoCommand(tile, 0, 0, CMD_REMOVE_FROM_RAIL_WAYPOINT);
} }
/* static */ bool AIRail::RemoveRailStationTileRect(TileIndex tile, TileIndex tile2) /* static */ bool AIRail::RemoveRailStationTileRect(TileIndex tile, TileIndex tile2)
@ -193,7 +193,7 @@
EnforcePrecondition(false, ::IsValidTile(tile)); EnforcePrecondition(false, ::IsValidTile(tile));
EnforcePrecondition(false, ::IsValidTile(tile2)); EnforcePrecondition(false, ::IsValidTile(tile2));
return AIObject::DoCommand(tile, tile2, 0, CMD_REMOVE_FROM_RAILROAD_STATION); return AIObject::DoCommand(tile, tile2, 0, CMD_REMOVE_FROM_RAIL_STATION);
} }
/* static */ uint AIRail::GetRailTracks(TileIndex tile) /* static */ uint AIRail::GetRailTracks(TileIndex tile)

View File

@ -45,8 +45,8 @@ DEF_COMMAND(CmdLandscapeClear);
DEF_COMMAND(CmdBuildBridge); DEF_COMMAND(CmdBuildBridge);
DEF_COMMAND(CmdBuildRailroadStation); DEF_COMMAND(CmdBuildRailStation);
DEF_COMMAND(CmdRemoveFromRailroadStation); DEF_COMMAND(CmdRemoveFromRailStation);
DEF_COMMAND(CmdConvertRail); DEF_COMMAND(CmdConvertRail);
DEF_COMMAND(CmdBuildSingleSignal); DEF_COMMAND(CmdBuildSingleSignal);
@ -60,9 +60,9 @@ DEF_COMMAND(CmdSellLandArea);
DEF_COMMAND(CmdBuildTunnel); DEF_COMMAND(CmdBuildTunnel);
DEF_COMMAND(CmdBuildTrainDepot); DEF_COMMAND(CmdBuildTrainDepot);
DEF_COMMAND(CmdBuildTrainWaypoint); DEF_COMMAND(CmdBuildRailWaypoint);
DEF_COMMAND(CmdRenameWaypoint); DEF_COMMAND(CmdRenameWaypoint);
DEF_COMMAND(CmdRemoveTrainWaypoint); DEF_COMMAND(CmdRemoveFromRailWaypoint);
DEF_COMMAND(CmdBuildRoadStop); DEF_COMMAND(CmdBuildRoadStop);
DEF_COMMAND(CmdRemoveRoadStop); DEF_COMMAND(CmdRemoveRoadStop);
@ -208,7 +208,7 @@ static const Command _command_proc_table[] = {
{CmdRemoveSingleRail, CMD_AUTO}, // CMD_REMOVE_SINGLE_RAIL {CmdRemoveSingleRail, CMD_AUTO}, // CMD_REMOVE_SINGLE_RAIL
{CmdLandscapeClear, 0}, // CMD_LANDSCAPE_CLEAR {CmdLandscapeClear, 0}, // CMD_LANDSCAPE_CLEAR
{CmdBuildBridge, CMD_AUTO}, // CMD_BUILD_BRIDGE {CmdBuildBridge, CMD_AUTO}, // CMD_BUILD_BRIDGE
{CmdBuildRailroadStation, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_RAILROAD_STATION {CmdBuildRailStation, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_RAIL_STATION
{CmdBuildTrainDepot, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_TRAIN_DEPOT {CmdBuildTrainDepot, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_TRAIN_DEPOT
{CmdBuildSingleSignal, CMD_AUTO}, // CMD_BUILD_SIGNALS {CmdBuildSingleSignal, CMD_AUTO}, // CMD_BUILD_SIGNALS
{CmdRemoveSingleSignal, CMD_AUTO}, // CMD_REMOVE_SIGNALS {CmdRemoveSingleSignal, CMD_AUTO}, // CMD_REMOVE_SIGNALS
@ -216,11 +216,11 @@ static const Command _command_proc_table[] = {
{CmdPurchaseLandArea, CMD_NO_WATER | CMD_AUTO}, // CMD_PURCHASE_LAND_AREA {CmdPurchaseLandArea, CMD_NO_WATER | CMD_AUTO}, // CMD_PURCHASE_LAND_AREA
{CmdSellLandArea, 0}, // CMD_SELL_LAND_AREA {CmdSellLandArea, 0}, // CMD_SELL_LAND_AREA
{CmdBuildTunnel, CMD_AUTO}, // CMD_BUILD_TUNNEL {CmdBuildTunnel, CMD_AUTO}, // CMD_BUILD_TUNNEL
{CmdRemoveFromRailroadStation, 0}, // CMD_REMOVE_FROM_RAILROAD_STATION {CmdRemoveFromRailStation, 0}, // CMD_REMOVE_FROM_RAIL_STATION
{CmdConvertRail, 0}, // CMD_CONVERT_RAILD {CmdConvertRail, 0}, // CMD_CONVERT_RAILD
{CmdBuildTrainWaypoint, 0}, // CMD_BUILD_TRAIN_WAYPOINT {CmdBuildRailWaypoint, 0}, // CMD_BUILD_RAIL_WAYPOINT
{CmdRenameWaypoint, 0}, // CMD_RENAME_WAYPOINT {CmdRenameWaypoint, 0}, // CMD_RENAME_WAYPOINT
{CmdRemoveTrainWaypoint, 0}, // CMD_REMOVE_TRAIN_WAYPOINT {CmdRemoveFromRailWaypoint, 0}, // CMD_REMOVE_FROM_RAIL_WAYPOINT
{CmdBuildRoadStop, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_ROAD_STOP {CmdBuildRoadStop, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_ROAD_STOP
{CmdRemoveRoadStop, 0}, // CMD_REMOVE_ROAD_STOP {CmdRemoveRoadStop, 0}, // CMD_REMOVE_ROAD_STOP

View File

@ -149,7 +149,7 @@ enum {
CMD_REMOVE_SINGLE_RAIL, ///< remove a single rail track CMD_REMOVE_SINGLE_RAIL, ///< remove a single rail track
CMD_LANDSCAPE_CLEAR, ///< demolish a tile CMD_LANDSCAPE_CLEAR, ///< demolish a tile
CMD_BUILD_BRIDGE, ///< build a bridge CMD_BUILD_BRIDGE, ///< build a bridge
CMD_BUILD_RAILROAD_STATION, ///< build a railroad station CMD_BUILD_RAIL_STATION, ///< build a rail station
CMD_BUILD_TRAIN_DEPOT, ///< build a train depot CMD_BUILD_TRAIN_DEPOT, ///< build a train depot
CMD_BUILD_SIGNALS, ///< build a signal CMD_BUILD_SIGNALS, ///< build a signal
CMD_REMOVE_SIGNALS, ///< remove a signal CMD_REMOVE_SIGNALS, ///< remove a signal
@ -158,12 +158,12 @@ enum {
CMD_SELL_LAND_AREA, ///< sell a bought tile before CMD_SELL_LAND_AREA, ///< sell a bought tile before
CMD_BUILD_TUNNEL, ///< build a tunnel CMD_BUILD_TUNNEL, ///< build a tunnel
CMD_REMOVE_FROM_RAILROAD_STATION, ///< remove a tile station CMD_REMOVE_FROM_RAIL_STATION, ///< remove a (rectangle of) tiles from a rail station
CMD_CONVERT_RAIL, ///< convert a rail type CMD_CONVERT_RAIL, ///< convert a rail type
CMD_BUILD_TRAIN_WAYPOINT, ///< build a waypoint CMD_BUILD_RAIL_WAYPOINT, ///< build a waypoint
CMD_RENAME_WAYPOINT, ///< rename a waypoint CMD_RENAME_WAYPOINT, ///< rename a waypoint
CMD_REMOVE_TRAIN_WAYPOINT, ///< remove a waypoint CMD_REMOVE_FROM_RAIL_WAYPOINT, ///< remove a (rectangle of) tiles from a rail waypoint
CMD_BUILD_ROAD_STOP, ///< build a road stop CMD_BUILD_ROAD_STOP, ///< build a road stop
CMD_REMOVE_ROAD_STOP, ///< remove a road stop CMD_REMOVE_ROAD_STOP, ///< remove a road stop

View File

@ -149,9 +149,9 @@ static void PlaceRail_Depot(TileIndex tile)
static void PlaceRail_Waypoint(TileIndex tile) static void PlaceRail_Waypoint(TileIndex tile)
{ {
if (_remove_button_clicked) { if (_remove_button_clicked) {
DoCommandP(tile, 0, 0, CMD_REMOVE_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_REMOVE_TRAIN_WAYPOINT), CcPlaySound1E); DoCommandP(tile, 0, 0, CMD_REMOVE_FROM_RAIL_WAYPOINT | CMD_MSG(STR_CANT_REMOVE_TRAIN_WAYPOINT), CcPlaySound1E);
} else { } else {
DoCommandP(tile, _cur_waypoint_type, 0, CMD_BUILD_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_BUILD_TRAIN_WAYPOINT), CcPlaySound1E); DoCommandP(tile, _cur_waypoint_type, 0, CMD_BUILD_RAIL_WAYPOINT | CMD_MSG(STR_CANT_BUILD_TRAIN_WAYPOINT), CcPlaySound1E);
} }
} }
@ -180,7 +180,7 @@ static void PlaceRail_Station(TileIndex tile)
int h = _settings_client.gui.station_platlength; int h = _settings_client.gui.station_platlength;
if (!_railstation.orientation) Swap(w, h); if (!_railstation.orientation) Swap(w, h);
CommandContainer cmdcont = { tile, p1, p2, CMD_BUILD_RAILROAD_STATION | CMD_MSG(STR_ERROR_CAN_T_BUILD_RAILROAD_STATION), CcStation, "" }; CommandContainer cmdcont = { tile, p1, p2, CMD_BUILD_RAIL_STATION | CMD_MSG(STR_ERROR_CAN_T_BUILD_RAILROAD_STATION), CcStation, "" };
ShowSelectStationIfNeeded(cmdcont, TileArea(tile, w, h)); ShowSelectStationIfNeeded(cmdcont, TileArea(tile, w, h));
} }
} }
@ -751,7 +751,7 @@ struct BuildRailToolbarWindow : Window {
case DDSP_REMOVE_STATION: case DDSP_REMOVE_STATION:
case DDSP_BUILD_STATION: case DDSP_BUILD_STATION:
if (_remove_button_clicked) { if (_remove_button_clicked) {
DoCommandP(end_tile, start_tile, 0, CMD_REMOVE_FROM_RAILROAD_STATION | CMD_MSG(STR_CANT_REMOVE_PART_OF_STATION), CcPlaySound1E); DoCommandP(end_tile, start_tile, 0, CMD_REMOVE_FROM_RAIL_STATION | CMD_MSG(STR_CANT_REMOVE_PART_OF_STATION), CcPlaySound1E);
break; break;
} }
HandleStationPlacement(start_tile, end_tile); HandleStationPlacement(start_tile, end_tile);
@ -882,7 +882,7 @@ static void HandleStationPlacement(TileIndex start, TileIndex end)
uint32 p1 = _cur_railtype | _railstation.orientation << 4 | numtracks << 8 | platlength << 16 | _ctrl_pressed << 24; uint32 p1 = _cur_railtype | _railstation.orientation << 4 | numtracks << 8 | platlength << 16 | _ctrl_pressed << 24;
uint32 p2 = _railstation.station_class | _railstation.station_type << 8 | INVALID_STATION << 16; uint32 p2 = _railstation.station_class | _railstation.station_type << 8 | INVALID_STATION << 16;
CommandContainer cmdcont = { ta.tile, p1, p2, CMD_BUILD_RAILROAD_STATION | CMD_MSG(STR_ERROR_CAN_T_BUILD_RAILROAD_STATION), CcStation, "" }; CommandContainer cmdcont = { ta.tile, p1, p2, CMD_BUILD_RAIL_STATION | CMD_MSG(STR_ERROR_CAN_T_BUILD_RAILROAD_STATION), CcStation, "" };
ShowSelectStationIfNeeded(cmdcont, ta); ShowSelectStationIfNeeded(cmdcont, ta);
} }

View File

@ -821,7 +821,7 @@ static void GetStationLayout(byte *layout, int numtracks, int plat_len, const St
} }
/** /**
* Build railroad station * Build rail station
* @param tile_org northern most position of station dragging/placement * @param tile_org northern most position of station dragging/placement
* @param flags operation to perform * @param flags operation to perform
* @param p1 various bitstuffed elements * @param p1 various bitstuffed elements
@ -835,7 +835,7 @@ static void GetStationLayout(byte *layout, int numtracks, int plat_len, const St
* - p2 = (bit 8-15) - custom station id * - p2 = (bit 8-15) - custom station id
* - p2 = (bit 16-31) - station ID to join (NEW_STATION if build new one) * - p2 = (bit 16-31) - station ID to join (NEW_STATION if build new one)
*/ */
CommandCost CmdBuildRailroadStation(TileIndex tile_org, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{ {
/* Unpack parameters */ /* Unpack parameters */
RailType rt = (RailType)GB(p1, 0, 4); RailType rt = (RailType)GB(p1, 0, 4);
@ -1223,7 +1223,7 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector<T *, 4> &affected
return CommandCost(EXPENSES_CONSTRUCTION, quantity * removal_cost); return CommandCost(EXPENSES_CONSTRUCTION, quantity * removal_cost);
} }
/** Remove a single tile from a railroad station. /** Remove a single tile from a rail station.
* This allows for custom-built station with holes and weird layouts * This allows for custom-built station with holes and weird layouts
* @param start tile of station piece to remove * @param start tile of station piece to remove
* @param flags operation to perform * @param flags operation to perform
@ -1232,7 +1232,7 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector<T *, 4> &affected
* @param text unused * @param text unused
* @return cost of operation or error * @return cost of operation or error
*/ */
CommandCost CmdRemoveFromRailroadStation(TileIndex start, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) CommandCost CmdRemoveFromRailStation(TileIndex start, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{ {
TileIndex end = p1 == 0 ? start : p1; TileIndex end = p1 == 0 ? start : p1;
if (start >= MapSize() || end >= MapSize()) return CMD_ERROR; if (start >= MapSize() || end >= MapSize()) return CMD_ERROR;
@ -1265,7 +1265,7 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex start, DoCommandFlag flags, u
* @param text unused * @param text unused
* @return cost of operation or error * @return cost of operation or error
*/ */
CommandCost CmdRemoveTrainWaypoint(TileIndex start, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) CommandCost CmdRemoveFromRailWaypoint(TileIndex start, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{ {
TileIndex end = p1 == 0 ? start : p1; TileIndex end = p1 == 0 ? start : p1;
if (start >= MapSize() || end >= MapSize()) return CMD_ERROR; if (start >= MapSize() || end >= MapSize()) return CMD_ERROR;
@ -1348,11 +1348,11 @@ CommandCost RemoveRailStation(T *st, DoCommandFlag flags)
* @param flags operation to perform * @param flags operation to perform
* @return cost or failure of operation * @return cost or failure of operation
*/ */
static CommandCost RemoveRailroadStation(TileIndex tile, DoCommandFlag flags) static CommandCost RemoveRailStation(TileIndex tile, DoCommandFlag flags)
{ {
/* if there is flooding and non-uniform stations are enabled, remove platforms tile by tile */ /* if there is flooding and non-uniform stations are enabled, remove platforms tile by tile */
if (_current_company == OWNER_WATER && _settings_game.station.nonuniform_stations) { if (_current_company == OWNER_WATER && _settings_game.station.nonuniform_stations) {
return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAILROAD_STATION); return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAIL_STATION);
} }
Station *st = Station::GetByTile(tile); Station *st = Station::GetByTile(tile);
@ -1369,11 +1369,11 @@ static CommandCost RemoveRailroadStation(TileIndex tile, DoCommandFlag flags)
* @param flags operation to perform * @param flags operation to perform
* @return cost or failure of operation * @return cost or failure of operation
*/ */
static CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags) static CommandCost RemoveRailWaypoint(TileIndex tile, DoCommandFlag flags)
{ {
/* if there is flooding and non-uniform stations are enabled, remove waypoints tile by tile */ /* if there is flooding and non-uniform stations are enabled, remove waypoints tile by tile */
if (_current_company == OWNER_WATER && _settings_game.station.nonuniform_stations) { if (_current_company == OWNER_WATER && _settings_game.station.nonuniform_stations) {
return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_TRAIN_WAYPOINT); return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAIL_WAYPOINT);
} }
return RemoveRailStation(Waypoint::GetByTile(tile), flags); return RemoveRailStation(Waypoint::GetByTile(tile), flags);
@ -3089,8 +3089,8 @@ static CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags)
} }
switch (GetStationType(tile)) { switch (GetStationType(tile)) {
case STATION_RAIL: return RemoveRailroadStation(tile, flags); case STATION_RAIL: return RemoveRailStation(tile, flags);
case STATION_WAYPOINT: return RemoveTrainWaypoint(tile, flags); case STATION_WAYPOINT: return RemoveRailWaypoint(tile, flags);
case STATION_AIRPORT: return RemoveAirport(tile, flags); case STATION_AIRPORT: return RemoveAirport(tile, flags);
case STATION_TRUCK: case STATION_TRUCK:
if (IsDriveThroughStopTile(tile) && !CanRemoveRoadWithStop(tile, flags)) if (IsDriveThroughStopTile(tile) && !CanRemoveRoadWithStop(tile, flags))

View File

@ -132,7 +132,7 @@ static Waypoint *FindDeletedWaypointCloseTo(TileIndex tile, StringID str)
* @todo When checking for the tile slope, * @todo When checking for the tile slope,
* distingush between "Flat land required" and "land sloped in wrong direction" * distingush between "Flat land required" and "land sloped in wrong direction"
*/ */
CommandCost CmdBuildTrainWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) CommandCost CmdBuildRailWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{ {
Axis axis; Axis axis;