The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Protected Attributes | List of all members
editor::brush Class Reference

The brush class represents a single brush – a set of relative locations around a "hotspot", and related info such as the icon image. More...

#include <brush.hpp>

Public Member Functions

 brush ()
 Construct a default (empty) brush. More...
 
 brush (const config &cfg)
 Construct a brush object from config. More...
 
void add_relative_location (int relative_x, int relative_y)
 Add a location to the brush. More...
 
std::set< map_locationproject (const map_location &hotspot) const
 Get a set of locations affected (i.e. More...
 
const std::string name () const
 
const std::string id () const
 

Protected Attributes

std::set< map_locationrelative_tiles_
 The relative locations of the brush. More...
 
std::string name_
 
std::string id_
 

Detailed Description

The brush class represents a single brush – a set of relative locations around a "hotspot", and related info such as the icon image.

It is constructed from WML – the [brush] tag.

Definition at line 26 of file brush.hpp.

Constructor & Destructor Documentation

editor::brush::brush ( )

Construct a default (empty) brush.

Note that not even the hotspot is affected by default,

Definition at line 59 of file brush.cpp.

editor::brush::brush ( const config cfg)
explicit

Construct a brush object from config.

Definition at line 66 of file brush.cpp.

References add_relative_location(), config::child_range(), get_tiles_in_radius(), name_, relative_tiles_, and WRN_ED.

Member Function Documentation

void editor::brush::add_relative_location ( int  relative_x,
int  relative_y 
)

Add a location to the brush.

If it already exists nothing will change.

Definition at line 90 of file brush.cpp.

References relative_tiles_.

Referenced by brush().

const std::string editor::brush::id ( ) const
inline
Returns
the image of this brush

Definition at line 58 of file brush.hpp.

References id_.

Referenced by editor::editor_toolkit::is_active_brush().

const std::string editor::brush::name ( ) const
inline
Returns
the name of this brush

Definition at line 53 of file brush.hpp.

References name_.

std::set< map_location > editor::brush::project ( const map_location hotspot) const

Get a set of locations affected (i.e.

under the brush) when the center (hotspot) is in given location

Definition at line 95 of file brush.cpp.

References relative_tiles_.

Referenced by editor::brush_drag_mouse_action::affected_hexes().

Member Data Documentation

std::string editor::brush::id_
protected

Definition at line 67 of file brush.hpp.

Referenced by id().

std::string editor::brush::name_
protected

Definition at line 66 of file brush.hpp.

Referenced by brush(), and name().

std::set<map_location> editor::brush::relative_tiles_
protected

The relative locations of the brush.

Definition at line 64 of file brush.hpp.

Referenced by add_relative_location(), brush(), and project().


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