Codechange: Un-bitstuff commands taking a ClientID (i.e. CMD_CLIENT_ID).

This commit is contained in:
Michael Lutz
2021-11-02 21:34:39 +01:00
parent ccefa76a46
commit 4f3ea3907e
29 changed files with 196 additions and 136 deletions

View File

@@ -718,11 +718,11 @@ static void AddRearEngineToMultiheadedTrain(Train *v)
* @param flags type of operation.
* @param tile tile of the depot where rail-vehicle is built.
* @param e the engine to build.
* @param data bit 0 prevents any free cars from being added to the train.
* @param free_cars add any free cars to the train.
* @param[out] ret the vehicle that has been built.
* @return the cost of this operation or an error.
*/
CommandCost CmdBuildRailVehicle(DoCommandFlag flags, TileIndex tile, const Engine *e, uint16 data, Vehicle **ret)
CommandCost CmdBuildRailVehicle(DoCommandFlag flags, TileIndex tile, const Engine *e, bool free_cars, Vehicle **ret)
{
const RailVehicleInfo *rvi = &e->u.rail;
@@ -789,7 +789,7 @@ CommandCost CmdBuildRailVehicle(DoCommandFlag flags, TileIndex tile, const Engin
v->ConsistChanged(CCF_ARRANGE);
UpdateTrainGroupID(v);
if (!HasBit(data, 0) && !(flags & DC_AUTOREPLACE)) { // check if the cars should be added to the new vehicle
if (free_cars && !(flags & DC_AUTOREPLACE)) { // check if the cars should be added to the new vehicle
NormalizeTrainVehInDepot(v);
}
@@ -1357,18 +1357,16 @@ CommandCost CmdMoveRailVehicle(DoCommandFlag flags, TileIndex tile, uint32 p1, u
* Sell a (single) train wagon/engine.
* @param flags type of operation
* @param t the train wagon to sell
* @param data the selling mode
* - data = 0: only sell the single dragged wagon/engine (and any belonging rear-engines)
* - data = 1: sell the vehicle and all vehicles following it in the chain
* if the wagon is dragged, don't delete the possibly belonging rear-engine to some front
* @param sell_chain the selling mode
* - sell_chain = false: only sell the single dragged wagon/engine (and any belonging rear-engines)
* - sell_chain = true: sell the vehicle and all vehicles following it in the chain
* if the wagon is dragged, don't delete the possibly belonging rear-engine to some front
* @param backup_order make order backup?
* @param user the user for the order backup.
* @return the cost of this operation or an error
*/
CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *t, uint16 data, uint32 user)
CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *t, bool sell_chain, bool backup_order, ClientID user)
{
/* Sell a chain of vehicles or not? */
bool sell_chain = HasBit(data, 0);
Train *v = Train::From(t)->GetFirstEnginePart();
Train *first = v->First();
@@ -1418,7 +1416,7 @@ CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *t, uint16 data, uint3
/* Copy other important data from the front engine */
new_head->CopyVehicleConfigAndStatistics(first);
GroupStatistics::CountVehicle(new_head, 1); // after copying over the profit
} else if (v->IsPrimaryVehicle() && data & (MAKE_ORDER_BACKUP_FLAG >> 20)) {
} else if (v->IsPrimaryVehicle() && backup_order) {
OrderBackup::Backup(v, user);
}