equal
deleted
inserted
replaced
328 const Vehicle* v = _players_ai[p->index].cur_veh; |
328 const Vehicle* v = _players_ai[p->index].cur_veh; |
329 BackuppedOrders orderbak; |
329 BackuppedOrders orderbak; |
330 EngineID veh; |
330 EngineID veh; |
331 |
331 |
332 // wait until the vehicle reaches the depot. |
332 // wait until the vehicle reaches the depot. |
333 if (!IsDepotTypeTile(v->tile, TRANSPORT_RAIL) || v->u.rail.track != 0x80 || !(v->vehstatus&VS_STOPPED)) { |
333 if (!IsRailDepotTile(v->tile) || v->u.rail.track != TRACK_BIT_DEPOT || !(v->vehstatus & VS_STOPPED)) { |
334 AiHandleGotoDepot(p, CMD_SEND_TRAIN_TO_DEPOT); |
334 AiHandleGotoDepot(p, CMD_SEND_TRAIN_TO_DEPOT); |
335 return; |
335 return; |
336 } |
336 } |
337 |
337 |
338 veh = AiChooseTrainToReplaceWith(p, v); |
338 veh = AiChooseTrainToReplaceWith(p, v); |
2884 DiagDirection dir = _players_ai[p->index].cur_dir_a; |
2884 DiagDirection dir = _players_ai[p->index].cur_dir_a; |
2885 |
2885 |
2886 are.dest = _players_ai[p->index].cur_tile_b; |
2886 are.dest = _players_ai[p->index].cur_tile_b; |
2887 tile = TILE_MASK(_players_ai[p->index].cur_tile_a + TileOffsByDiagDir(dir)); |
2887 tile = TILE_MASK(_players_ai[p->index].cur_tile_a + TileOffsByDiagDir(dir)); |
2888 |
2888 |
2889 if (IsRoadStopTile(tile) || IsDepotTypeTile(tile, TRANSPORT_ROAD)) return false; |
2889 if (IsRoadStopTile(tile) || IsRoadDepotTile(tile)) return false; |
2890 TrackdirBits bits = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, ROADTYPES_ROAD)) & DiagdirReachesTrackdirs(dir); |
2890 TrackdirBits bits = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, ROADTYPES_ROAD)) & DiagdirReachesTrackdirs(dir); |
2891 if (bits == TRACKDIR_BIT_NONE) return false; |
2891 if (bits == TRACKDIR_BIT_NONE) return false; |
2892 |
2892 |
2893 are.best_dist = (uint)-1; |
2893 are.best_dist = (uint)-1; |
2894 |
2894 |
3604 Vehicle *v = _players_ai[p->index].cur_veh; |
3604 Vehicle *v = _players_ai[p->index].cur_veh; |
3605 |
3605 |
3606 if (v->owner == _current_player) { |
3606 if (v->owner == _current_player) { |
3607 if (v->type == VEH_TRAIN) { |
3607 if (v->type == VEH_TRAIN) { |
3608 |
3608 |
3609 if (!IsDepotTypeTile(v->tile, TRANSPORT_RAIL) || v->u.rail.track != 0x80 || !(v->vehstatus&VS_STOPPED)) { |
3609 if (!IsRailDepotTile(v->tile) || v->u.rail.track != TRACK_BIT_DEPOT || !(v->vehstatus & VS_STOPPED)) { |
3610 if (!v->current_order.IsType(OT_GOTO_DEPOT)) |
3610 if (!v->current_order.IsType(OT_GOTO_DEPOT)) |
3611 DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_TRAIN_TO_DEPOT); |
3611 DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_TRAIN_TO_DEPOT); |
3612 goto going_to_depot; |
3612 goto going_to_depot; |
3613 } |
3613 } |
3614 |
3614 |