summaryrefslogtreecommitdiff
path: root/src/autoreplace_cmd.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-07-09 20:55:47 +0000
committersmatz <smatz@openttd.org>2008-07-09 20:55:47 +0000
commit447ec39f49e89689dc9070fe88c8eafc39a60fbe (patch)
treed7f550bb34964fafacec7f8c559f7e43aa32e91e /src/autoreplace_cmd.cpp
parent33150af3e2ca85326e5b84999ae8729ec65b338c (diff)
downloadopenttd-447ec39f49e89689dc9070fe88c8eafc39a60fbe.tar.xz
(svn r13691) -Codechange: make it easier to determine whether a command is ran in the context of autoreplace or not
Diffstat (limited to 'src/autoreplace_cmd.cpp')
-rw-r--r--src/autoreplace_cmd.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index 59cb0ac75..c2a3eaaea 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -128,7 +128,7 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type)
* @param new_engine_type The EngineID to replace to
* @return value is cost of the replacement or CMD_ERROR
*/
-static CommandCost ReplaceVehicle(Vehicle **w, byte flags, Money total_cost, const Player *p, EngineID new_engine_type)
+static CommandCost ReplaceVehicle(Vehicle **w, uint32 flags, Money total_cost, const Player *p, EngineID new_engine_type)
{
CommandCost cost;
CommandCost sell_value;
@@ -151,7 +151,7 @@ static CommandCost ReplaceVehicle(Vehicle **w, byte flags, Money total_cost, con
* We take it back if building fails or when we really sell the old engine */
SubtractMoneyFromPlayer(sell_value);
- cost = DoCommand(old_v->tile, new_engine_type, 3, flags, GetCmdBuildVeh(old_v));
+ cost = DoCommand(old_v->tile, new_engine_type, 0, flags | DC_AUTOREPLACE, GetCmdBuildVeh(old_v));
if (CmdFailed(cost)) {
/* Take back the money we just gave the player */
sell_value.MultiplyCost(-1);
@@ -259,7 +259,7 @@ static CommandCost ReplaceVehicle(Vehicle **w, byte flags, Money total_cost, con
if (next_veh != NULL) {
/* Verify that the wagons can be placed on the engine in question.
* This is done by building an engine, test if the wagons can be added and then sell the test engine. */
- DoCommand(old_v->tile, new_engine_type, 3, DC_EXEC, GetCmdBuildVeh(old_v));
+ DoCommand(old_v->tile, new_engine_type, 0, DC_EXEC | DC_AUTOREPLACE, GetCmdBuildVeh(old_v));
Vehicle *temp = GetVehicle(_new_vehicle_id);
tmp_move = DoCommand(0, (temp->index << 16) | next_veh->index, 1, 0, CMD_MOVE_RAIL_VEHICLE);
DoCommand(0, temp->index, 0, DC_EXEC, GetCmdSellVeh(old_v));