summaryrefslogtreecommitdiff
path: root/ai/trolly/trolly.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-06-04 09:10:24 +0000
committertron <tron@openttd.org>2006-06-04 09:10:24 +0000
commit877c7e34a52874eab1eb7e2a0ed15a007390d1df (patch)
tree7169789e49a59433f674337c2c7505ad5938e746 /ai/trolly/trolly.c
parent7dff47b7f09d0b9dfbaeaf2445d54075e83e5ed9 (diff)
downloadopenttd-877c7e34a52874eab1eb7e2a0ed15a007390d1df.tar.xz
(svn r5092) -Fix: There was a gross race condition in the AI code which made it pretty random if the AI could give a new vehicle its orders
Diffstat (limited to 'ai/trolly/trolly.c')
-rw-r--r--ai/trolly/trolly.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/ai/trolly/trolly.c b/ai/trolly/trolly.c
index 52cf573e3..b003c21df 100644
--- a/ai/trolly/trolly.c
+++ b/ai/trolly/trolly.c
@@ -1155,7 +1155,7 @@ static void AiNew_State_BuildVehicle(Player *p)
// Decrease the total counter
p->ainew.amount_veh--;
// Go give some orders!
- p->ainew.state = AI_STATE_GIVE_ORDERS;
+ p->ainew.state = AI_STATE_WAIT_FOR_BUILD;
}
@@ -1167,18 +1167,6 @@ static void AiNew_State_GiveOrders(Player *p)
assert(p->ainew.state == AI_STATE_GIVE_ORDERS);
- // Get the new ID
- /* XXX -- Because this AI isn't using any event-system, this is VERY dangerous!
- * There is no way telling if the vehicle is already bought (or delayed by the
- * network), and if bought, if not an other vehicle is bought in between.. in
- * other words, there is absolutely no way knowing if this id is the true
- * id.. soon this will all change, but for now, we needed something to test
- * on ;) -- TrueLight -- 21-11-2005 */
- if (p->ainew.tbt == AI_TRAIN) {
- } else {
- p->ainew.veh_id = _new_roadveh_id;
- }
-
if (p->ainew.veh_main_id != INVALID_VEHICLE) {
AI_DoCommand(0, p->ainew.veh_id + (p->ainew.veh_main_id << 16), 0, DC_EXEC, CMD_CLONE_ORDER);
@@ -1323,6 +1311,7 @@ static AiNew_StateFunction* const _ainew_state[] = {
AiNew_State_BuildPath,
AiNew_State_BuildDepot,
AiNew_State_BuildVehicle,
+ NULL,
AiNew_State_GiveOrders,
AiNew_State_StartVehicle,
AiNew_State_RepayMoney,