nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
link.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_LINK_H_
2#define NANOMMO_CLIENT_LINK_H_
3
4#include <cstdint>
5#include <deque>
6#include <optional>
7#include <vector>
8
9#include "protocol/nanommo.pb.h"
10
11namespace nanommo {
12
13/// Where the client's world comes from, and where what the player does goes:
14/// a world server, over the network, in Connection.
15class Link {
16 public:
17 virtual ~Link() = default;
18
19 /// Takes in what's arrived, without waiting.
20 virtual void Poll() = 0;
21
22 virtual void Send(const protocol::Input& input) = 0;
23
24 virtual bool connected() const = 0;
25
26 virtual const protocol::World& world() const = 0;
27
28 /// The newest lines said in the world, oldest first.
29 virtual const std::deque<protocol::Chat>& chat() const = 0;
30
31 /// The newest world that's come whole, by when it was sent, for the server
32 /// to leave out what hasn't changed since.
33 virtual int64_t whole() const = 0;
34
35 /// Where the world's instance told us to go, once it hands its players over.
36 virtual const std::optional<protocol::Move>& move() const = 0;
37
38 /// What we carry and wear, as the world last sent it.
39 virtual const protocol::Inventory& inventory() const = 0;
40 virtual const protocol::Quests& quests() const = 0;
41 /// Our guild, with no name for none.
42 virtual const protocol::Guild& guild() const = 0;
43 /// Our trade, with nobody in it for none.
44 virtual const protocol::Trade& trade() const = 0;
45 /// Our duel, the same.
46 virtual const protocol::Duel& duel() const = 0;
47
48 /// What happened near us since the last time, oldest first, which it hands
49 /// over, as each event comes once.
50 virtual std::vector<protocol::Event> TakeEvents() = 0;
51
52 /// The guild that asked us to join since the last time, once.
53 virtual std::optional<protocol::GuildInvite> TakeInvite() = 0;
54};
55
56} // namespace nanommo
57
58#endif // NANOMMO_CLIENT_LINK_H_
Definition chat.cc:9