The Battle for Wesnoth  1.19.0-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"
17 #include "preferences/game.hpp"
18 
20 {
21  switch(os) {
24  case orb_status::moved:
30  case orb_status::allied:
32  case orb_status::enemy:
34  default:
35  assert(!"expected to handle all the enum values");
36  return false;
37  }
38 }
39 
41 {
42  switch(os) {
45  case orb_status::moved:
46  return preferences::moved_color();
48  [[fallthrough]]; // use partial_color() for any context that wants a single color
51  case orb_status::allied:
53  case orb_status::enemy:
54  return preferences::enemy_color();
55  default:
56  assert(!"expected to handle all the enum values");
57  return {};
58  }
59 }
std::string get_orb_color(orb_status os)
Wrapper for the various preferences::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 preferences::show_..._orb() methods, using the enum instead of exposing a sep...
Definition: orb_status.cpp:19
bool show_unmoved_orb()
Definition: general.cpp:290
bool show_partial_orb()
Definition: general.cpp:297
std::string moved_color()
Definition: general.cpp:352
std::string partial_color()
Definition: general.cpp:372
std::string enemy_color()
Definition: general.cpp:342
bool show_ally_orb()
Definition: general.cpp:262
std::string allied_color()
Definition: general.cpp:322
bool show_enemy_orb()
Definition: general.cpp:276
std::string unmoved_color()
Definition: general.cpp:362
bool show_moved_orb()
Definition: general.cpp:283
bool show_disengaged_orb()
Definition: general.cpp:304
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.