Build and refit vehicle test no longer needs to match exec command.

pull/16/head
Jonathan G Rennison 7 years ago
parent 4550ac39b9
commit fba4268127

@ -1352,6 +1352,9 @@ struct BuildVehicleWindow : Window {
char text_buffer[2];
text_buffer[0] = 'R';
text_buffer[1] = this->cargo_filter[this->cargo_filter_criteria];
if ((cmd & 0xFFFF) == CMD_BUILD_VEHICLE) {
cmd = (cmd & ~0xFFFF) | CMD_BUILD_VEHICLE_NT;
}
DoCommandP(this->window_number, sel_eng, 0, cmd, callback, text_buffer, true, 2);
} else {
/* build only */

@ -285,6 +285,7 @@ static const Command _command_proc_table[] = {
DEF_CMD(CmdPlantTree, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_PLANT_TREE
DEF_CMD(CmdBuildVehicle, CMD_CLIENT_ID, CMDT_VEHICLE_CONSTRUCTION ), // CMD_BUILD_VEHICLE
DEF_CMD(CmdBuildVehicle, CMD_NO_TEST | CMD_CLIENT_ID, CMDT_VEHICLE_CONSTRUCTION ), // CMD_BUILD_VEHICLE_NT
DEF_CMD(CmdSellVehicle, CMD_CLIENT_ID, CMDT_VEHICLE_CONSTRUCTION ), // CMD_SELL_VEHICLE
DEF_CMD(CmdRefitVehicle, 0, CMDT_VEHICLE_CONSTRUCTION ), // CMD_REFIT_VEHICLE
DEF_CMD(CmdSendVehicleToDepot, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_SEND_VEHICLE_TO_DEPOT

@ -229,6 +229,7 @@ enum Commands {
CMD_PLANT_TREE, ///< plant a tree
CMD_BUILD_VEHICLE, ///< build a vehicle
CMD_BUILD_VEHICLE_NT, ///< build a vehicle (no test)
CMD_SELL_VEHICLE, ///< sell a vehicle
CMD_REFIT_VEHICLE, ///< refit the cargo space of a vehicle
CMD_SEND_VEHICLE_TO_DEPOT, ///< send a vehicle to a depot

@ -177,6 +177,14 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
}
}
}
/* Since we can't estimate the cost of build and refitting a vehicle accurately we must
* check whether the company has enough money manually. */
if (!CheckCompanyHasMoney(value)) {
if (flags & DC_EXEC) {
/* The vehicle has already been bought, so now it must be sold again. */
DoCommand(tile, v->index, 0, flags, GetCmdSellVeh(type));
}
}
}
return value;

Loading…
Cancel
Save