Add make_unit_ptr functions in separate header, to avoid inclusion of unit.hpp
This commit is contained in:
parent
f2dc997b50
commit
669ba885ce
3 changed files with 49 additions and 0 deletions
|
@ -380,6 +380,7 @@ units/formula_manager.cpp
|
|||
units/frame.cpp
|
||||
units/helper.cpp
|
||||
units/id.cpp
|
||||
units/make.cpp
|
||||
units/map.cpp
|
||||
units/race.cpp
|
||||
units/types.cpp
|
||||
|
|
26
src/units/make.cpp
Normal file
26
src/units/make.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
Copyright (C) 2014 - 2017 by Chris Beck <render787@gmail.com>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#include "units/ptr.hpp"
|
||||
#include "units/unit.hpp"
|
||||
|
||||
unit_ptr make_unit_ptr(const config& cfg, bool use_traits, const vconfig* vcfg){
|
||||
return { new unit(cfg, use_traits, vcfg) };
|
||||
}
|
||||
unit_ptr make_unit_ptr(const unit_type& t, int side, bool real_unit, unit_race::GENDER gender){
|
||||
return { new unit(t, side, real_unit, gender) };
|
||||
}
|
||||
unit_ptr make_unit_ptr(const unit& u){
|
||||
return { new unit(u) };
|
||||
}
|
22
src/units/make.hpp
Normal file
22
src/units/make.hpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Copyright (C) 2014 - 2017 by Chris Beck <render787@gmail.com>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#include "units/race.hpp"
|
||||
class config;
|
||||
class unit_type;
|
||||
class vconfig;
|
||||
|
||||
unit_ptr make_unit_ptr(const config& cfg, bool use_traits = false, const vconfig* vcfg = nullptr);
|
||||
unit_ptr make_unit_ptr(const unit_type& t, int side, bool real_unit, unit_race::GENDER gender = unit_race::NUM_GENDERS);
|
||||
unit_ptr make_unit_ptr(const unit& u);
|
Loading…
Add table
Reference in a new issue