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:
Peter Nelson
2025-09-09 18:00:54 +01:00
committed by dP
parent 0812a641ae
commit c6f657fb62
6 changed files with 30 additions and 28 deletions

View File

@@ -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.
*