Codechange: Make GetRail/RoadTypeInfoIndex() a member method.
This follows a similar pattern used for cargoes, houses and objects. Also fixes incorrect documentation of GetRoadTypeInfoIndex().
This commit is contained in:
12
src/road.cpp
12
src/road.cpp
@@ -23,6 +23,18 @@
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
/**
|
||||
* Get the RoadType for this RoadTypeInfo.
|
||||
* @return RoadType in static RoadTypeInfo definitions.
|
||||
*/
|
||||
RoadType RoadTypeInfo::Index() const
|
||||
{
|
||||
extern RoadTypeInfo _roadtypes[ROADTYPE_END];
|
||||
size_t index = this - _roadtypes;
|
||||
assert(index < ROADTYPE_END);
|
||||
return static_cast<RoadType>(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if the tile is a valid tile for a crossing.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user