The Battle for Wesnoth  1.19.2+dev
orb_status.cpp
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 #include "units/orb_status.hpp"
18 
20 {
21  switch(os) {
23  return prefs::get().show_unmoved_orb();
24  case orb_status::moved:
25  return prefs::get().show_moved_orb();
29  return prefs::get().show_partial_orb();
30  case orb_status::allied:
31  return prefs::get().show_ally_orb();
32  case orb_status::enemy:
33  return prefs::get().show_enemy_orb();
34  default:
35  assert(!"expected to handle all the enum values");
36  return false;
37  }
38 }
39 
41 {
42  switch(os) {
44  return prefs::get().unmoved_color();
45  case orb_status::moved:
46  return prefs::get().moved_color();
48  [[fallthrough]]; // use partial_color() for any context that wants a single color
50  return prefs::get().partial_color();
51  case orb_status::allied:
52  return prefs::get().allied_color();
53  case orb_status::enemy:
54  return prefs::get().enemy_color();
55  default:
56  assert(!"expected to handle all the enum values");
57  return {};
58  }
59 }
std::string enemy_color()
bool show_ally_orb()
bool show_unmoved_orb()
static prefs & get()
bool show_moved_orb()
std::string unmoved_color()
std::string allied_color()
bool show_partial_orb()
std::string moved_color()
bool show_disengaged_orb()
std::string partial_color()
bool show_enemy_orb()
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.