|
Porytiles
|
A service that loads metatile attributes from a CSV file. More...
#include <attributes_csv_loader.hpp>
Public Member Functions | |
| AttributesCsvLoader (gsl::not_null< const TextFormatter * > format, gsl::not_null< const BehaviorMapProvider * > behavior_map, std::optional< BaseGame > base_game=std::nullopt, const TerrainTypeMapProvider *terrain_map=nullptr, const EncounterTypeMapProvider *encounter_map=nullptr) | |
| Constructs an AttributesCsvLoader with required dependencies. | |
| ChainableResult< std::map< std::size_t, MetatileAttribute > > | load (const std::filesystem::path &path) const |
| Loads metatile attributes from a CSV file. | |
A service that loads metatile attributes from a CSV file.
AttributesCsvLoader parses CSV files in two supported Porytiles attributes formats:
Emerald format (2 columns):
FireRed format (4 columns):
The format is auto-detected from the CSV header row. If a BaseGame is provided, the loader validates that the detected format matches the expected base game. Rich error messages with file context highlighting are produced via FileHighlightPrinter.
Definition at line 45 of file attributes_csv_loader.hpp.
|
inline |
Constructs an AttributesCsvLoader with required dependencies.
This constructor provides backward compatibility with the original 2-column loader. The optional parameters enable FireRed 4-column CSV support when provided.
| format | The text formatter for styled output |
| behavior_map | The behavior map provider for resolving behavior names to values |
| base_game | Optional base game for format validation against the detected CSV format |
| terrain_map | Optional terrain type provider (required for FireRed CSV format) |
| encounter_map | Optional encounter type provider (required for FireRed CSV format) |
Definition at line 60 of file attributes_csv_loader.hpp.
| ChainableResult< std::map< std::size_t, MetatileAttribute > > porytiles::AttributesCsvLoader::load | ( | const std::filesystem::path & | path | ) | const |
Loads metatile attributes from a CSV file.
Parses the CSV file, auto-detects format from the header row, validates format against the base game (if provided), resolves behaviors (and terrain/encounter types for FireRed), and returns a map of metatile ID to MetatileAttribute. All attributes are created with LayerType::normal.
| path | The path to the attributes CSV file |
Definition at line 349 of file attributes_csv_loader.cpp.