summaryrefslogtreecommitdiff
path: root/src/command.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2008-01-03 23:50:58 +0000
committerglx <glx@openttd.org>2008-01-03 23:50:58 +0000
commite9a35fd75dcde4bc262386f11f41e425a12dac11 (patch)
tree026efa2300b2925d9151a9d24da6c7fc6329a271 /src/command.cpp
parent87a68bd80fa8f0c11ef4898e2c5ecbff8a60f7ad (diff)
downloadopenttd-e9a35fd75dcde4bc262386f11f41e425a12dac11.tar.xz
(svn r11749) -Fix (r11352): when a bankrupted company is bought, reset vehicle color mapping so the vehicles use the new owner color
Diffstat (limited to 'src/command.cpp')
-rw-r--r--src/command.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/command.cpp b/src/command.cpp
index fcbeefa18..5cdac4432 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -17,6 +17,7 @@
#include "strings_func.h"
#include "gfx_func.h"
#include "functions.h"
+#include "town.h"
const char *_cmd_text = NULL;
@@ -388,7 +389,7 @@ byte GetCommandFlags(uint cmd)
return _command_proc_table[cmd & 0xFF].flags;
}
-static int _docommand_recursive;
+static int _docommand_recursive = 0;
/*!
* This function executes a given command with the parameters from the #CommandProc parameter list.
@@ -420,7 +421,9 @@ CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint32
/* only execute the test call if it's toplevel, or we're not execing. */
if (_docommand_recursive == 1 || !(flags & DC_EXEC) || (flags & DC_FORCETEST) ) {
+ SetTownRatingTestMode(true);
res = proc(tile, flags & ~DC_EXEC, p1, p2);
+ SetTownRatingTestMode(false);
if (CmdFailed(res)) {
res.SetGlobalErrorMessage();
goto error;
@@ -554,7 +557,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
(cmd & 0xFF) == CMD_REMOVE_ROAD ||
(cmd & 0xFF) == CMD_REMOVE_LONG_ROAD ||
(cmd & 0xFF) == CMD_CLONE_VEHICLE;
-
+ notest = false;
_docommand_recursive = 1;
/* cost estimation only? */
@@ -581,7 +584,9 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
if (!((cmd & CMD_NO_TEST_IF_IN_NETWORK) && _networking)) {
/* first test if the command can be executed. */
+ SetTownRatingTestMode(true);
res = proc(tile, flags, p1, p2);
+ SetTownRatingTestMode(false);
if (CmdFailed(res)) {
res.SetGlobalErrorMessage();
goto show_error;