mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-13 07:10:57 +00:00
(svn r6992) Make a const_cast<> obsolete by properly propagating the type
This commit is contained in:
parent
0bd9e333a1
commit
9c219888ba
@ -345,13 +345,13 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Depot* stFindNearestDepot(Vehicle* v, TileIndex tile, Trackdir td)
|
static Depot* stFindNearestDepot(const Vehicle* v, TileIndex tile, Trackdir td)
|
||||||
{
|
{
|
||||||
Tpf pf;
|
Tpf pf;
|
||||||
return pf.FindNearestDepot(v, tile, td);
|
return pf.FindNearestDepot(v, tile, td);
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCEINLINE Depot* FindNearestDepot(Vehicle* v, TileIndex tile, Trackdir td)
|
FORCEINLINE Depot* FindNearestDepot(const Vehicle* v, TileIndex tile, Trackdir td)
|
||||||
{
|
{
|
||||||
// set origin and destination nodes
|
// set origin and destination nodes
|
||||||
Yapf().SetOrigin(tile, TrackdirToTrackdirBits(td));
|
Yapf().SetOrigin(tile, TrackdirToTrackdirBits(td));
|
||||||
@ -440,13 +440,13 @@ Depot* YapfFindNearestRoadDepot(const Vehicle *v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// default is YAPF type 2
|
// default is YAPF type 2
|
||||||
typedef Depot* (*PfnFindNearestDepot)(Vehicle*, TileIndex, Trackdir);
|
typedef Depot* (*PfnFindNearestDepot)(const Vehicle*, TileIndex, Trackdir);
|
||||||
PfnFindNearestDepot pfnFindNearestDepot = &CYapfRoadAnyDepot2::stFindNearestDepot;
|
PfnFindNearestDepot pfnFindNearestDepot = &CYapfRoadAnyDepot2::stFindNearestDepot;
|
||||||
|
|
||||||
// check if non-default YAPF type should be used
|
// check if non-default YAPF type should be used
|
||||||
if (_patches.yapf.disable_node_optimization)
|
if (_patches.yapf.disable_node_optimization)
|
||||||
pfnFindNearestDepot = &CYapfRoadAnyDepot1::stFindNearestDepot; // Trackdir, allow 90-deg
|
pfnFindNearestDepot = &CYapfRoadAnyDepot1::stFindNearestDepot; // Trackdir, allow 90-deg
|
||||||
|
|
||||||
Depot* ret = pfnFindNearestDepot(const_cast<Vehicle*>(v), tile, trackdir);
|
Depot* ret = pfnFindNearestDepot(v, tile, trackdir);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user