The Battle for Wesnoth  1.19.4+dev
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
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>

Classes

struct  rule_image_rand
 Represent a rule_image applied with a random seed. More...
 

Public Types

typedef std::pair< const rule_image_rand *, const rule_image_variant * > log_details
 
typedef std::vector< log_detailslogs
 

Public Member Functions

void rebuild_cache (const std::string &tod, logs *log=nullptr)
 Rebuilds the whole image cache, for a given time-of-day. More...
 
void clear ()
 Clears all data in this tile, and resets the cache. More...
 

Public Attributes

std::set< std::string > flags
 The list of flags present in this tile. More...
 
std::vector< rule_image_randimages
 The list of rule_images and random seeds associated to this tile. More...
 
imagelist images_foreground
 The list of images which are in front of the unit sprites, attached to this tile. More...
 
imagelist images_background
 The list of images which are behind the unit sprites, attached to this tile. More...
 
std::string last_tod = "invalid_tod"
 The time-of-day to which the image caches correspond. More...
 
bool sorted_images = false
 Indicates if 'images' is sorted. More...
 

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 282 of file builder.hpp.

Member Typedef Documentation

◆ log_details

Definition at line 285 of file builder.hpp.

◆ logs

Definition at line 286 of file builder.hpp.

Member Function Documentation

◆ clear()

void terrain_builder::tile::clear ( )

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

Definition at line 165 of file builder.cpp.

◆ rebuild_cache()

void terrain_builder::tile::rebuild_cache ( const std::string &  tod,
logs log = nullptr 
)

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

This file holds the terrain_builder implementation.

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

Parameters
todThe current time-of-day
log
Todo:
improve this

Definition at line 90 of file builder.cpp.

References flags, prefs::get(), animated< T >::get_animation_duration(), animated< T >::get_frame(), animated< T >::get_frames_count(), terrain_builder::rule_image_variant::has_flag, i, terrain_builder::rule_image_variant::images, images, images_background, images_foreground, image::is_empty_hex(), terrain_builder::rule_image_variant::random_start, s, sorted_images, and terrain_builder::rule_image_variant::tods.

Referenced by terrain_builder::get_terrain_at().

Member Data Documentation

◆ flags

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

The list of flags present in this tile.

Definition at line 300 of file builder.hpp.

Referenced by terrain_builder::apply_rule(), gui2::dialogs::terrain_layers::pre_show(), and rebuild_cache().

◆ images

std::vector<rule_image_rand> terrain_builder::tile::images

The list of rule_images and random seeds associated to this tile.

Definition at line 321 of file builder.hpp.

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

◆ images_background

imagelist terrain_builder::tile::images_background

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 332 of file builder.hpp.

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

◆ images_foreground

imagelist terrain_builder::tile::images_foreground

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 327 of file builder.hpp.

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

◆ last_tod

std::string terrain_builder::tile::last_tod = "invalid_tod"

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

Definition at line 336 of file builder.hpp.

Referenced by terrain_builder::get_terrain_at().

◆ sorted_images

bool terrain_builder::tile::sorted_images = false

Indicates if 'images' is sorted.

Definition at line 339 of file builder.hpp.

Referenced by rebuild_cache().


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