summaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2005-12-14 14:38:23 +0000
committertruelight <truelight@openttd.org>2005-12-14 14:38:23 +0000
commit607e518ab80aa3a8a29c4e7d94a93a1817615ee5 (patch)
tree420c194e7afe2b4d6cbebea5a313de08654890f8 /command.c
parentc5adf63d774c4588eb543bd038735985c161f9c6 (diff)
downloadopenttd-607e518ab80aa3a8a29c4e7d94a93a1817615ee5.tar.xz
(svn r3304) -Add: allow AI-events to see the UID of the command
-Fix: improved the logic of the UID code for AIs
Diffstat (limited to 'command.c')
-rw-r--r--command.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/command.c b/command.c
index 981677f35..572799873 100644
--- a/command.c
+++ b/command.c
@@ -403,6 +403,8 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
int x = TileX(tile) * 16;
int y = TileY(tile) * 16;
+ AI_GetCommandUID(cmd, p1, p2, tile);
+
/* Do not even think about executing out-of-bounds tile-commands */
if (tile > MapSize()) {
_cmd_text = NULL;
@@ -477,12 +479,12 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
if (res & 0xFFFF) _error_message = res & 0xFFFF;
/* Trigger an event special for the AI, so it knows the build has failed
* Because the commands are always delayed, this is the only way. */
- AI_CommandResult(cmd, p1, p2, tile, false);
+ AI_CommandResult(false);
goto show_error;
}
// no money? Only check if notest is off
if (!notest && res != 0 && !CheckPlayerHasMoney(res)) {
- AI_CommandResult(cmd, p1, p2, tile, false);
+ AI_CommandResult(false);
goto show_error;
}
}
@@ -519,12 +521,12 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
} else {
if (CmdFailed(res2)) {
if (res2 & 0xFFFF) _error_message = res2 & 0xFFFF;
- AI_CommandResult(cmd, p1, p2, tile, false);
+ AI_CommandResult(false);
goto show_error;
}
}
- AI_CommandResult(cmd, p1, p2, tile, true);
+ AI_CommandResult(true);
SubtractMoneyFromPlayer(res2);