terrain_builder::tile Struct Reference

Represents a tile of the game map, with all associated builder-specific parameters: flags, images attached to this tile, etc. More...

#include <builder.hpp>

Collaboration diagram for terrain_builder::tile:

Collaboration graph
[legend]

List of all members.

Public Types

typedef std::multimap< int,
const rule_image * > 
ordered_ri_list
 An ordered rule_image list.

Public Member Functions

 tile ()
 Contructor for the tile() structure.
void add_image_to_cache (const std::string &tod, ordered_ri_list::const_iterator itor)
 Adds an image, extracted from an ordered rule_image list, to the background or foreground image cache.
void rebuild_cache (const std::string &tod)
 Rebuilds the whole image cache, for a given time-of-day.
void clear ()
 Clears all data in this tile, and resets the cache.

Public Attributes

std::set< std::string > flags
 The list of flags present in this tile.
ordered_ri_list images
 The list of images associated to this tile, ordered by their layer first and base-y position second.
imagelist images_foreground
 The list of images which are in front of the unit sprites, attached to this tile.
imagelist images_background
 The list of images which are behind the unit sprites, attached to this tile.
std::string last_tod
 The time-of-day to which the image caches correspond.


Detailed Description

Represents a tile of the game map, with all associated builder-specific parameters: flags, images attached to this tile, etc.

An array of those tiles is built when terrains are built either during construction, or upon calling the rebuild_all() method.

Definition at line 238 of file builder.hpp.


Member Typedef Documentation

typedef std::multimap<int, const rule_image*> terrain_builder::tile::ordered_ri_list

An ordered rule_image list.

Definition at line 241 of file builder.hpp.


Constructor & Destructor Documentation

terrain_builder::tile::tile (  ) 

Contructor for the tile() structure.

Definition at line 61 of file builder.cpp.


Member Function Documentation

void terrain_builder::tile::add_image_to_cache ( const std::string &  tod,
ordered_ri_list::const_iterator  itor 
)

Adds an image, extracted from an ordered rule_image list, to the background or foreground image cache.

Parameters:
tod The current time-of-day, to select between images presenting several variants.
itor An iterator pointing to the rule_image where to extract the image we wish to add to the cache.

Definition at line 69 of file builder.cpp.

References BASE_Y_INTERVAL, images_background, images_foreground, and UNITPOS.

Referenced by rebuild_cache().

void terrain_builder::tile::rebuild_cache ( const std::string &  tod  ) 

Rebuilds the whole image cache, for a given time-of-day.

Must be called when the time-of-day has changed, to select the correct images.

Parameters:
tod The current time-of-day

Definition at line 95 of file builder.cpp.

References add_image_to_cache(), images, images_background, and images_foreground.

Referenced by terrain_builder::get_terrain_at().

void terrain_builder::tile::clear ( void   ) 

Clears all data in this tile, and resets the cache.

Definition at line 106 of file builder.cpp.

References flags, images, images_background, images_foreground, and last_tod.


Member Data Documentation

std::set<std::string> terrain_builder::tile::flags

The list of flags present in this tile.

Definition at line 269 of file builder.hpp.

Referenced by terrain_builder::apply_rule(), clear(), and terrain_builder::rule_matches().

The list of images associated to this tile, ordered by their layer first and base-y position second.

Definition at line 274 of file builder.hpp.

Referenced by terrain_builder::apply_rule(), clear(), and rebuild_cache().

The list of images which are in front of the unit sprites, attached to this tile.

This member is considered a cache: it is built once, and on-demand.

Definition at line 280 of file builder.hpp.

Referenced by add_image_to_cache(), clear(), terrain_builder::get_terrain_at(), rebuild_cache(), and terrain_builder::rebuild_terrain().

The list of images which are behind the unit sprites, attached to this tile.

This member is considered a cache: it is built once, and on-demand.

Definition at line 285 of file builder.hpp.

Referenced by add_image_to_cache(), clear(), terrain_builder::get_terrain_at(), rebuild_cache(), and terrain_builder::rebuild_terrain().

The time-of-day to which the image caches correspond.

Definition at line 289 of file builder.hpp.

Referenced by clear(), and terrain_builder::get_terrain_at().


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

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs