InitiativeTracker.h header
#include <ew/app/InitiativeTracker.h>
Namespace ew::app
Combatant struct
struct ew::app::Combatant
One participant in a combat/initiative order: a display name and an initiative score.
Members
QString ew::app::Combatant::name
The combatant's display name.
int ew::app::Combatant::initiative = 0
The combatant's initiative score (higher acts first).
InitiativeTracker class
class ew::app::InitiativeTracker
A game-master run-mode initiative order: combatants kept sorted by initiative (highest first, ties in insertion order) with a "current turn" cursor that cycles through them. Pure model logic (no UI); a panel drives it and renders combatants() with currentIndex() highlighted.
Members
void ew::app::InitiativeTracker::add(const QString &name, int initiative)
Adds a combatant named name with initiative, inserted so the list stays in descending initiative order (a new combatant goes after any existing ones of equal initiative). If no turn is active yet, the cursor starts at the top of the order.
void ew::app::InitiativeTracker::removeAt(int index)
Removes the combatant at index (ignored when out of range), keeping the current-turn cursor pointing at the same combatant where possible (or the previous one, or -1 when the list empties).
void ew::app::InitiativeTracker::clear()
Removes every combatant and clears the cursor.
const std::vector< Combatant > & ew::app::InitiativeTracker::combatants() const
The combatants in initiative order (highest first).
int ew::app::InitiativeTracker::currentIndex() const
The index of the combatant whose turn it is, or -1 when the order is empty.
void ew::app::InitiativeTracker::next()
Advances to the next combatant's turn, wrapping to the top after the last. A no-op on an empty order.
void ew::app::InitiativeTracker::previous()
Steps back to the previous combatant's turn, wrapping to the bottom before the first. A no-op on an empty order.