The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Private Attributes | List of all members
terrain_builder::tilemap Class Reference

The map of "tile" structures corresponding to the level map. More...

Public Member Functions

 tilemap (int x, int y)
 Constructs a tilemap of dimensions x * y. More...
 
tileoperator[] (const map_location &loc)
 Returns a reference to the tile which is at the position pointed by loc. More...
 
const tileoperator[] (const map_location &loc) const
 a const variant of operator[] More...
 
bool on_map (const map_location &loc) const
 Tests if a location is on the map. More...
 
void reset ()
 Resets the whole tile map. More...
 
void reload (int x, int y)
 Rebuilds the map to a new set of dimensions. More...
 

Private Attributes

std::vector< tiletiles_
 The map. More...
 
int x_
 The x dimension of the map. More...
 
int y_
 The y dimension of the map. More...
 

Detailed Description

The map of "tile" structures corresponding to the level map.

Definition at line 413 of file builder.hpp.

Constructor & Destructor Documentation

◆ tilemap()

terrain_builder::tilemap::tilemap ( int  x,
int  y 
)

Constructs a tilemap of dimensions x * y.

Definition at line 187 of file builder.cpp.

References reset().

Member Function Documentation

◆ on_map()

bool terrain_builder::tilemap::on_map ( const map_location loc) const

Tests if a location is on the map.

Parameters
locThe location to test
Returns
true if loc is on the map, false otherwise.

Definition at line 210 of file builder.cpp.

References map_location::x, and map_location::y.

Referenced by terrain_builder::apply_rule(), terrain_builder::get_terrain_at(), terrain_builder::get_tile(), terrain_builder::rebuild_terrain(), terrain_builder::rule_matches(), and terrain_builder::update_animation().

◆ operator[]() [1/2]

terrain_builder::tile & terrain_builder::tilemap::operator[] ( const map_location loc)

Returns a reference to the tile which is at the position pointed by loc.

The location MUST be on the map!

Parameters
locThe location of the tile
Returns
A reference to the tile at this location.

Definition at line 219 of file builder.cpp.

References map_location::x, and map_location::y.

◆ operator[]() [2/2]

const terrain_builder::tile & terrain_builder::tilemap::operator[] ( const map_location loc) const

a const variant of operator[]

Definition at line 226 of file builder.cpp.

References map_location::x, and map_location::y.

◆ reload()

void terrain_builder::tilemap::reload ( int  x,
int  y 
)

Rebuilds the map to a new set of dimensions.

Definition at line 201 of file builder.cpp.

Referenced by terrain_builder::reload_map().

◆ reset()

void terrain_builder::tilemap::reset ( )

Resets the whole tile map.

Definition at line 195 of file builder.cpp.

Referenced by terrain_builder::rebuild_all(), and tilemap().

Member Data Documentation

◆ tiles_

std::vector<tile> terrain_builder::tilemap::tiles_
private

The map.

Definition at line 457 of file builder.hpp.

◆ x_

int terrain_builder::tilemap::x_
private

The x dimension of the map.

Definition at line 459 of file builder.hpp.

◆ y_

int terrain_builder::tilemap::y_
private

The y dimension of the map.

Definition at line 461 of file builder.hpp.


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