JustAnotherDnDGame 0.1.0
Jeu de rôle tactique au d20, vue de dessus, en C++/Qt
Loading...
Searching...
No Matches
WorldFlags.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Valentin Eloy
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#pragma once
5
10
11#include <set>
12#include <string>
13#include <string_view>
14#include <vector>
15
16namespace core {
17
38public:
40 [[nodiscard]] bool isSet(std::string_view key) const;
41
43 bool set(std::string_view key);
44
46 void clear(std::string_view key);
47
49 [[nodiscard]] std::size_t size() const {
50 return _flags.size();
51 }
52
54 [[nodiscard]] std::vector<std::string> all() const;
55
56private:
57 std::set<std::string, std::less<>> _flags;
58};
59
74[[nodiscard]] std::string keyForEntity(std::string_view mapName, std::string_view entityType,
75 int column, int row);
76
77} // namespace core
L'ensemble des faits acquis d'une partie : coffres ouverts, quêtes franchies, portes déverrouillées.
Definition WorldFlags.h:37
std::set< std::string, std::less<> > _flags
Definition WorldFlags.h:57
bool isSet(std::string_view key) const
Vrai si le fait est acquis.
Definition WorldFlags.cpp:8
void clear(std::string_view key)
Efface un fait. Utile à un LOT-16 qui rouvrirait une quête, et aux tests.
Definition WorldFlags.cpp:19
std::size_t size() const
Le nombre de faits acquis.
Definition WorldFlags.h:49
std::vector< std::string > all() const
Tous les faits acquis, triés — c'est la forme que la sauvegarde écrira.
Definition WorldFlags.cpp:26
bool set(std::string_view key)
Marque le fait comme acquis. Renvoie false s'il l'était déjà.
Definition WorldFlags.cpp:12
Espace de noms du moteur et de la logique de jeu.
Definition Bootstrap.h:9
std::string keyForEntity(std::string_view mapName, std::string_view entityType, int column, int row)
La clé de drapeau d'une entité de carte : "<carte>/<type>@<colonne>,<ligne>".
Definition WorldFlags.cpp:30