Porytiles
Loading...
Searching...
No Matches
porytiles::TerrainTypeMapProvider Class Referenceabstract

Abstract interface for providing two-way metatile terrain type mappings. More...

#include <terrain_type_map_provider.hpp>

Inheritance diagram for porytiles::TerrainTypeMapProvider:
[legend]

Public Member Functions

virtual ~TerrainTypeMapProvider ()=default
 
virtual ChainableResult< std::uint8_t > lookup (const std::string &terrain_name) const =0
 Looks up the numeric value for a terrain type constant name.
 
virtual ChainableResult< std::string > lookup (std::uint8_t terrain_value) const =0
 Looks up the terrain type constant name for a numeric value.
 

Detailed Description

Abstract interface for providing two-way metatile terrain type mappings.

The TerrainTypeMapProvider maps terrain type constant names (e.g., "TILE_TERRAIN_GRASS", "TILE_TERRAIN_WATER") to their corresponding uint8_t values and vice versa. Implementations may load these mappings from various sources such as header files or configuration. Loading and caching strategies are implementation details left to concrete implementations.

Definition at line 19 of file terrain_type_map_provider.hpp.

Constructor & Destructor Documentation

◆ ~TerrainTypeMapProvider()

virtual porytiles::TerrainTypeMapProvider::~TerrainTypeMapProvider ( )
virtualdefault

Member Function Documentation

◆ lookup() [1/2]

virtual ChainableResult< std::uint8_t > porytiles::TerrainTypeMapProvider::lookup ( const std::string &  terrain_name) const
pure virtual

Looks up the numeric value for a terrain type constant name.

This function searches for the given terrain type constant name in the provider's mapping and returns its corresponding numeric value if found.

Parameters
terrain_nameThe terrain type constant name (e.g., "TILE_TERRAIN_GRASS")
Returns
The numeric value if found, or an error describing why the lookup failed

Implemented in porytiles::HeaderTerrainTypeMapProvider.

◆ lookup() [2/2]

virtual ChainableResult< std::string > porytiles::TerrainTypeMapProvider::lookup ( std::uint8_t  terrain_value) const
pure virtual

Looks up the terrain type constant name for a numeric value.

This function performs a reverse lookup, searching for the terrain type constant name that corresponds to the given numeric value.

Parameters
terrain_valueThe numeric terrain type value
Returns
The terrain type constant name if found, or an error describing why the lookup failed

Implemented in porytiles::HeaderTerrainTypeMapProvider.


The documentation for this class was generated from the following file: