The Battle for Wesnoth  1.17.0-dev
make.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2021
3  by Chris Beck <render787@gmail.com>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #include "units/make.hpp"
17 #include "units/unit.hpp"
18 
19 unit_ptr make_unit_ptr(const config& cfg, bool use_traits, const vconfig* vcfg)
20 {
21  return unit::create(cfg, use_traits, vcfg);
22 }
23 unit_ptr make_unit_ptr(const unit_type& t, int side, bool real_unit, unit_race::GENDER gender)
24 {
25  return unit::create(t, side, real_unit, gender);
26 }
28 {
29  return u.clone();
30 }
This class represents a single unit of a specific type.
Definition: unit.hpp:121
unit_ptr clone() const
Definition: unit.hpp:210
std::shared_ptr< unit > unit_ptr
Definition: ptr.hpp:26
static unit_ptr create(const config &cfg, bool use_traits=false, const vconfig *vcfg=nullptr)
Initializes a unit from a config.
Definition: unit.hpp:190
A single unit type that the player may recruit.
Definition: types.hpp:45
unit_ptr make_unit_ptr(const config &cfg, bool use_traits, const vconfig *vcfg)
Definition: make.cpp:19
double t
Definition: astarsearch.cpp:65
A variable-expanding proxy for the config class.
Definition: variable.hpp:44
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:61