summaryrefslogtreecommitdiff
path: root/src/command.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-10-04 20:36:40 +0000
committeryexo <yexo@openttd.org>2011-10-04 20:36:40 +0000
commit655cee276c7bdd2aafe37369896b9350fc769bd4 (patch)
tree3fc2940c97ec421e979ffed39b7ba5205d819b1b /src/command.cpp
parent534bff1d19a84fed56b2d527f9dc9495bf7ddc51 (diff)
downloadopenttd-655cee276c7bdd2aafe37369896b9350fc769bd4.tar.xz
(svn r22996) -Fix: make sure temporary storage is cleared before test and exec runs for DoCommands so NewGRF callbacks can't change the result between the runs
Diffstat (limited to 'src/command.cpp')
-rw-r--r--src/command.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/command.cpp b/src/command.cpp
index e5357f140..75c625518 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -633,6 +633,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
/* Test the command. */
_cleared_object_areas.Clear();
SetTownRatingTestMode(true);
+ ClearStorageChanges(false);
res = proc(tile, flags, p1, p2, text);
SetTownRatingTestMode(false);
@@ -672,6 +673,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
/* Actually try and execute the command. If no cost-type is given
* use the construction one */
_cleared_object_areas.Clear();
+ ClearStorageChanges(false);
CommandCost res2 = proc(tile, flags | DC_EXEC, p1, p2, text);
if (cmd_id == CMD_COMPANY_CTRL) {