equal
deleted
inserted
replaced
393 { |
393 { |
394 RoadFindDepotData* rfdd = (RoadFindDepotData*)data; |
394 RoadFindDepotData* rfdd = (RoadFindDepotData*)data; |
395 |
395 |
396 tile += TileOffsByDiagDir(_road_pf_directions[trackdir]); |
396 tile += TileOffsByDiagDir(_road_pf_directions[trackdir]); |
397 |
397 |
398 if (IsTileType(tile, MP_STREET) && |
398 if (IsTileType(tile, MP_ROAD) && |
399 GetRoadTileType(tile) == ROAD_TILE_DEPOT && |
399 GetRoadTileType(tile) == ROAD_TILE_DEPOT && |
400 IsTileOwner(tile, rfdd->owner) && |
400 IsTileOwner(tile, rfdd->owner) && |
401 length < rfdd->best_length) { |
401 length < rfdd->best_length) { |
402 rfdd->best_length = length; |
402 rfdd->best_length = length; |
403 rfdd->tile = tile; |
403 rfdd->tile = tile; |
541 IsRoadVehInDepot(v) || |
541 IsRoadVehInDepot(v) || |
542 v->cur_speed < 5) { |
542 v->cur_speed < 5) { |
543 return CMD_ERROR; |
543 return CMD_ERROR; |
544 } |
544 } |
545 |
545 |
546 if (IsTileType(v->tile, MP_STREET) && GetRoadTileType(v->tile) == ROAD_TILE_NORMAL && GetDisallowedRoadDirections(v->tile) != DRD_NONE) return CMD_ERROR; |
546 if (IsTileType(v->tile, MP_ROAD) && GetRoadTileType(v->tile) == ROAD_TILE_NORMAL && GetDisallowedRoadDirections(v->tile) != DRD_NONE) return CMD_ERROR; |
547 |
547 |
548 if (IsTunnelTile(v->tile) && DirToDiagDir(v->direction) == GetTunnelDirection(v->tile)) return CMD_ERROR; |
548 if (IsTunnelTile(v->tile) && DirToDiagDir(v->direction) == GetTunnelDirection(v->tile)) return CMD_ERROR; |
549 if (IsBridgeTile(v->tile) && DirToDiagDir(v->direction) == GetBridgeRampDirection(v->tile)) return CMD_ERROR; |
549 if (IsBridgeTile(v->tile) && DirToDiagDir(v->direction) == GetBridgeRampDirection(v->tile)) return CMD_ERROR; |
550 |
550 |
551 if (flags & DC_EXEC) v->u.road.reverse_ctr = 180; |
551 if (flags & DC_EXEC) v->u.road.reverse_ctr = 180; |
1143 |
1143 |
1144 uint32 r = GetTileTrackStatus(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes); |
1144 uint32 r = GetTileTrackStatus(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes); |
1145 TrackdirBits signal = (TrackdirBits)GB(r, 16, 16); |
1145 TrackdirBits signal = (TrackdirBits)GB(r, 16, 16); |
1146 TrackdirBits trackdirs = (TrackdirBits)GB(r, 0, 16); |
1146 TrackdirBits trackdirs = (TrackdirBits)GB(r, 0, 16); |
1147 |
1147 |
1148 if (IsTileType(tile, MP_STREET)) { |
1148 if (IsTileType(tile, MP_ROAD)) { |
1149 if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && (!IsTileOwner(tile, v->owner) || GetRoadDepotDirection(tile) == enterdir || (GetRoadTypes(tile) & v->u.road.compatible_roadtypes) == 0)) { |
1149 if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && (!IsTileOwner(tile, v->owner) || GetRoadDepotDirection(tile) == enterdir || (GetRoadTypes(tile) & v->u.road.compatible_roadtypes) == 0)) { |
1150 /* Road depot owned by another player or with the wrong orientation */ |
1150 /* Road depot owned by another player or with the wrong orientation */ |
1151 trackdirs = TRACKDIR_BIT_NONE; |
1151 trackdirs = TRACKDIR_BIT_NONE; |
1152 } |
1152 } |
1153 } else if (IsTileType(tile, MP_STATION) && IsStandardRoadStopTile(tile)) { |
1153 } else if (IsTileType(tile, MP_STATION) && IsStandardRoadStopTile(tile)) { |
1230 return_track(ftd.best_trackdir); |
1230 return_track(ftd.best_trackdir); |
1231 } |
1231 } |
1232 } else { |
1232 } else { |
1233 DiagDirection dir; |
1233 DiagDirection dir; |
1234 |
1234 |
1235 if (IsTileType(desttile, MP_STREET)) { |
1235 if (IsTileType(desttile, MP_ROAD)) { |
1236 if (GetRoadTileType(desttile) == ROAD_TILE_DEPOT) { |
1236 if (GetRoadTileType(desttile) == ROAD_TILE_DEPOT) { |
1237 dir = GetRoadDepotDirection(desttile); |
1237 dir = GetRoadDepotDirection(desttile); |
1238 goto do_it; |
1238 goto do_it; |
1239 } |
1239 } |
1240 } else if (IsTileType(desttile, MP_STATION)) { |
1240 } else if (IsTileType(desttile, MP_STATION)) { |
1392 |
1392 |
1393 if (IsTunnelTile(tile)) { |
1393 if (IsTunnelTile(tile)) { |
1394 diag_dir = GetTunnelDirection(tile); |
1394 diag_dir = GetTunnelDirection(tile); |
1395 } else if (IsBridgeTile(tile)) { |
1395 } else if (IsBridgeTile(tile)) { |
1396 diag_dir = GetBridgeRampDirection(tile); |
1396 diag_dir = GetBridgeRampDirection(tile); |
1397 } else if (IsTileType(tile, MP_STREET) && GetRoadTileType(tile) == ROAD_TILE_DEPOT) { |
1397 } else if (IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_DEPOT) { |
1398 diag_dir = ReverseDiagDir(GetRoadDepotDirection(tile)); |
1398 diag_dir = ReverseDiagDir(GetRoadDepotDirection(tile)); |
1399 } |
1399 } |
1400 |
1400 |
1401 if (diag_dir == INVALID_DIAGDIR) return INVALID_TRACKDIR; |
1401 if (diag_dir == INVALID_DIAGDIR) return INVALID_TRACKDIR; |
1402 dir = DiagdirToDiagTrackdir(diag_dir); |
1402 dir = DiagdirToDiagTrackdir(diag_dir); |
1510 case TRACKDIR_RVREV_NE: needed = ROAD_SW; break; |
1510 case TRACKDIR_RVREV_NE: needed = ROAD_SW; break; |
1511 case TRACKDIR_RVREV_SE: needed = ROAD_NW; break; |
1511 case TRACKDIR_RVREV_SE: needed = ROAD_NW; break; |
1512 case TRACKDIR_RVREV_SW: needed = ROAD_NE; break; |
1512 case TRACKDIR_RVREV_SW: needed = ROAD_NE; break; |
1513 case TRACKDIR_RVREV_NW: needed = ROAD_SE; break; |
1513 case TRACKDIR_RVREV_NW: needed = ROAD_SE; break; |
1514 } |
1514 } |
1515 if (!IsTileType(tile, MP_STREET) || GetRoadTileType(tile) != ROAD_TILE_NORMAL || HasRoadWorks(tile) || (needed & GetRoadBits(tile, ROADTYPE_TRAM)) == ROAD_NONE) { |
1515 if (!IsTileType(tile, MP_ROAD) || GetRoadTileType(tile) != ROAD_TILE_NORMAL || HasRoadWorks(tile) || (needed & GetRoadBits(tile, ROADTYPE_TRAM)) == ROAD_NONE) { |
1516 /* The tram cannot turn here */ |
1516 /* The tram cannot turn here */ |
1517 v->cur_speed = 0; |
1517 v->cur_speed = 0; |
1518 return false; |
1518 return false; |
1519 } |
1519 } |
1520 } else if (IsTileType(v->tile, MP_STREET) && GetRoadTileType(v->tile) == ROAD_TILE_NORMAL && GetDisallowedRoadDirections(v->tile) != DRD_NONE) { |
1520 } else if (IsTileType(v->tile, MP_ROAD) && GetRoadTileType(v->tile) == ROAD_TILE_NORMAL && GetDisallowedRoadDirections(v->tile) != DRD_NONE) { |
1521 v->cur_speed = 0; |
1521 v->cur_speed = 0; |
1522 return false; |
1522 return false; |
1523 } else { |
1523 } else { |
1524 tile = v->tile; |
1524 tile = v->tile; |
1525 } |
1525 } |
1623 |
1623 |
1624 /* This vehicle is not in a wormhole and it hasn't entered a new tile. If |
1624 /* This vehicle is not in a wormhole and it hasn't entered a new tile. If |
1625 * it's on a depot tile, check if it's time to activate the next vehicle in |
1625 * it's on a depot tile, check if it's time to activate the next vehicle in |
1626 * the chain yet. */ |
1626 * the chain yet. */ |
1627 if (v->next != NULL && |
1627 if (v->next != NULL && |
1628 IsTileType(v->tile, MP_STREET) && GetRoadTileType(v->tile) == ROAD_TILE_DEPOT) { |
1628 IsTileType(v->tile, MP_ROAD) && GetRoadTileType(v->tile) == ROAD_TILE_DEPOT) { |
1629 |
1629 |
1630 if (v->u.road.frame == v->u.road.cached_veh_length + RVC_DEPOT_START_FRAME) { |
1630 if (v->u.road.frame == v->u.road.cached_veh_length + RVC_DEPOT_START_FRAME) { |
1631 RoadVehLeaveDepot(v->next, false); |
1631 RoadVehLeaveDepot(v->next, false); |
1632 } |
1632 } |
1633 } |
1633 } |