summaryrefslogtreecommitdiff
path: root/ai
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2005-12-09 19:29:11 +0000
committertruelight <truelight@openttd.org>2005-12-09 19:29:11 +0000
commitb6ca90e021bb4df150694e56e10acc40f0e1fb05 (patch)
treeb1edcfb3f8a1a2b130082f5b7cfa0cd4e2c8cf5f /ai
parentc872ac4eb4adf6bf4920f5a1db1756d8224bf412 (diff)
downloadopenttd-b6ca90e021bb4df150694e56e10acc40f0e1fb05.tar.xz
(svn r3279) -Fix: do not try to execute something that is not set to execute
-Fix: do not increase an uid number if it isn't returned
Diffstat (limited to 'ai')
-rw-r--r--ai/ai.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ai/ai.c b/ai/ai.c
index 27da82337..6d78f006e 100644
--- a/ai/ai.c
+++ b/ai/ai.c
@@ -134,12 +134,16 @@ int32 AI_DoCommand(uint tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
int32 AI_DoCommandChecked(uint tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
{
AICommand *new;
- uint unique_id = uids[_current_player]++;
+ uint unique_id = uids[_current_player];
int32 res;
res = DoCommandByTile(tile, p1, p2, flags & ~DC_EXEC, procc);
if (CmdFailed(res))
return CMD_ERROR;
+ if (!(flags & DC_EXEC))
+ return res;
+
+ uids[_current_player]++;
/* Save the command and his things, together with the unique_id */
new = malloc(sizeof(AICommand));