The Battle for Wesnoth  1.19.7+dev
orb_status.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2020 - 2024
3  by Steve Cotton <steve@octalot.co.uk>
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 #pragma once
17 
18 #include <string>
19 
20 /**
21  * Corresponds to the colored orbs displayed above units' hp-bar and xp-bar.
22  */
23 enum class orb_status {
24  /** The unit still has full movement and all attacks available. */
25  unmoved,
26  /**
27  * The unit can move but can't attack, and wouldn't be able to attack even
28  * if it was moved to a hex adjacent to an enemy.
29  */
30  disengaged,
31  /** All moves and possible attacks have been done. */
32  moved,
33  /** There are still moves and/or attacks possible, but the unit doesn't fit in the "unmoved" status. */
34  partial,
35  /** Belongs to a friendly side */
36  allied,
37  /** Belongs to a non-friendly side; normally visualised by not displaying an orb. */
38  enemy
39 };
40 
42 {
43 /**
44  * Wrapper for the various prefs::get().show_..._orb() methods, using the
45  * enum instead of exposing a separate function for each preference.
46  */
47 bool prefs_show_orb(orb_status os);
48 
49 /**
50  * Wrapper for the various prefs::get().unmoved_color(), moved_color(), etc
51  * methods, using the enum instead of exposing a separate function for each
52  * preference.
53  */
54 std::string get_orb_color(orb_status os);
55 } // namespace orb_status_helper
std::string get_orb_color(orb_status os)
Wrapper for the various prefs::get().unmoved_color(), moved_color(), etc methods, using the enum inst...
Definition: orb_status.cpp:40
bool prefs_show_orb(orb_status os)
Wrapper for the various prefs::get().show_..._orb() methods, using the enum instead of exposing a sep...
Definition: orb_status.cpp:19
orb_status
Corresponds to the colored orbs displayed above units' hp-bar and xp-bar.
Definition: orb_status.hpp:23
@ partial
There are still moves and/or attacks possible, but the unit doesn't fit in the "unmoved" status.
@ moved
All moves and possible attacks have been done.
@ unmoved
The unit still has full movement and all attacks available.
@ disengaged
The unit can move but can't attack, and wouldn't be able to attack even if it was moved to a hex adja...
@ allied
Belongs to a friendly side.
@ enemy
Belongs to a non-friendly side; normally visualised by not displaying an orb.