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

Abstract interface for providing two-way metatile behavior mappings. More...

#include <behavior_map_provider.hpp>

Inheritance diagram for porytiles::BehaviorMapProvider:
[legend]

Public Member Functions

virtual ~BehaviorMapProvider ()=default
 
virtual ChainableResult< std::uint16_t > lookup (const std::string &behavior_name) const =0
 Looks up the numeric value for a behavior constant name.
 
virtual ChainableResult< std::string > lookup (std::uint16_t behavior_value) const =0
 Looks up the behavior constant name for a numeric value.
 

Detailed Description

Abstract interface for providing two-way metatile behavior mappings.

The BehaviorMapProvider maps behavior constant names (e.g., "MB_NORMAL", "MB_TALL_GRASS") to their corresponding uint16_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 18 of file behavior_map_provider.hpp.

Constructor & Destructor Documentation

◆ ~BehaviorMapProvider()

virtual porytiles::BehaviorMapProvider::~BehaviorMapProvider ( )
virtualdefault

Member Function Documentation

◆ lookup() [1/2]

virtual ChainableResult< std::uint16_t > porytiles::BehaviorMapProvider::lookup ( const std::string &  behavior_name) const
pure virtual

Looks up the numeric value for a behavior constant name.

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

Parameters
behavior_nameThe behavior constant name (e.g., "MB_NORMAL")
Returns
The numeric value if found, or an error describing why the lookup failed

Implemented in porytiles::HeaderBehaviorMapProvider.

◆ lookup() [2/2]

virtual ChainableResult< std::string > porytiles::BehaviorMapProvider::lookup ( std::uint16_t  behavior_value) const
pure virtual

Looks up the behavior constant name for a numeric value.

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

Parameters
behavior_valueThe numeric behavior value
Returns
The behavior constant name if found, or an error describing why the lookup failed

Implemented in porytiles::HeaderBehaviorMapProvider.


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