The Battle for Wesnoth  1.19.0-dev
Public Member Functions | Public Attributes | List of all members
terrain_builder::rule_image_variant Struct Reference

An image variant. More...

#include <builder.hpp>

Public Member Functions

 rule_image_variant (const std::string &image_string, const std::string &variations, int random_start=-1)
 Constructor for the normal default case. More...
 
 rule_image_variant (const std::string &image_string, const std::string &variations, const std::string &tod, const std::string &has_flag, int random_start=-1)
 Constructor for true [variant] cases. More...
 

Public Attributes

std::string image_string
 A string representing either the filename for an image, or a list of images, with an optional timing for each image. More...
 
std::string variations
 A semi-solon separated list of string used to replace. More...
 
std::vector< animated< image::locator > > images
 An animated image locator built according to the image string. More...
 
std::set< std::string > tods
 The Time of Day associated to this variant (if any) More...
 
std::vector< std::string > has_flag
 
int random_start
 Specify the allowed amount of random shift (in milliseconds) applied to the animation start time, -1 for shifting without limitation. More...
 

Detailed Description

An image variant.

The in-memory representation of the [variant] WML tag of the [image] WML tag. When an image only has one variant, the [variant] tag may be omitted.

Definition at line 165 of file builder.hpp.

Constructor & Destructor Documentation

◆ rule_image_variant() [1/2]

terrain_builder::rule_image_variant::rule_image_variant ( const std::string &  image_string,
const std::string &  variations,
int  random_start = -1 
)
inline

Constructor for the normal default case.

Definition at line 168 of file builder.hpp.

◆ rule_image_variant() [2/2]

terrain_builder::rule_image_variant::rule_image_variant ( const std::string &  image_string,
const std::string &  variations,
const std::string &  tod,
const std::string &  has_flag,
int  random_start = -1 
)

Constructor for true [variant] cases.

Definition at line 660 of file builder.cpp.

References has_flag, utils::split(), and tods.

Member Data Documentation

◆ has_flag

std::vector<std::string> terrain_builder::rule_image_variant::has_flag

Definition at line 218 of file builder.hpp.

Referenced by terrain_builder::tile::rebuild_cache(), and rule_image_variant().

◆ image_string

std::string terrain_builder::rule_image_variant::image_string

A string representing either the filename for an image, or a list of images, with an optional timing for each image.

Corresponds to the "name" parameter of the [variant] (or of the [image]) WML tag.

The timing string is in the following format (expressed in EBNF)

*  <timing_string> ::= <timed_image> ( "," <timed_image> ) +
*
*  <timed_image> ::= <image_name> [ ":" <timing> ]
*
*  Where <image_name> represents the actual filename of an image,
*  and <timing> the number of milliseconds this image will last
*  in the animation.
*

Definition at line 202 of file builder.hpp.

Referenced by terrain_builder::building_rule::get_hash(), terrain_builder::load_images(), and terrain_builder::replace_rotate_tokens().

◆ images

std::vector<animated<image::locator> > terrain_builder::rule_image_variant::images

An animated image locator built according to the image string.

This will be the image locator which will actually be returned to the user.

Definition at line 213 of file builder.hpp.

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

◆ random_start

int terrain_builder::rule_image_variant::random_start

Specify the allowed amount of random shift (in milliseconds) applied to the animation start time, -1 for shifting without limitation.

Definition at line 222 of file builder.hpp.

Referenced by terrain_builder::tile::rebuild_cache().

◆ tods

std::set<std::string> terrain_builder::rule_image_variant::tods

The Time of Day associated to this variant (if any)

Definition at line 216 of file builder.hpp.

Referenced by terrain_builder::tile::rebuild_cache(), and rule_image_variant().

◆ variations

std::string terrain_builder::rule_image_variant::variations

A semi-solon separated list of string used to replace.

<code>@V</code> 

in image_string (if present)

Definition at line 207 of file builder.hpp.

Referenced by terrain_builder::load_images().


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