(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

This commit is contained in:
yexo
2011-10-04 20:36:40 +00:00
parent a1c1d32405
commit 77e9a482be

View File

@@ -633,6 +633,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
/* Test the command. */ /* Test the command. */
_cleared_object_areas.Clear(); _cleared_object_areas.Clear();
SetTownRatingTestMode(true); SetTownRatingTestMode(true);
ClearStorageChanges(false);
res = proc(tile, flags, p1, p2, text); res = proc(tile, flags, p1, p2, text);
SetTownRatingTestMode(false); 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 /* Actually try and execute the command. If no cost-type is given
* use the construction one */ * use the construction one */
_cleared_object_areas.Clear(); _cleared_object_areas.Clear();
ClearStorageChanges(false);
CommandCost res2 = proc(tile, flags | DC_EXEC, p1, p2, text); CommandCost res2 = proc(tile, flags | DC_EXEC, p1, p2, text);
if (cmd_id == CMD_COMPANY_CTRL) { if (cmd_id == CMD_COMPANY_CTRL) {