Horizon Official Technical Documentation
|
|
#include <MapCache.hpp>
Public Member Functions | |
MapCache () | |
~MapCache () | |
mcache_error_type | initialize () |
bool | Exists () |
mcache_import_error_type | ImportFromCacheFile () |
int | BuildInternalCache () |
bool | BuildExternalCache () |
bool | AppendHeader () |
bool | CreateNewCacheWithHeader () |
bool | AppendToCache (std::string const &name) |
bool | GetMapFromGRF (GRF &grf, std::string const &name) |
Reads a map from GRF's GAT and RSW files. More... | |
bool | ParseGRFReadResult (GRF &grf, std::string const &filename, grf_read_error_type error) |
mcache_config_error_type | ReadMapListConfig () |
mcache_grf_config_error_type | ReadGRFListConfig () |
std::pair< uint8_t, grf_load_result_type > | LoadGRFs () |
void | PrintCacheForMap (std::string const &map_name) |
GRF & | getGRF (uint8_t id) |
void | addGRF (uint8_t id, GRF &grf) |
boost::filesystem::path & | getMapCachePath () |
void | setMapCachePath (std::string const &file) |
int | getCompressionLevel () |
void | setCompressionLevel (int level) |
const boost::filesystem::path & | getMapListPath () const |
void | setMapListPath (std::string const &path) |
const boost::filesystem::path & | getGRFListPath () const |
void | setGRFListPath (std::string const &path) |
void | addToMapList (std::string const &map) |
const boost::filesystem::path & | getGRFPath (uint8_t id) |
void | setGRFPath (uint8_t id, std::string const &path) |
const boost::filesystem::path & | getResourcePath () |
void | setResourcePath (std::string const &path) |
void | setVerbose () |
void | unsetVerbose () |
bool | getVerbose () |
std::shared_ptr< map_cache > | getMCache () |
const std::unordered_map< uint8_t, GRF > & | getGRFs () |
Private Attributes | |
boost::filesystem::path | _map_list_path |
boost::filesystem::path | _grf_list_path |
boost::filesystem::path | _resource_path |
boost::filesystem::path | _map_cache_path |
std::unordered_map< uint8_t, GRF > | _grfs |
int | _compression_level {6} |
std::map< std::string, map_data > | _map_cache_data |
std::vector< std::string > | _map_list |
std::shared_ptr< map_cache > | m_cache |
bool | _verbose {false} |
Horizon::Libraries::MapCache::MapCache | ( | ) |
Horizon::Libraries::MapCache::~MapCache | ( | ) |
|
inline |
|
inline |
bool Horizon::Libraries::MapCache::AppendHeader | ( | ) |
bool Horizon::Libraries::MapCache::AppendToCache | ( | std::string const & | name | ) |
bool Horizon::Libraries::MapCache::BuildExternalCache | ( | ) |
References map_data::cells, mapcache_header::file_size, map_data::info, map_info::length, and mapcache_header::version.
Referenced by main().
int Horizon::Libraries::MapCache::BuildInternalCache | ( | ) |
Referenced by main().
bool Horizon::Libraries::MapCache::CreateNewCacheWithHeader | ( | ) |
bool Horizon::Libraries::MapCache::Exists | ( | ) |
Referenced by main().
|
inline |
|
inline |
|
inline |
References _grf_list_path.
|
inline |
|
inline |
|
inline |
References _map_cache_path.
Referenced by Horizon::Zone::GameLogicProcess::load_map_cache(), and main().
bool Horizon::Libraries::MapCache::GetMapFromGRF | ( | GRF & | grf, |
std::string const & | name | ||
) |
Reads a map from GRF's GAT and RSW files.
[in] | name | name of the map. |
References map_data::cells, GetFloat(), GetULong(), map_data::info, map_info::length, map_info::name, NO_WATER, GRF::read(), map_info::total_x, and map_info::total_y.
|
inline |
References _map_list_path.
Referenced by Horizon::Zone::GameLogicProcess::load_map_cache(), and main().
|
inline |
References m_cache.
Referenced by Horizon::Zone::GameLogicProcess::load_map_cache(), and main().
|
inline |
References _resource_path.
|
inline |
References _verbose.
mcache_import_error_type Horizon::Libraries::MapCache::ImportFromCacheFile | ( | ) |
References mapcache_header::getFileSize(), mapcache_header::getMapCount(), MCACHE_IMPORT_CELLINFO_ERROR, MCACHE_IMPORT_DECOMPRESS_ERROR, MCACHE_IMPORT_INVALID_CHECKSUM, MCACHE_IMPORT_MAPINFO_ERROR, MCACHE_IMPORT_NONEXISTENT_FILE, MCACHE_IMPORT_OK, and MCACHE_IMPORT_READ_ERROR.
Referenced by Horizon::Zone::GameLogicProcess::load_map_cache(), and main().
mcache_error_type Horizon::Libraries::MapCache::initialize | ( | ) |
References MCACHE_CONFIG_OK, MCACHE_CONFIG_READ_ERROR, MCACHE_GRF_CONF_OK, MCACHE_GRF_CONFIG_READ_ERROR, MCACHE_INVALID_CONFIG_PATH, MCACHE_INVALID_GRF_PATH, MCACHE_INVALID_OUTPUT_PATH, and MCACHE_OK.
Referenced by main().
std::pair< uint8_t, grf_load_result_type > Horizon::Libraries::MapCache::LoadGRFs | ( | ) |
References GRF_LOAD_OK.
Referenced by main().
bool Horizon::Libraries::MapCache::ParseGRFReadResult | ( | GRF & | grf, |
std::string const & | filename, | ||
grf_read_error_type | error | ||
) |
References GRF::getGRFPath(), GRE_DECOMPRESS_SIZE_MISMATCH, GRE_NOT_FOUND, GRE_OK, and GRE_READ_ERROR.
void Horizon::Libraries::MapCache::PrintCacheForMap | ( | std::string const & | map_name | ) |
mcache_grf_config_error_type Horizon::Libraries::MapCache::ReadGRFListConfig | ( | ) |
References MCACHE_GRF_CONF_INVALID_FILE, MCACHE_GRF_CONF_OK, MCACHE_GRF_CONF_PARSE_ERROR, GRF::set_id(), and GRF::setGRFPath().
mcache_config_error_type Horizon::Libraries::MapCache::ReadMapListConfig | ( | ) |
References MCACHE_CONFIG_OK, and MCACHE_CONFIG_PARSE_ERROR.
Referenced by Horizon::Zone::GameLogicProcess::load_map_cache().
|
inline |
References _compression_level.
|
inline |
References _grf_list_path.
|
inline |
|
inline |
References _map_cache_path.
Referenced by Horizon::Zone::GameLogicProcess::load_map_cache().
|
inline |
References _map_list_path.
Referenced by Horizon::Zone::GameLogicProcess::load_map_cache().
|
inline |
References _resource_path.
|
inline |
|
inline |
|
private |
Referenced by getCompressionLevel(), and setCompressionLevel().
|
private |
Referenced by getGRFListPath(), and setGRFListPath().
|
private |
Referenced by addGRF(), getGRF(), getGRFPath(), getGRFs(), and setGRFPath().
|
private |
|
private |
Referenced by getMapCachePath(), and setMapCachePath().
|
private |
Referenced by addToMapList().
|
private |
Referenced by getMapListPath(), and setMapListPath().
|
private |
Referenced by getResourcePath(), and setResourcePath().
|
private |
Referenced by getVerbose(), setVerbose(), and unsetVerbose().
|
private |
Referenced by getMCache().