(svn r4911) -Fix (FS#156): The Ai no longer attempts to build signals under bridges.
authorcelestar
Fri, 19 May 2006 12:08:01 +0000
changeset 3871 1f6cc7c6ea3b
parent 3870 d9ebc4ea750a
child 3872 a407dc67b041
(svn r4911) -Fix (FS#156): The Ai no longer attempts to build signals under bridges.
NOTE 1: Remove/revert this for the bridge branch
NOTE 2: Bug displays fundamental flaw in command system:
If two commands, where command 2 depends on command 1, have
to be checked, all those checks need to be manual.
(like in this example, first build rail then build signal.
BuildSignal cannot be checked without DC_EXEC as the rail
isn't there yet)
ai/default/default.c
--- a/ai/default/default.c	Fri May 19 10:04:03 2006 +0000
+++ b/ai/default/default.c	Fri May 19 12:08:01 2006 +0000
@@ -1587,8 +1587,9 @@
 
 			/* signals too? */
 			if (j & 3) {
-				// Can't build signals on a road.
-				if (IsTileType(c, MP_STREET)) return CMD_ERROR;
+				/* XXX - we need to check manually whether we can build a signal if DC_EXEC is
+				   not set because the rail has not actually been built */
+				if (!IsTileType(c, MP_RAILWAY)) return CMD_ERROR;
 
 				if (flag & DC_EXEC) {
 					j = 4 - j;