diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-11-02 21:34:39 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-12-16 22:28:32 +0100 |
commit | 4f3ea3907e23428461c626b6c861d834b358bc9f (patch) | |
tree | f60f17d713ed155a738adb469eed7f4262ffbe3c /src/train_cmd.cpp | |
parent | ccefa76a4686581b8d1a9bd13d7d754807a9f8d1 (diff) | |
download | openttd-4f3ea3907e23428461c626b6c861d834b358bc9f.tar.xz |
Codechange: Un-bitstuff commands taking a ClientID (i.e. CMD_CLIENT_ID).
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r-- | src/train_cmd.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index a86e835bd..d2517d65b 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -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); } |