summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-03 21:29:13 +0000
committertron <tron@openttd.org>2006-03-03 21:29:13 +0000
commit62f5386d9104328d38c19a32b5546ae72adcc2fd (patch)
tree86f23d872c17e740d8006a913fb1f17999768e96
parentc91a2e0f2655031c3b4cc70178021176699a1f9d (diff)
downloadopenttd-62f5386d9104328d38c19a32b5546ae72adcc2fd.tar.xz
(svn r3752) FYOS avoid to cast function pointers
-rw-r--r--roadveh_cmd.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index 4500664f7..ff8d8480b 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -286,8 +286,10 @@ static const byte _road_pf_directions[16] = {
2, 3, 3, 2, 3, 0, 255, 255,
};
-static bool EnumRoadSignalFindDepot(TileIndex tile, RoadFindDepotData *rfdd, int track, uint length, byte *state)
+static bool EnumRoadSignalFindDepot(TileIndex tile, void* data, int track, uint length, byte* state)
{
+ RoadFindDepotData* rfdd = data;
+
tile += TileOffsByDir(_road_pf_directions[track]);
if (IsTileType(tile, MP_STREET) &&
@@ -328,7 +330,7 @@ static const Depot* FindClosestRoadDepot(const Vehicle* v)
/* search in all directions */
for (i = 0; i != 4; i++) {
- FollowTrack(tile, 0x2000 | TRANSPORT_ROAD, i, (TPFEnumProc*)EnumRoadSignalFindDepot, NULL, &rfdd);
+ FollowTrack(tile, 0x2000 | TRANSPORT_ROAD, i, EnumRoadSignalFindDepot, NULL, &rfdd);
}
if (rfdd.best_length == (uint)-1) return NULL;
@@ -957,8 +959,9 @@ typedef struct {
uint mindist;
} FindRoadToChooseData;
-static bool EnumRoadTrackFindDist(TileIndex tile, FindRoadToChooseData *frd, int track, uint length, byte *state)
+static bool EnumRoadTrackFindDist(TileIndex tile, void* data, int track, uint length, byte* state)
{
+ FindRoadToChooseData* frd = data;
uint dist = DistanceManhattan(tile, frd->dest);
if (dist <= frd->mindist) {
if (dist != frd->mindist || length < frd->maxtracklen) {
@@ -1094,7 +1097,7 @@ do_it:;
if (best_track == -1) best_track = i; // in case we don't find the path, just pick a track
frd.maxtracklen = (uint)-1;
frd.mindist = (uint)-1;
- FollowTrack(tile, 0x3000 | TRANSPORT_ROAD, _road_pf_directions[i], (TPFEnumProc*)EnumRoadTrackFindDist, NULL, &frd);
+ FollowTrack(tile, 0x3000 | TRANSPORT_ROAD, _road_pf_directions[i], EnumRoadTrackFindDist, NULL, &frd);
if (frd.mindist < best_dist || (frd.mindist==best_dist && frd.maxtracklen < best_maxlen)) {
best_dist = frd.mindist;