Merge remote-tracking branch 'upstream/master' into 13.0
This commit is contained in:
+21
-20
@@ -26,11 +26,15 @@
|
||||
#include "vehiclelist.h"
|
||||
#include "order_backup.h"
|
||||
#include "zoom_func.h"
|
||||
#include "hotkeys.h"
|
||||
#include "depot_cmd.h"
|
||||
#include "train_cmd.h"
|
||||
#include "vehicle_cmd.h"
|
||||
|
||||
#include "widgets/depot_widget.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "hotkeys.h"
|
||||
#include "citymania/cm_hotkeys.hpp"
|
||||
|
||||
#include "safeguards.h"
|
||||
@@ -85,17 +89,15 @@ extern void DepotSortList(VehicleList *list);
|
||||
|
||||
/**
|
||||
* This is the Callback method after the cloning attempt of a vehicle
|
||||
* @param result the result of the cloning command
|
||||
* @param tile unused
|
||||
* @param p1 unused
|
||||
* @param p2 unused
|
||||
* @param cmd unused
|
||||
* @param result the result of the cloning command
|
||||
* @param veh_id cloned vehicle ID
|
||||
*/
|
||||
void CcCloneVehicle(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
|
||||
void CcCloneVehicle(Commands cmd, const CommandCost &result, VehicleID veh_id)
|
||||
{
|
||||
if (result.Failed()) return;
|
||||
|
||||
const Vehicle *v = Vehicle::Get(_new_vehicle_id);
|
||||
const Vehicle *v = Vehicle::Get(veh_id);
|
||||
|
||||
ShowVehicleViewWindow(v);
|
||||
|
||||
@@ -118,7 +120,7 @@ static void TrainDepotMoveVehicle(const Vehicle *wagon, VehicleID sel, const Veh
|
||||
|
||||
if (wagon == v) return;
|
||||
|
||||
DoCommandP(v->tile, v->index | (citymania::_fn_mod ? 1 : 0) << 20, wagon == nullptr ? INVALID_VEHICLE : wagon->index, CMD_MOVE_RAIL_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_MOVE_VEHICLE));
|
||||
Command<CMD_MOVE_RAIL_VEHICLE>::Post(STR_ERROR_CAN_T_MOVE_VEHICLE, v->tile, v->index, wagon == nullptr ? INVALID_VEHICLE : wagon->index, citymania::_fn_mod);
|
||||
}
|
||||
|
||||
static VehicleCellSize _base_block_sizes_depot[VEH_COMPANY_END]; ///< Cell size for vehicle images in the depot view.
|
||||
@@ -779,7 +781,7 @@ struct DepotWindow : Window {
|
||||
case WID_D_STOP_ALL:
|
||||
case WID_D_START_ALL: {
|
||||
VehicleListIdentifier vli(VL_DEPOT_LIST, this->type, this->owner);
|
||||
DoCommandP(this->window_number, (widget == WID_D_START_ALL ? (1 << 0) : 0), vli.Pack(), CMD_MASS_START_STOP);
|
||||
Command<CMD_MASS_START_STOP>::Post(this->window_number, widget == WID_D_START_ALL, false, vli);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -802,7 +804,7 @@ struct DepotWindow : Window {
|
||||
break;
|
||||
|
||||
case WID_D_AUTOREPLACE:
|
||||
DoCommandP(this->window_number, this->type, 0, CMD_DEPOT_MASS_AUTOREPLACE);
|
||||
Command<CMD_DEPOT_MASS_AUTOREPLACE>::Post(this->window_number, this->type);
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -813,7 +815,7 @@ struct DepotWindow : Window {
|
||||
if (str == nullptr) return;
|
||||
|
||||
/* Do depot renaming */
|
||||
DoCommandP(0, this->GetDepotIndex(), 0, CMD_RENAME_DEPOT | CMD_MSG(STR_ERROR_CAN_T_RENAME_DEPOT), nullptr, str);
|
||||
Command<CMD_RENAME_DEPOT>::Post(STR_ERROR_CAN_T_RENAME_DEPOT, this->GetDepotIndex(), str);
|
||||
}
|
||||
|
||||
bool OnRightClick(Point pt, int widget) override
|
||||
@@ -887,10 +889,10 @@ struct DepotWindow : Window {
|
||||
|
||||
if (citymania::_fn_mod) {
|
||||
/* Share-clone, do not open new viewport, and keep tool active */
|
||||
DoCommandP(this->window_number, v->index, 1, CMD_CLONE_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_BUY_TRAIN + v->type), nullptr);
|
||||
Command<CMD_CLONE_VEHICLE>::Post(STR_ERROR_CAN_T_BUY_TRAIN + v->type, this->window_number, v->index, true);
|
||||
} else {
|
||||
/* Copy-clone, open viewport for new vehicle, and deselect the tool (assume player wants to changs things on new vehicle) */
|
||||
if (DoCommandP(this->window_number, v->index, 0, CMD_CLONE_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_BUY_TRAIN + v->type), CcCloneVehicle)) {
|
||||
/* Copy-clone, open viewport for new vehicle, and deselect the tool (assume player wants to change things on new vehicle) */
|
||||
if (Command<CMD_CLONE_VEHICLE>::Post(STR_ERROR_CAN_T_BUY_TRAIN + v->type, CcCloneVehicle, this->window_number, v->index, false)) {
|
||||
ResetObjectToPlace();
|
||||
}
|
||||
}
|
||||
@@ -984,8 +986,7 @@ struct DepotWindow : Window {
|
||||
|
||||
if (this->GetVehicleFromDepotWndPt(pt.x - nwi->pos_x, pt.y - nwi->pos_y, &v, &gdvp) == MODE_DRAG_VEHICLE && sel != INVALID_VEHICLE) {
|
||||
if (gdvp.wagon != nullptr && gdvp.wagon->index == sel && citymania::_fn_mod) {
|
||||
DoCommandP(Vehicle::Get(sel)->tile, Vehicle::Get(sel)->index, true,
|
||||
CMD_REVERSE_TRAIN_DIRECTION | CMD_MSG(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE));
|
||||
Command<CMD_REVERSE_TRAIN_DIRECTION>::Post(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE, Vehicle::Get(sel)->tile, Vehicle::Get(sel)->index, true);
|
||||
} else if (gdvp.wagon == nullptr || gdvp.wagon->index != sel) {
|
||||
this->vehicle_over = INVALID_VEHICLE;
|
||||
TrainDepotMoveVehicle(gdvp.wagon, sel, gdvp.head);
|
||||
@@ -1009,8 +1010,8 @@ struct DepotWindow : Window {
|
||||
this->sel = INVALID_VEHICLE;
|
||||
this->SetDirty();
|
||||
|
||||
int sell_cmd = (v->type == VEH_TRAIN && (widget == WID_D_SELL_CHAIN || citymania::_fn_mod)) ? 1 : 0;
|
||||
DoCommandP(v->tile, v->index | sell_cmd << 20 | MAKE_ORDER_BACKUP_FLAG, 0, GetCmdSellVeh(v->type));
|
||||
bool sell_cmd = (v->type == VEH_TRAIN && (widget == WID_D_SELL_CHAIN || citymania::_fn_mod));
|
||||
Command<CMD_SELL_VEHICLE>::Post(GetCmdSellVehMsg(v->type), v->tile, v->index, sell_cmd, true, INVALID_CLIENT_ID);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1089,8 +1090,8 @@ static void DepotSellAllConfirmationCallback(Window *win, bool confirmed)
|
||||
if (confirmed) {
|
||||
DepotWindow *w = (DepotWindow*)win;
|
||||
TileIndex tile = w->window_number;
|
||||
byte vehtype = w->type;
|
||||
DoCommandP(tile, vehtype, 0, CMD_DEPOT_SELL_ALL_VEHICLES);
|
||||
VehicleType vehtype = w->type;
|
||||
Command<CMD_DEPOT_SELL_ALL_VEHICLES>::Post(tile, vehtype);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user