The Battle for Wesnoth  1.15.1+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 /** @file */
16 
17 #pragma once
18 
19 #include "units/map.hpp"
20 
21 namespace unit_helper {
22 
23 /**
24  * Encapsulates the logic for deciding whether an iterator @a u points to
25  * a unit that can advance.
26  * @return true if the unit exists, has available advances, and can_advance().
27  */
29 
30 /**
31  * Determines the total number of available advancements (of any kind) for
32  * a given unit. This includes normal advances and modifiers.
33  * @return the total number of possible advancements.
34  */
36 
37 /**
38  * @return the name of the color encoding the weight of the unit's
39  * resistance value for presenting it to the player.
40  */
41 std::string resistance_color(const int resistance);
42 
43 }
This class represents a single unit of a specific type.
Definition: unit.hpp:99
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:30
std::string resistance_color(const int resistance)
Definition: helper.cpp:35
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:25