src/command.cpp
changeset 8682 c41d89c0ca8f
parent 8635 3bbb6f87fced
child 8683 1f3141299c8e
--- a/src/command.cpp	Thu Jan 03 14:33:10 2008 +0000
+++ b/src/command.cpp	Thu Jan 03 23:50:58 2008 +0000
@@ -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 @@
 	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 @@
 
 	/* 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 @@
 		(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 @@
 
 	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;