summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-09 12:32:25 +0000
committertron <tron@openttd.org>2006-03-09 12:32:25 +0000
commit78a7b15ce0ceb0758de4eadf6d366906e5372cf2 (patch)
tree140ef767fc8d6e20f27e7bd5429732ec833839b5
parenta00385913bd3942a7abba9aabfee873b37d267a1 (diff)
downloadopenttd-78a7b15ce0ceb0758de4eadf6d366906e5372cf2.tar.xz
(svn r3803) Change the second parameter of UpdateSignalsOnSegment() from Direction to DiagDirection as that's what it really operates on
-rw-r--r--rail_cmd.c11
-rw-r--r--train_cmd.c10
-rw-r--r--tunnelbridge_cmd.c6
-rw-r--r--vehicle.h2
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);
}
diff --git a/vehicle.h b/vehicle.h
index 4713cdca4..b6ea2b3a0 100644
--- a/vehicle.h
+++ b/vehicle.h
@@ -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);