equal
deleted
inserted
replaced
799 for (i=2;i<_players_ainew[p->index].path_info.route_length-2;i++) { |
799 for (i=2;i<_players_ainew[p->index].path_info.route_length-2;i++) { |
800 tile = _players_ainew[p->index].path_info.route[i]; |
800 tile = _players_ainew[p->index].path_info.route[i]; |
801 for (j = DIAGDIR_BEGIN; j < DIAGDIR_END; j++) { |
801 for (j = DIAGDIR_BEGIN; j < DIAGDIR_END; j++) { |
802 TileIndex t = tile + TileOffsByDiagDir(j); |
802 TileIndex t = tile + TileOffsByDiagDir(j); |
803 |
803 |
804 if (IsTileType(t, MP_ROAD) && |
804 if (IsRoadDepotTile(t) && |
805 GetRoadTileType(t) == ROAD_TILE_DEPOT && |
|
806 IsTileOwner(t, _current_player) && |
805 IsTileOwner(t, _current_player) && |
807 GetRoadDepotDirection(t) == ReverseDiagDir(j)) { |
806 GetRoadDepotDirection(t) == ReverseDiagDir(j)) { |
808 _players_ainew[p->index].depot_tile = t; |
807 _players_ainew[p->index].depot_tile = t; |
809 _players_ainew[p->index].depot_direction = ReverseDiagDir(j); |
808 _players_ainew[p->index].depot_direction = ReverseDiagDir(j); |
810 _players_ainew[p->index].state = AI_STATE_VERIFY_ROUTE; |
809 _players_ainew[p->index].state = AI_STATE_VERIFY_ROUTE; |
1100 static void AiNew_State_BuildDepot(Player *p) |
1099 static void AiNew_State_BuildDepot(Player *p) |
1101 { |
1100 { |
1102 CommandCost res; |
1101 CommandCost res; |
1103 assert(_players_ainew[p->index].state == AI_STATE_BUILD_DEPOT); |
1102 assert(_players_ainew[p->index].state == AI_STATE_BUILD_DEPOT); |
1104 |
1103 |
1105 if (IsTileType(_players_ainew[p->index].depot_tile, MP_ROAD) && GetRoadTileType(_players_ainew[p->index].depot_tile) == ROAD_TILE_DEPOT) { |
1104 if (IsRoadDepotTile(_players_ainew[p->index].depot_tile)) { |
1106 if (IsTileOwner(_players_ainew[p->index].depot_tile, _current_player)) { |
1105 if (IsTileOwner(_players_ainew[p->index].depot_tile, _current_player)) { |
1107 // The depot is already built |
1106 // The depot is already built |
1108 _players_ainew[p->index].state = AI_STATE_BUILD_VEHICLE; |
1107 _players_ainew[p->index].state = AI_STATE_BUILD_VEHICLE; |
1109 return; |
1108 return; |
1110 } else { |
1109 } else { |