diff options
author | truelight <truelight@openttd.org> | 2004-08-17 16:20:04 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2004-08-17 16:20:04 +0000 |
commit | 4b919416a2d627fc6c979bc12069f120040a48f7 (patch) | |
tree | 8e87986ba34d24e9358ebd81cc9cac5469c51089 /ai.c | |
parent | 5e25a4ee7996a4cc3456c91ba07f27b5e810ffdf (diff) | |
download | openttd-4b919416a2d627fc6c979bc12069f120040a48f7.tar.xz |
(svn r77) -Fix: [1010788] AI service interval bug (tnx truesatan)
-Add: AI overrides service interval to 180 days
-Fix: AI hanged when all vehicles were disabled in Patch menu
Diffstat (limited to 'ai.c')
-rw-r--r-- | ai.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -301,6 +301,8 @@ static void AiHandleReplaceTrain(Player *p) veh = _new_train_id; AiRestoreVehicleOrders(&_vehicles[veh], orderbak); DoCommandByTile(0, veh, 0, DC_EXEC, CMD_START_STOP_TRAIN); + // Force the service interval to 180 days.. else things can go very wrong :p + DoCommandByTile(0, veh, 180, DC_EXEC, CMD_CHANGE_TRAIN_SERVICE_INT); } } } @@ -327,6 +329,8 @@ static void AiHandleReplaceRoadVeh(Player *p) veh = _new_roadveh_id; AiRestoreVehicleOrders(&_vehicles[veh], orderbak); DoCommandByTile(0, veh, 0, DC_EXEC, CMD_START_STOP_ROADVEH); + // Force the service interval to 180 days.. else things can go very wrong :p + DoCommandByTile(0, veh, 180, DC_EXEC, CMD_CHANGE_ROADVEH_SERVICE_INT); } } } @@ -353,6 +357,8 @@ static void AiHandleReplaceAircraft(Player *p) veh = _new_aircraft_id; AiRestoreVehicleOrders(&_vehicles[veh], orderbak); DoCommandByTile(0, veh, 0, DC_EXEC, CMD_START_STOP_AIRCRAFT); + // Force the service interval to 180 days.. else things can go very wrong :p + DoCommandByTile(0, veh, 180, DC_EXEC, CMD_CHANGE_AIRCRAFT_SERVICE_INT); } } } @@ -1492,6 +1498,10 @@ static void AiStateWantNewRoute(Player *p) for(;;) { r = (uint16)Random(); + if (_patches.ai_disable_veh_train && _patches.ai_disable_veh_roadveh && + _patches.ai_disable_veh_aircraft && _patches.ai_disable_veh_ship) + return; + if (r < 0x7626) { if (_patches.ai_disable_veh_train) continue; AiWantTrainRoute(p); @@ -2422,6 +2432,8 @@ handle_nocash: } DoCommandByTile(0, loco_id, 0, DC_EXEC, CMD_START_STOP_TRAIN); + // Force the service interval to 180 days.. else things can go very wrong :p + DoCommandByTile(0, loco_id, 180, DC_EXEC, CMD_CHANGE_TRAIN_SERVICE_INT); if (p->ai.num_want_fullload != 0) p->ai.num_want_fullload--; @@ -3167,6 +3179,8 @@ static void AiStateBuildRoadVehicles(Player *p) } DoCommandByTile(0, loco_id, 0, DC_EXEC, CMD_START_STOP_ROADVEH); + // Force the service interval to 180 days.. else things can go very wrong :p + DoCommandByTile(0, loco_id, 180, DC_EXEC, CMD_CHANGE_ROADVEH_SERVICE_INT); if (p->ai.num_want_fullload != 0) p->ai.num_want_fullload--; @@ -3473,6 +3487,8 @@ static void AiStateBuildAircraftVehicles(Player *p) } DoCommandByTile(0, loco_id, 0, DC_EXEC, CMD_START_STOP_AIRCRAFT); + // Force the service interval to 180 days.. else things can go very wrong :p + DoCommandByTile(0, loco_id, 180, DC_EXEC, CMD_CHANGE_AIRCRAFT_SERVICE_INT); if (p->ai.num_want_fullload != 0) p->ai.num_want_fullload--; |