Fix template train move/sell command category for build while paused
This commit is contained in:
@@ -1259,7 +1259,7 @@ struct BuildVehicleWindowBase : Window {
|
||||
} else {
|
||||
VehicleID target = (*(this->virtual_train_out))->GetLastUnit()->index;
|
||||
|
||||
DoCommandP(0, (1 << 23) | (1 << 21) | toadd->index, target, CMD_MOVE_RAIL_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_MOVE_VEHICLE), CcMoveNewVirtualEngine);
|
||||
DoCommandP(0, (1 << 23) | (1 << 21) | toadd->index, target, CMD_MOVE_VIRTUAL_RAIL_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_MOVE_VEHICLE), CcMoveNewVirtualEngine);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -215,6 +215,8 @@ CommandProc CmdVirtualTrainFromTrain;
|
||||
CommandProc CmdDeleteVirtualTrain;
|
||||
CommandProc CmdBuildVirtualRailVehicle;
|
||||
CommandProc CmdReplaceTemplateVehicle;
|
||||
CommandProc CmdMoveVirtualRailVehicle;
|
||||
CommandProc CmdSellVirtualVehicle;
|
||||
|
||||
CommandProc CmdTemplateVehicleFromTrain;
|
||||
CommandProc CmdDeleteTemplateVehicle;
|
||||
@@ -457,6 +459,8 @@ static const Command _command_proc_table[] = {
|
||||
DEF_CMD(CmdDeleteVirtualTrain, CMD_ALL_TILES, CMDT_VEHICLE_MANAGEMENT), // CMD_DELETE_VIRTUAL_TRAIN
|
||||
DEF_CMD(CmdBuildVirtualRailVehicle, CMD_CLIENT_ID | CMD_NO_TEST | CMD_ALL_TILES, CMDT_VEHICLE_MANAGEMENT), // CMD_BUILD_VIRTUAL_RAIL_VEHICLE
|
||||
DEF_CMD(CmdReplaceTemplateVehicle, CMD_ALL_TILES, CMDT_VEHICLE_MANAGEMENT), // CMD_REPLACE_TEMPLATE_VEHICLE
|
||||
DEF_CMD(CmdMoveVirtualRailVehicle, CMD_ALL_TILES, CMDT_VEHICLE_MANAGEMENT), // CMD_MOVE_VIRTUAL_RAIL_VEHICLE
|
||||
DEF_CMD(CmdSellVirtualVehicle, CMD_CLIENT_ID | CMD_ALL_TILES, CMDT_VEHICLE_MANAGEMENT), // CMD_SELL_VIRTUAL_VEHICLE
|
||||
|
||||
DEF_CMD(CmdTemplateVehicleFromTrain, CMD_ALL_TILES, CMDT_VEHICLE_MANAGEMENT ), // CMD_CLONE_TEMPLATE_VEHICLE_FROM_TRAIN
|
||||
DEF_CMD(CmdDeleteTemplateVehicle, CMD_ALL_TILES, CMDT_VEHICLE_MANAGEMENT ), // CMD_DELETE_TEMPLATE_VEHICLE
|
||||
|
@@ -391,6 +391,8 @@ enum Commands {
|
||||
CMD_DELETE_VIRTUAL_TRAIN, ///< Delete a virtual train
|
||||
CMD_BUILD_VIRTUAL_RAIL_VEHICLE, ///< Build a virtual train
|
||||
CMD_REPLACE_TEMPLATE_VEHICLE, ///< Replace a template vehicle with another one based on a virtual train
|
||||
CMD_MOVE_VIRTUAL_RAIL_VEHICLE, ///< Move a virtual rail vehicle
|
||||
CMD_SELL_VIRTUAL_VEHICLE, ///< Sell a virtual vehicle
|
||||
|
||||
CMD_CLONE_TEMPLATE_VEHICLE_FROM_TRAIN, ///< clone a train and create a new template vehicle based on it
|
||||
CMD_DELETE_TEMPLATE_VEHICLE, ///< delete a template vehicle
|
||||
|
@@ -122,7 +122,7 @@ static void TrainDepotMoveVehicle(const Vehicle *wagon, VehicleID sel, const Veh
|
||||
if (wagon == v) return;
|
||||
|
||||
DoCommandP(v->tile, v->index | ((_ctrl_pressed ? 1 : 0) << 20) | (1 << 21) , wagon == nullptr ? INVALID_VEHICLE : wagon->index,
|
||||
CMD_MOVE_RAIL_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_MOVE_VEHICLE), CcVirtualTrainWagonsMoved);
|
||||
CMD_MOVE_VIRTUAL_RAIL_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_MOVE_VEHICLE), CcVirtualTrainWagonsMoved);
|
||||
}
|
||||
|
||||
class TemplateCreateWindow : public Window {
|
||||
@@ -432,7 +432,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
DoCommandP(0, this->sel | (sell_cmd << 20) | (1 << 21), 0, GetCmdSellVeh(VEH_TRAIN), CcDeleteVirtualTrain);
|
||||
DoCommandP(0, this->sel | (sell_cmd << 20) | (1 << 21), 0, CMD_SELL_VIRTUAL_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_SELL_TRAIN), CcDeleteVirtualTrain);
|
||||
|
||||
this->sel = INVALID_VEHICLE;
|
||||
|
||||
|
@@ -2001,6 +2001,14 @@ static void NormaliseTrainHead(Train *head)
|
||||
head->unitnumber = GetFreeUnitNumber(VEH_TRAIN);
|
||||
}
|
||||
|
||||
CommandCost CmdMoveVirtualRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
{
|
||||
Train *src = Train::GetIfValid(GB(p1, 0, 20));
|
||||
if (src == nullptr || !src->IsVirtual()) return CMD_ERROR;
|
||||
|
||||
return CmdMoveRailVehicle(tile, flags, p1, p2, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a rail vehicle around inside the depot.
|
||||
* @param tile unused
|
||||
|
@@ -258,6 +258,14 @@ CommandCost CmdSellVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
return ret;
|
||||
}
|
||||
|
||||
CommandCost CmdSellVirtualVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
{
|
||||
Train *v = Train::GetIfValid(GB(p1, 0, 20));
|
||||
if (v == nullptr || !v->IsVirtual()) return CMD_ERROR;
|
||||
|
||||
return CmdSellVehicle(tile, flags, p1, p2, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to run the refit cost callback.
|
||||
* @param v The vehicle we are refitting, can be nullptr.
|
||||
|
Reference in New Issue
Block a user