Horizon Official Technical Documentation
|
|
The class Map is the representation of a map in the game. It contains all the cells and the grid holder. It also contains the A* pathfinder. It is the main class for the map. It is used to get the cells, the grid holder and the pathfinder, and perform a variety of operations on them. More...
#include <Map.hpp>
Public Member Functions | |
Map (std::weak_ptr< GameLogicProcess >, std::string const &, uint16_t, uint16_t, std::vector< uint8_t > const &) | |
~Map () | |
std::shared_ptr< GameLogicProcess > | container () |
std::string const & | get_name () |
int | get_area () |
uint16_t | get_width () |
uint16_t | get_height () |
map_cell_types | get_cell_type (MapCoords coords) |
GridHolderType & | getGridHolder () |
template<class T > | |
bool | ensure_grid_for_unit (T *unit, MapCoords coords) |
template<class T , class CONTAINER > | |
void | visit (int grid_x, int grid_y, GridReferenceContainerVisitor< T, CONTAINER > &visitor) |
template<class T , class CONTAINER > | |
void | visit (GridCoords const &lower_bound, GridCoords const &upper_bound, GridReferenceContainerVisitor< T, CONTAINER > &visitor) |
template<class T , class CONTAINER > | |
void | visit_in_range (MapCoords const &map_coords, GridReferenceContainerVisitor< T, CONTAINER > &visitor, uint16_t range=MAX_VIEW_RANGE) |
AStar::Generator & | get_pathfinder () |
bool | has_obstruction_at (int16_t x, int16_t y) |
MapCoords | get_random_accessible_coordinates () |
MapCoords | get_random_coordinates_in_walkable_range (uint16_t x, uint16_t y, int16_t min, int16_t max) |
MapCoords | get_random_coordinates_in_walkable_area (uint16_t x, uint16_t y, int16_t xs, int16_t ys) |
void | set_user_count (int32_t count) |
int32_t | get_user_count () |
void | add_user_count () |
void | sub_user_count () |
void | add_item_drop (int item_id, MapCoords map_coords, int amount, int identified) |
void | add_item_drop (std::shared_ptr< item_entry_data > entry, int32_t amount, MapCoords map_coords) |
Private Attributes | |
std::weak_ptr< GameLogicProcess > | _container |
std::string | _name {""} |
uint16_t | _width {0} |
uint16_t | _height {0} |
GridCoords | _max_grids |
Cell | _cells [MAX_CELLS_PER_MAP][MAX_CELLS_PER_MAP] {{0}} |
GridHolderType | _gridholder |
AStar::Generator | _pathfinder |
int32_t | _user_count { 0 } |
The class Map is the representation of a map in the game. It contains all the cells and the grid holder. It also contains the A* pathfinder. It is the main class for the map. It is used to get the cells, the grid holder and the pathfinder, and perform a variety of operations on them.
_container | The container that contains this map. |
_name | The name of the map. |
_width | The width of the map. |
_height | The height of the map. |
_cells | The cells of the map. |
_gridholder | The grid holder of the map. |
_pathfinder | The A* pathfinder of the map. |
_obstructions | The obstructions of the map. |
Map::Map | ( | std::weak_ptr< GameLogicProcess > | container, |
std::string const & | name, | ||
uint16_t | width, | ||
uint16_t | height, | ||
std::vector< uint8_t > const & | cells | ||
) |
References _cells.
Map::~Map | ( | ) |
References _cells, _height, _width, and Horizon::Zone::Cell::~Cell().
void Map::add_item_drop | ( | int | item_id, |
MapCoords | map_coords, | ||
int | amount, | ||
int | identified | ||
) |
References _last_np_unit_guid(), s_grid_notify_item_drop_entry::amount, container(), s_grid_notify_item_drop_entry::drop_effect_mode, s_grid_notify_item_drop_entry::guid, HLog, s_grid_notify_item_drop_entry::is_identified, s_grid_notify_item_drop_entry::item_id, ItemDB, RESOURCE_PRIORITY_TERTIARY, s_grid_notify_item_drop_entry::show_drop_effect, sZone, s_grid_notify_item_drop_entry::type, UNIT_ITEM, s_grid_notify_item_drop_entry::x, s_grid_notify_item_drop_entry::x_area, s_grid_notify_item_drop_entry::y, and s_grid_notify_item_drop_entry::y_area.
Referenced by Horizon::Zone::MapComponent::sync_data_types().
void Map::add_item_drop | ( | std::shared_ptr< item_entry_data > | entry, |
int32_t | amount, | ||
MapCoords | map_coords | ||
) |
References _last_np_unit_guid(), s_grid_notify_item_drop_entry::amount, container(), s_grid_notify_item_drop_entry::drop_effect_mode, s_grid_notify_item_drop_entry::guid, s_grid_notify_item_drop_entry::is_identified, s_grid_notify_item_drop_entry::item_id, RESOURCE_PRIORITY_TERTIARY, s_grid_notify_item_drop_entry::show_drop_effect, sZone, s_grid_notify_item_drop_entry::type, UNIT_ITEM, s_grid_notify_item_drop_entry::x, s_grid_notify_item_drop_entry::x_area, s_grid_notify_item_drop_entry::y, and s_grid_notify_item_drop_entry::y_area.
void Map::add_user_count | ( | ) |
References _user_count, container(), get_name(), get_user_count(), and HLog.
|
inline |
References _container.
Referenced by add_item_drop(), add_user_count(), and sub_user_count().
bool Horizon::Zone::Map::ensure_grid_for_unit | ( | T * | unit, |
MapCoords | coords | ||
) |
References _gridholder, GridHolder< ZONE_OBJECT_TYPES >::get_grid(), get_name(), MAX_CELLS_PER_GRID, MAX_GRIDS_PER_MAP, Coordinates< MAX_COORDINATES >::scale(), Coordinates< MAX_COORDINATES >::x(), and Coordinates< MAX_COORDINATES >::y().
|
inline |
|
inline |
References _cells, Horizon::Zone::Cell::get_type(), Coordinates< MAX_COORDINATES >::x(), and Coordinates< MAX_COORDINATES >::y().
|
inline |
References _height.
Referenced by Horizon::Zone::MapComponent::sync_data_types().
|
inline |
References _name.
Referenced by add_user_count(), ensure_grid_for_unit(), sub_user_count(), and Horizon::Zone::MapComponent::sync_data_types().
|
inline |
References _pathfinder.
|
inline |
References _height, _width, and has_obstruction_at().
|
inline |
References _height, _width, and has_obstruction_at().
Referenced by Horizon::Zone::MapComponent::sync_data_types().
|
inline |
References has_obstruction_at().
Referenced by Horizon::Zone::MapComponent::sync_data_types().
|
inline |
References _user_count.
Referenced by add_user_count(), and sub_user_count().
|
inline |
References _width.
Referenced by Horizon::Zone::MapComponent::sync_data_types().
|
inline |
References _gridholder.
bool Map::has_obstruction_at | ( | int16_t | x, |
int16_t | y | ||
) |
References _cells, _height, _width, and Horizon::Zone::Cell::isWalkable().
Referenced by get_random_accessible_coordinates(), get_random_coordinates_in_walkable_area(), get_random_coordinates_in_walkable_range(), and Horizon::Zone::MapComponent::sync_data_types().
|
inline |
References _user_count, and GridTypeListIterator::count().
void Map::sub_user_count | ( | ) |
References _user_count, container(), get_name(), get_user_count(), and HLog.
|
inline |
References Coordinates< MAX_COORDINATES >::x(), and Coordinates< MAX_COORDINATES >::y().
|
inline |
References Grid< GRID_OBJECT_TYPES >::visit().
|
inline |
References Coordinates< MAX_COORDINATES >::at_range(), MAX_CELLS_PER_GRID, MAX_CELLS_PER_MAP, MAX_GRIDS_PER_MAP, and Coordinates< MAX_COORDINATES >::scale().
|
private |
Referenced by get_cell_type(), has_obstruction_at(), Map(), and ~Map().
|
private |
Referenced by container().
|
private |
Referenced by ensure_grid_for_unit(), and getGridHolder().
|
private |
|
private |
|
private |
Referenced by get_name().
|
private |
Referenced by get_pathfinder().
|
private |
Referenced by add_user_count(), get_user_count(), set_user_count(), and sub_user_count().
|
private |