summaryrefslogtreecommitdiff
path: root/ai.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2005-01-24 20:20:30 +0000
committertruelight <truelight@openttd.org>2005-01-24 20:20:30 +0000
commit7a5ce1cb343184a7409d483451e4241a47ce9a89 (patch)
treecd8b3595eefd36f393ef9c35a7d8d58864183c10 /ai.c
parent7f14b6902266e78e48adba806d9ac22fc42410c6 (diff)
downloadopenttd-7a5ce1cb343184a7409d483451e4241a47ce9a89.tar.xz
(svn r1642) -Fix: solve AI related order-problem
Diffstat (limited to 'ai.c')
-rw-r--r--ai.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/ai.c b/ai.c
index 0b8259bed..74164a0e8 100644
--- a/ai.c
+++ b/ai.c
@@ -267,14 +267,11 @@ static void AiHandleGotoDepot(Player *p, int cmd)
static void AiRestoreVehicleOrders(Vehicle *v, BackuppedOrders *bak)
{
- const Order *os = bak->order;
- int ind = 0;
+ int i;
- while (os++->type != OT_NOTHING) {
- if (DoCommandByTile(0, v->index + (ind << 16), PackOrder(os), DC_EXEC, CMD_INSERT_ORDER) == CMD_ERROR)
+ for (i = 0; bak->order[i].type != OT_NOTHING; i++)
+ if (!DoCommandP(0, v->index + (i << 16), PackOrder(&bak->order[i]), NULL, CMD_INSERT_ORDER | CMD_NO_TEST_IF_IN_NETWORK))
break;
- ind++;
- }
}
static void AiHandleReplaceTrain(Player *p)