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

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

#include <encounter_type_map_provider.hpp>

Inheritance diagram for porytiles::EncounterTypeMapProvider:
[legend]

Public Member Functions

virtual ~EncounterTypeMapProvider ()=default
 
virtual ChainableResult< std::uint8_t > lookup (const std::string &encounter_name) const =0
 Looks up the numeric value for an encounter type constant name.
 
virtual ChainableResult< std::string > lookup (std::uint8_t encounter_value) const =0
 Looks up the encounter type constant name for a numeric value.
 

Detailed Description

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

The EncounterTypeMapProvider maps encounter type constant names (e.g., "TILE_ENCOUNTER_NONE", "TILE_ENCOUNTER_LAND") 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 encounter_type_map_provider.hpp.

Constructor & Destructor Documentation

◆ ~EncounterTypeMapProvider()

virtual porytiles::EncounterTypeMapProvider::~EncounterTypeMapProvider ( )
virtualdefault

Member Function Documentation

◆ lookup() [1/2]

virtual ChainableResult< std::uint8_t > porytiles::EncounterTypeMapProvider::lookup ( const std::string &  encounter_name) const
pure virtual

Looks up the numeric value for an encounter type constant name.

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

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

Implemented in porytiles::HeaderEncounterTypeMapProvider.

◆ lookup() [2/2]

virtual ChainableResult< std::string > porytiles::EncounterTypeMapProvider::lookup ( std::uint8_t  encounter_value) const
pure virtual

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

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

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

Implemented in porytiles::HeaderEncounterTypeMapProvider.


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