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/rail.cpp
12
src/rail.cpp
@@ -19,6 +19,18 @@
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
/**
|
||||
* Get the RailType for this RailTypeInfo.
|
||||
* @return RailType in static RailTypeInfo definitions.
|
||||
*/
|
||||
RailType RailTypeInfo::Index() const
|
||||
{
|
||||
extern RailTypeInfo _railtypes[RAILTYPE_END];
|
||||
size_t index = this - _railtypes;
|
||||
assert(index < RAILTYPE_END);
|
||||
return static_cast<RailType>(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the rail type of tile, or INVALID_RAILTYPE if this is no rail tile.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user