summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKUDr <kudr@openttd.org>2007-01-11 10:34:42 +0000
committerKUDr <kudr@openttd.org>2007-01-11 10:34:42 +0000
commitdbe11fb9c70b160ad1a07312a5854c35ad56c824 (patch)
treeec4aeac562589ab6f2c903d683ecb3834ea9003d /src
parent318cfab2a14c6754a8be5724a1e3d164f0406f91 (diff)
downloadopenttd-dbe11fb9c70b160ad1a07312a5854c35ad56c824.tar.xz
(svn r8052) - Codechange: RemoveFirstTrack() and RemoveFirstTrackdir() now accept pointer to TrackBits/TrackdirBits instead of reference.
Diffstat (limited to 'src')
-rw-r--r--src/npf.cpp2
-rw-r--r--src/pathfind.cpp2
-rw-r--r--src/rail.h16
-rw-r--r--src/rail_cmd.cpp4
-rw-r--r--src/ship_cmd.cpp2
5 files changed, 13 insertions, 13 deletions
diff --git a/src/npf.cpp b/src/npf.cpp
index 4e2cba0a4..9cba98aa9 100644
--- a/src/npf.cpp
+++ b/src/npf.cpp
@@ -628,7 +628,7 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
i = 0;
/* Enumerate possible track */
while (trackdirbits != 0) {
- Trackdir dst_trackdir = RemoveFirstTrackdir(trackdirbits);
+ Trackdir dst_trackdir = RemoveFirstTrackdir(&trackdirbits);
DEBUG(npf, 5, "Expanded into trackdir: %d, remaining trackdirs: 0x%X", dst_trackdir, trackdirbits);
/* Check for oneway signal against us */
diff --git a/src/pathfind.cpp b/src/pathfind.cpp
index 6fc452647..955394603 100644
--- a/src/pathfind.cpp
+++ b/src/pathfind.cpp
@@ -910,7 +910,7 @@ start_at:
continue; /* We overflowed our depth. No more searching in this direction. */
si.tile = tile;
while (bits != TRACK_BIT_NONE) {
- Track track = RemoveFirstTrack(bits);
+ Track track = RemoveFirstTrack(&bits);
si.track = _new_trackdir[track][direction];
assert(si.track != 0xFF);
si.priority = si.cur_length + estimation;
diff --git a/src/rail.h b/src/rail.h
index aaadc9060..0d2d850a1 100644
--- a/src/rail.h
+++ b/src/rail.h
@@ -250,11 +250,11 @@ static inline TrackdirBits TrackdirToTrackdirBits(Trackdir trackdir) { return (T
/**
* Removes first Track from TrackBits and returns it
*/
-static inline Track RemoveFirstTrack(TrackBits &tracks)
+static inline Track RemoveFirstTrack(TrackBits *tracks)
{
- if (tracks != TRACK_BIT_NONE && tracks != INVALID_TRACK_BIT) {
- Track first = (Track)FIND_FIRST_BIT(tracks);
- tracks = ClrBitT(tracks, first);
+ if (*tracks != TRACK_BIT_NONE && *tracks != INVALID_TRACK_BIT) {
+ Track first = (Track)FIND_FIRST_BIT(*tracks);
+ *tracks = ClrBitT(*tracks, first);
return first;
}
return INVALID_TRACK;
@@ -263,11 +263,11 @@ static inline Track RemoveFirstTrack(TrackBits &tracks)
/**
* Removes first Trackdir from TrackdirBits and returns it
*/
-static inline Trackdir RemoveFirstTrackdir(TrackdirBits &trackdirs)
+static inline Trackdir RemoveFirstTrackdir(TrackdirBits *trackdirs)
{
- if (trackdirs != TRACKDIR_BIT_NONE && trackdirs != INVALID_TRACKDIR_BIT) {
- Trackdir first = (Trackdir)FindFirstBit2x64(trackdirs);
- trackdirs = ClrBitT(trackdirs, first);
+ if (*trackdirs != TRACKDIR_BIT_NONE && *trackdirs != INVALID_TRACKDIR_BIT) {
+ Trackdir first = (Trackdir)FindFirstBit2x64(*trackdirs);
+ *trackdirs = ClrBitT(*trackdirs, first);
return first;
}
return INVALID_TRACKDIR;
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index c7a912e8a..9d467377b 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -860,7 +860,7 @@ static int32 DoConvertRail(TileIndex tile, RailType totype, bool exec)
// notify YAPF about the track layout change
TrackBits tracks = GetTrackBits(tile);
while (tracks != TRACK_BIT_NONE) {
- YapfNotifyTrackLayoutChange(tile, RemoveFirstTrack(tracks));
+ YapfNotifyTrackLayoutChange(tile, RemoveFirstTrack(&tracks));
}
if (IsTileDepotType(tile, TRANSPORT_RAIL)) {
@@ -988,7 +988,7 @@ static int32 ClearTile_Track(TileIndex tile, byte flags)
case RAIL_TILE_NORMAL: {
TrackBits tracks = GetTrackBits(tile);
while (tracks != TRACK_BIT_NONE) {
- Track track = RemoveFirstTrack(tracks);
+ Track track = RemoveFirstTrack(&tracks);
ret = DoCommand(tile, 0, track, flags, CMD_REMOVE_SINGLE_RAIL);
if (CmdFailed(ret)) return CMD_ERROR;
cost += ret;
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 78138612e..da5a40d54 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -468,7 +468,7 @@ static uint FindShipTrack(Vehicle *v, TileIndex tile, DiagDirection dir, TrackBi
best_track = INVALID_TRACK;
do {
- i = RemoveFirstTrack(bits);
+ i = RemoveFirstTrack(&bits);
pfs.best_bird_dist = (uint)-1;
pfs.best_length = (uint)-1;