changeset 6248 | e4a2ed7e5613 |
parent 6247 | 7d81e3a5d803 |
child 6259 | 471b91a4b1d8 |
6247:7d81e3a5d803 | 6248:e4a2ed7e5613 |
---|---|
304 } |
304 } |
305 |
305 |
306 return -(int32)v->value; |
306 return -(int32)v->value; |
307 } |
307 } |
308 |
308 |
309 typedef struct RoadFindDepotData { |
309 struct RoadFindDepotData { |
310 uint best_length; |
310 uint best_length; |
311 TileIndex tile; |
311 TileIndex tile; |
312 OwnerByte owner; |
312 OwnerByte owner; |
313 } RoadFindDepotData; |
313 }; |
314 |
314 |
315 static const DiagDirection _road_pf_directions[] = { |
315 static const DiagDirection _road_pf_directions[] = { |
316 DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE, INVALID_DIAGDIR, INVALID_DIAGDIR, |
316 DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE, INVALID_DIAGDIR, INVALID_DIAGDIR, |
317 DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE, INVALID_DIAGDIR, INVALID_DIAGDIR |
317 DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE, INVALID_DIAGDIR, INVALID_DIAGDIR |
318 }; |
318 }; |
783 s = SND_1A_BUS_START_PULL_AWAY_WITH_HORN; |
783 s = SND_1A_BUS_START_PULL_AWAY_WITH_HORN; |
784 SndPlayVehicleFx(s, v); |
784 SndPlayVehicleFx(s, v); |
785 } |
785 } |
786 } |
786 } |
787 |
787 |
788 typedef struct RoadVehFindData { |
788 struct RoadVehFindData { |
789 int x; |
789 int x; |
790 int y; |
790 int y; |
791 const Vehicle* veh; |
791 const Vehicle* veh; |
792 Direction dir; |
792 Direction dir; |
793 } RoadVehFindData; |
793 }; |
794 |
794 |
795 static void* EnumCheckRoadVehClose(Vehicle *v, void* data) |
795 static void* EnumCheckRoadVehClose(Vehicle *v, void* data) |
796 { |
796 { |
797 static const int8 dist_x[] = { -4, -8, -4, -1, 4, 8, 4, 1 }; |
797 static const int8 dist_x[] = { -4, -8, -4, -1, 4, 8, 4, 1 }; |
798 static const int8 dist_y[] = { -4, -1, 4, 8, 4, 1, -4, -8 }; |
798 static const int8 dist_y[] = { -4, -1, 4, 8, 4, 1, -4, -8 }; |
931 if (new_dir == old_dir) return old_dir; |
931 if (new_dir == old_dir) return old_dir; |
932 delta = (DirDifference(new_dir, old_dir) > DIRDIFF_REVERSE ? DIRDIFF_45LEFT : DIRDIFF_45RIGHT); |
932 delta = (DirDifference(new_dir, old_dir) > DIRDIFF_REVERSE ? DIRDIFF_45LEFT : DIRDIFF_45RIGHT); |
933 return ChangeDir(old_dir, delta); |
933 return ChangeDir(old_dir, delta); |
934 } |
934 } |
935 |
935 |
936 typedef struct OvertakeData { |
936 struct OvertakeData { |
937 const Vehicle* u; |
937 const Vehicle* u; |
938 const Vehicle* v; |
938 const Vehicle* v; |
939 TileIndex tile; |
939 TileIndex tile; |
940 byte tilebits; |
940 byte tilebits; |
941 } OvertakeData; |
941 }; |
942 |
942 |
943 static void* EnumFindVehToOvertake(Vehicle* v, void* data) |
943 static void* EnumFindVehToOvertake(Vehicle* v, void* data) |
944 { |
944 { |
945 const OvertakeData* od = (OvertakeData*)data; |
945 const OvertakeData* od = (OvertakeData*)data; |
946 |
946 |
1028 |
1028 |
1029 for (i = 0; !(bits & 1) || (int)--num >= 0; bits >>= 1, i++) {} |
1029 for (i = 0; !(bits & 1) || (int)--num >= 0; bits >>= 1, i++) {} |
1030 return i; |
1030 return i; |
1031 } |
1031 } |
1032 |
1032 |
1033 typedef struct { |
1033 struct FindRoadToChooseData { |
1034 TileIndex dest; |
1034 TileIndex dest; |
1035 uint maxtracklen; |
1035 uint maxtracklen; |
1036 uint mindist; |
1036 uint mindist; |
1037 } FindRoadToChooseData; |
1037 }; |
1038 |
1038 |
1039 static bool EnumRoadTrackFindDist(TileIndex tile, void* data, Trackdir trackdir, uint length, byte* state) |
1039 static bool EnumRoadTrackFindDist(TileIndex tile, void* data, Trackdir trackdir, uint length, byte* state) |
1040 { |
1040 { |
1041 FindRoadToChooseData* frd = (FindRoadToChooseData*)data; |
1041 FindRoadToChooseData* frd = (FindRoadToChooseData*)data; |
1042 uint dist = DistanceManhattan(tile, frd->dest); |
1042 uint dist = DistanceManhattan(tile, frd->dest); |
1254 RVC_DEPOT_START_FRAME = 6, |
1254 RVC_DEPOT_START_FRAME = 6, |
1255 /* Stop frame for a vehicle in a drive-through stop */ |
1255 /* Stop frame for a vehicle in a drive-through stop */ |
1256 RVC_DRIVE_THROUGH_STOP_FRAME = 7 |
1256 RVC_DRIVE_THROUGH_STOP_FRAME = 7 |
1257 }; |
1257 }; |
1258 |
1258 |
1259 typedef struct RoadDriveEntry { |
1259 struct RoadDriveEntry { |
1260 byte x,y; |
1260 byte x, y; |
1261 } RoadDriveEntry; |
1261 }; |
1262 |
1262 |
1263 #include "table/roadveh.h" |
1263 #include "table/roadveh.h" |
1264 |
1264 |
1265 static const byte _road_veh_data_1[] = { |
1265 static const byte _road_veh_data_1[] = { |
1266 20, 20, 16, 16, 0, 0, 0, 0, |
1266 20, 20, 16, 16, 0, 0, 0, 0, |