@@ -66,7 +66,7 @@ CommandProc CmdSellLandArea;
|
||||
CommandProc CmdBuildTunnel;
|
||||
|
||||
CommandProc CmdBuildTrainDepot;
|
||||
CommandProc CmdBuildRailWaypoint;
|
||||
CommandProcEx CmdBuildRailWaypoint;
|
||||
CommandProc CmdRenameWaypoint;
|
||||
CommandProc CmdRemoveFromRailWaypoint;
|
||||
|
||||
|
@@ -50,8 +50,8 @@
|
||||
static RailType _cur_railtype; ///< Rail type of the current build-rail toolbar.
|
||||
static bool _remove_button_clicked; ///< Flag whether 'remove' toggle-button is currently enabled
|
||||
static DiagDirection _build_depot_direction; ///< Currently selected depot direction
|
||||
static byte _waypoint_count = 1; ///< Number of waypoint types
|
||||
static byte _cur_waypoint_type; ///< Currently selected waypoint type
|
||||
static uint _waypoint_count = 1; ///< Number of waypoint types
|
||||
static uint _cur_waypoint_type; ///< Currently selected waypoint type
|
||||
static bool _convert_signal_button; ///< convert signal button in the signal GUI pressed
|
||||
static bool _trace_restrict_button; ///< trace restrict button in the signal GUI pressed
|
||||
static bool _program_signal_button; ///< program signal button in the signal GUI pressed
|
||||
@@ -844,9 +844,11 @@ struct BuildRailToolbarWindow : Window {
|
||||
} else {
|
||||
TileArea ta(start_tile, end_tile);
|
||||
uint32 p1 = _cur_railtype | (select_method == VPM_X_LIMITED ? AXIS_X : AXIS_Y) << 6 | ta.w << 8 | ta.h << 16 | _ctrl_pressed << 24;
|
||||
uint32 p2 = STAT_CLASS_WAYP | _cur_waypoint_type << 8 | INVALID_STATION << 16;
|
||||
uint32 p2 = STAT_CLASS_WAYP | INVALID_STATION << 16;
|
||||
uint64 p3 = _cur_waypoint_type;
|
||||
|
||||
CommandContainer cmdcont = NewCommandContainerBasic(ta.tile, p1, p2, CMD_BUILD_RAIL_WAYPOINT | CMD_MSG(STR_ERROR_CAN_T_BUILD_TRAIN_WAYPOINT), CcPlaySound_CONSTRUCTION_RAIL);
|
||||
cmdcont.p3 = p3;
|
||||
ShowSelectWaypointIfNeeded(cmdcont, ta);
|
||||
}
|
||||
}
|
||||
@@ -2291,7 +2293,7 @@ struct BuildRailWaypointWindow : PickerWindowBase {
|
||||
{
|
||||
switch (GB(widget, 0, 16)) {
|
||||
case WID_BRW_WAYPOINT: {
|
||||
byte type = GB(widget, 16, 16);
|
||||
uint type = GB(widget, 16, 16);
|
||||
const StationSpec *statspec = StationClass::Get(STAT_CLASS_WAYP)->GetSpec(type);
|
||||
DrawWaypointSprite(r.left + 1 + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), type, _cur_railtype);
|
||||
|
||||
@@ -2306,7 +2308,7 @@ struct BuildRailWaypointWindow : PickerWindowBase {
|
||||
{
|
||||
switch (GB(widget, 0, 16)) {
|
||||
case WID_BRW_WAYPOINT: {
|
||||
byte type = GB(widget, 16, 16);
|
||||
uint type = GB(widget, 16, 16);
|
||||
this->GetWidget<NWidgetMatrix>(WID_BRW_WAYPOINT_MATRIX)->SetClicked(_cur_waypoint_type);
|
||||
|
||||
/* Check station availability callback */
|
||||
|
@@ -213,7 +213,7 @@
|
||||
EnforcePrecondition(false, GetRailTracks(tile) == RAILTRACK_NE_SW || GetRailTracks(tile) == RAILTRACK_NW_SE);
|
||||
EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
|
||||
|
||||
return ScriptObject::DoCommand(tile, GetCurrentRailType() | (GetRailTracks(tile) == RAILTRACK_NE_SW ? AXIS_X : AXIS_Y) << 6 | 1 << 8 | 1 << 16, STAT_CLASS_WAYP | INVALID_STATION << 16, CMD_BUILD_RAIL_WAYPOINT);
|
||||
return ScriptObject::DoCommandEx(tile, GetCurrentRailType() | (GetRailTracks(tile) == RAILTRACK_NE_SW ? AXIS_X : AXIS_Y) << 6 | 1 << 8 | 1 << 16, STAT_CLASS_WAYP | INVALID_STATION << 16, 0, CMD_BUILD_RAIL_WAYPOINT);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptRail::RemoveRailWaypointTileRectangle(TileIndex tile, TileIndex tile2, bool keep_rail)
|
||||
|
@@ -171,10 +171,13 @@ extern CommandCost IsRailStationBridgeAboveOk(TileIndex tile, const StationSpec
|
||||
* @param p2 various bitstuffed elements
|
||||
* - p2 = (bit 0- 7) - custom station class
|
||||
* - p2 = (bit 8-15) - custom station id
|
||||
* - p2 = (bit 31-16) - station ID to join
|
||||
* @param p3 various bitstuffed elements
|
||||
* - p3 = (bit 0-31) - custom station id
|
||||
* @param text unused
|
||||
* @return the cost of this operation or an error
|
||||
*/
|
||||
CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, uint64 p3, const char *text, uint32 binary_length)
|
||||
{
|
||||
/* Unpack parameters */
|
||||
Axis axis = Extract<Axis, 6, 1>(p1);
|
||||
@@ -183,9 +186,10 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint
|
||||
bool adjacent = HasBit(p1, 24);
|
||||
|
||||
StationClassID spec_class = Extract<StationClassID, 0, 8>(p2);
|
||||
byte spec_index = GB(p2, 8, 8);
|
||||
StationID station_to_join = GB(p2, 16, 16);
|
||||
|
||||
uint spec_index = GB(p3, 0, 32);
|
||||
|
||||
/* Check if the given station class is valid */
|
||||
if (spec_class != STAT_CLASS_WAYP) return CMD_ERROR;
|
||||
if (spec_index >= StationClass::Get(spec_class)->GetSpecCount()) return CMD_ERROR;
|
||||
|
Reference in New Issue
Block a user