The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
unit_creator.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2016 by David White <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 /**
16  * @file
17  * Various functions related to the creation of units (recruits, recalls,
18  * and placed units).
19  */
20 
21 #pragma once
22 
23 class config;
24 class team;
25 class vconfig;
26 class game_board;
27 class unit;
28 
29 #include "map/location.hpp"
30 
32 {
33 public:
34  unit_creator(team &tm, const map_location &start_pos, game_board* board = nullptr);
35  unit_creator& allow_show(bool b);
41 
42  /**
43  * finds a suitable location for unit
44  * @retval map_location::null_location() if unit is to be put into recall list
45  * @retval valid on-board map location otherwise
46  */
47  map_location find_location(const config &cfg, const unit* pass_check=nullptr);
48 
49 
50  /**
51  * adds a unit on map without firing any events (so, usable during team construction in gamestatus)
52  */
53  void add_unit(const config &cfg, const vconfig* vcfg = nullptr);
54 
55 private:
56  void post_create(const map_location &loc, const unit &new_unit, bool anim);
57 
59  bool discover_;
63  bool show_;
67 
68 };
unit_creator & allow_rename_side(bool b)
Game board class.
Definition: game_board.hpp:55
Definition: unit.hpp:95
unit_creator & allow_invalidate(bool b)
unit_creator & allow_show(bool b)
unit_creator & allow_discover(bool b)
unit_creator & allow_add_to_recall(bool b)
GLdouble GLdouble GLdouble b
Definition: glew.h:6966
This class stores all the data for a single 'side' (in game nomenclature).
Definition: team.hpp:50
const map_location start_pos_
Encapsulates the map of the game.
Definition: location.hpp:38
unit_creator & allow_get_village(bool b)
void add_unit(const config &cfg, const vconfig *vcfg=nullptr)
adds a unit on map without firing any events (so, usable during team construction in gamestatus) ...
map_location find_location(const config &cfg, const unit *pass_check=nullptr)
finds a suitable location for unit
A variable-expanding proxy for the config class.
Definition: variable.hpp:36
unit_creator(team &tm, const map_location &start_pos, game_board *board=nullptr)
void post_create(const map_location &loc, const unit &new_unit, bool anim)
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
game_board * board_