The Battle for Wesnoth  1.19.0-dev
Macros | Functions | Variables
builder.cpp File Reference

Terrain builder. More...

#include "terrain/builder.hpp"
#include "gui/dialogs/loading_screen.hpp"
#include "picture.hpp"
#include "log.hpp"
#include "map/map.hpp"
#include "preferences/game.hpp"
#include "serialization/string_utils.hpp"
#include "game_config_view.hpp"
Include dependency graph for builder.cpp:

Go to the source code of this file.

Macros

#define ERR_NG   LOG_STREAM(err, log_engine)
 
#define WRN_NG   LOG_STREAM(warn, log_engine)
 

Functions

static map_location legacy_negation (const map_location &me)
 These legacy map_location functions moved here from map_location. More...
 
static map_locationlegacy_sum_assign (map_location &me, const map_location &a)
 
static map_location legacy_sum (const map_location &me, const map_location &a)
 
static map_location legacy_difference (const map_location &me, const map_location &a)
 
static unsigned int get_noise (const map_location &loc, unsigned int index)
 
static bool image_exists (const std::string &name)
 
static std::vector< std::string > get_variations (const std::string &base, const std::string &variations)
 
static unsigned int hash_str (const std::string &str)
 

Variables

static lg::log_domain log_engine ("engine")
 

Detailed Description

Terrain builder.

Definition in file builder.cpp.

Macro Definition Documentation

◆ ERR_NG

#define ERR_NG   LOG_STREAM(err, log_engine)

Definition at line 32 of file builder.cpp.

◆ WRN_NG

#define WRN_NG   LOG_STREAM(warn, log_engine)

Definition at line 33 of file builder.cpp.

Function Documentation

◆ get_noise()

static unsigned int get_noise ( const map_location loc,
unsigned int  index 
)
static

Definition at line 196 of file builder.cpp.

References a, b, c, utf8::index(), map_location::x, and map_location::y.

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

◆ get_variations()

static std::vector<std::string> get_variations ( const std::string &  base,
const std::string &  variations 
)
static
Todo:
optimize this function

Definition at line 407 of file builder.cpp.

References utils::split().

Referenced by terrain_builder::load_images().

◆ hash_str()

static unsigned int hash_str ( const std::string &  str)
static

Definition at line 1102 of file builder.cpp.

References h.

Referenced by terrain_builder::building_rule::get_hash(), and config::hash().

◆ image_exists()

static bool image_exists ( const std::string &  name)
static

Definition at line 394 of file builder.cpp.

References image::exists(), and image::precached_file_exists().

Referenced by terrain_builder::load_images().

◆ legacy_difference()

static map_location legacy_difference ( const map_location me,
const map_location a 
)
static

Definition at line 78 of file builder.cpp.

References a, legacy_negation(), and legacy_sum().

Referenced by terrain_builder::build_terrains().

◆ legacy_negation()

static map_location legacy_negation ( const map_location me)
static

These legacy map_location functions moved here from map_location.

?pp. We have refactored them out of everything but this class. Hopefully the end is near...

Adds an absolute location to a "delta" location This is not the mathematically correct behavior, it is neither commutative nor associative. Negative coordinates may give strange results. It is retained because terrain builder code relies in this broken behavior. Best avoid. map_location legacy_negation() const; map_location legacy_sum(const map_location &a) const; map_location& legacy_sum_assign(const map_location &a); map_location legacy_difference(const map_location &a) const;

Definition at line 53 of file builder.cpp.

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

Referenced by legacy_difference().

◆ legacy_sum()

static map_location legacy_sum ( const map_location me,
const map_location a 
)
static

◆ legacy_sum_assign()

static map_location& legacy_sum_assign ( map_location me,
const map_location a 
)
static

Definition at line 58 of file builder.cpp.

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

Referenced by legacy_sum(), and terrain_builder::rotate_rule().

Variable Documentation

◆ log_engine

lg::log_domain log_engine("engine") ( "engine"  )
static