diff options
-rw-r--r-- | rail_cmd.c | 11 | ||||
-rw-r--r-- | train_cmd.c | 10 | ||||
-rw-r--r-- | tunnelbridge_cmd.c | 6 | ||||
-rw-r--r-- | vehicle.h | 2 |
4 files changed, 16 insertions, 13 deletions
diff --git a/rail_cmd.c b/rail_cmd.c index 5f19dec00..72c4de698 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -1756,11 +1756,10 @@ make_red: } -bool UpdateSignalsOnSegment(TileIndex tile, Direction dir) +bool UpdateSignalsOnSegment(TileIndex tile, DiagDirection direction) { SetSignalsData ssd; int result = -1; - DiagDirection direction = DirToDiagDir(dir); ssd.cur_stack = 0; @@ -1788,8 +1787,12 @@ bool UpdateSignalsOnSegment(TileIndex tile, Direction dir) void SetSignalsOnBothDir(TileIndex tile, byte track) { - static const Direction _search_dir_1[] = { DIR_NE, DIR_SE, DIR_NE, DIR_SE, DIR_SW, DIR_SE }; - static const Direction _search_dir_2[] = { DIR_SW, DIR_NW, DIR_NW, DIR_SW, DIR_NW, DIR_NE }; + static const DiagDirection _search_dir_1[] = { + DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE + }; + static const DiagDirection _search_dir_2[] = { + DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE + }; UpdateSignalsOnSegment(tile, _search_dir_1[track]); UpdateSignalsOnSegment(tile, _search_dir_2[track]); diff --git a/train_cmd.c b/train_cmd.c index 1d761aec4..fe65c5309 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -1964,7 +1964,7 @@ static bool CheckTrainStayInDepot(Vehicle *v) v->load_unload_time_rem = 0; - if (UpdateSignalsOnSegment(v->tile, v->direction)) { + if (UpdateSignalsOnSegment(v->tile, DirToDiagDir(v->direction))) { InvalidateWindowClasses(WC_TRAINS_LIST); return true; } @@ -1983,7 +1983,7 @@ static bool CheckTrainStayInDepot(Vehicle *v) UpdateTrainDeltaXY(v, v->direction); v->cur_image = GetTrainImage(v, v->direction); VehiclePositionChanged(v); - UpdateSignalsOnSegment(v->tile, v->direction); + UpdateSignalsOnSegment(v->tile, DirToDiagDir(v->direction)); UpdateTrainAcceleration(v); InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); @@ -2623,9 +2623,9 @@ static void AffectSpeedByZChange(Vehicle *v, byte old_z) } } -static const Direction _otherside_signal_directions[] = { - DIR_NE, DIR_SE, DIR_NE, DIR_SE, DIR_SW, DIR_SE, 0, 0, - DIR_SW, DIR_NW, DIR_NW, DIR_SW, DIR_NW, DIR_NE, +static const DiagDirection _otherside_signal_directions[] = { + DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE, 0, 0, + DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE }; static void TrainMovedChangeSignals(TileIndex tile, DiagDirection dir) diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c index b770379e7..2d09a6d71 100644 --- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -506,7 +506,7 @@ int32 CmdBuildTunnel(int x, int y, uint32 flags, uint32 p1, uint32 p2) MakeRoadTunnel(end_tile, _current_player, ReverseDiagDir(direction)); } - if (GB(p1, 9, 1) == 0) UpdateSignalsOnSegment(start_tile, DiagDirToDir(direction)); + if (GB(p1, 9, 1) == 0) UpdateSignalsOnSegment(start_tile, direction); } return cost; @@ -582,8 +582,8 @@ static int32 DoClearTunnel(TileIndex tile, uint32 flags) DoClearSquare(tile); DoClearSquare(endtile); - UpdateSignalsOnSegment(tile, DiagDirToDir(ReverseDiagDir(dir))); - UpdateSignalsOnSegment(endtile, DiagDirToDir(dir)); + UpdateSignalsOnSegment(tile, ReverseDiagDir(dir)); + UpdateSignalsOnSegment(endtile, dir); } return _price.clear_tunnel * (length + 1); } @@ -284,7 +284,7 @@ void VehicleInTheWayErrMsg(const Vehicle* v); Vehicle *FindVehicleBetween(TileIndex from, TileIndex to, byte z); TileIndex GetVehicleOutOfTunnelTile(const Vehicle *v); -bool UpdateSignalsOnSegment(TileIndex tile, Direction direction); +bool UpdateSignalsOnSegment(TileIndex tile, DiagDirection direction); void SetSignalsOnBothDir(TileIndex tile, byte track); Vehicle *CheckClickOnVehicle(const ViewPort *vp, int x, int y); |