The Battle for Wesnoth  1.15.12+dev
helper.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2018 by David White <dave@whitevine.net>
3  Part of the Battle for Wesnoth Project https://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 #pragma once
16 
17 #include "units/map.hpp"
18 
19 namespace unit_helper {
20 
21 /**
22  * Encapsulates the logic for deciding whether an iterator @a u points to
23  * a unit that can advance.
24  * @return true if the unit exists, has available advances, and can_advance().
25  */
27 
28 /**
29  * Determines the total number of available advancements (of any kind) for
30  * a given unit. This includes normal advances and modifiers.
31  * @return the total number of possible advancements.
32  */
34 
35 /**
36  * @return the name of the color encoding the weight of the unit's
37  * resistance value for presenting it to the player.
38  */
39 std::string resistance_color(const int resistance);
40 
41 /**
42  * @return the tooltip text showing a unit's level and what it can advance to.
43  */
44 std::string unit_level_tooltip(const unit &u);
45 
46 /**
47  * @return the tooltip text showing a unit type's level and what it can
48  * advance to.
49  */
50 std::string unit_level_tooltip(const unit_type &u);
51 }
This class represents a single unit of a specific type.
Definition: unit.hpp:120
bool will_certainly_advance(const unit_map::iterator &u)
Encapsulates the logic for deciding whether an iterator u points to a unit that can advance...
Definition: helper.cpp:34
A single unit type that the player may recruit.
Definition: types.hpp:44
std::string resistance_color(const int resistance)
Definition: helper.cpp:42
int number_of_possible_advances(const unit &u)
Determines the total number of available advancements (of any kind) for a given unit.
Definition: helper.cpp:29
std::string unit_level_tooltip(const int level, const std::vector< std::string > &adv_to_types, const std::vector< config > &adv_to_mods)
Definition: helper.cpp:56