nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
herald_window.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_HERALD_WINDOW_H_
2#define NANOMMO_CLIENT_HERALD_WINDOW_H_
3
4#include <cstdint>
5#include <map>
6#include <optional>
7#include <string>
8#include <utility>
9#include <vector>
10
11#include "client/animator.h"
12#include "content/factions.h"
13
14namespace nanommo {
15
16/// A herald's window, which opens when the player clicks one: the herald's
17/// faction, in its colour, and Enlist, while you're sworn to none, which asks
18/// once more before you swear, as it's for good. Once you're sworn, to theirs
19/// or another, it says to which.
21 public:
22 explicit HeraldWindow(std::map<uint32_t, factions::Faction> factions)
23 : factions_(std::move(factions)) {}
24
25 /// The herald, by the NPC's id, and their faction, by its id.
26 void Open(uint32_t npc, std::string name, uint32_t faction);
27
28 bool open() const { return npc_.has_value(); }
29 void Close();
30
31 /// Draws the window, while it's open, for you, among the figures. Returns
32 /// the herald to swear at, by the NPC's id, once you've said you're sure,
33 /// and closes.
34 std::optional<uint32_t> Build(const std::vector<Figure>& figures);
35
36 private:
37 std::map<uint32_t, factions::Faction> factions_;
38 std::optional<uint32_t> npc_;
39 std::string name_;
40 uint32_t faction_ = 0;
41 /// Whether Enlist was clicked, and it's asking whether you're sure.
42 bool asking_ = false;
43};
44
45} // namespace nanommo
46
47#endif // NANOMMO_CLIENT_HERALD_WINDOW_H_
HeraldWindow(std::map< uint32_t, factions::Faction > factions)
void Open(uint32_t npc, std::string name, uint32_t faction)
The herald, by the NPC's id, and their faction, by its id.
std::optional< uint32_t > Build(const std::vector< Figure > &figures)
Definition chat.cc:9