Peoplemon  0.1.0
Peoplemon 3 game source documentation
Command.hpp
Go to the documentation of this file.
1 #ifndef GAME_BATTLES_COMMANDS_COMMAND_HPP
2 #define GAME_BATTLES_COMMANDS_COMMAND_HPP
3 
6 #include <cstdint>
7 #include <string>
8 #include <variant>
9 
10 namespace core
11 {
12 namespace battle
13 {
22 class Command {
23 public:
28  enum Type : std::uint8_t {
31 
32  // sync with view. also for network sync
36 
37  // For network client only
39  };
40 
46  Command(Type type);
47 
54  Command(Type type, bool forHost);
55 
61  Command(cmd::Message&& message);
62 
68  Command(cmd::Animation&& anim);
69 
74  Type getType() const;
75 
80  const cmd::Message& getMessage() const;
81 
86  const cmd::Animation& getAnimation() const;
87 
92  bool forHost() const;
93 
94 private:
95  struct Empty {};
96 
97  Type type;
98  std::variant<Empty, cmd::Message, cmd::Animation, bool> data;
99 };
100 
101 } // namespace battle
102 } // namespace core
103 
104 #endif
Core classes and functionality for both the editor and game.
Represents a type of animation that can be played in battle.
Definition: Animation.hpp:25
Emitted by the BattleFSM. All UI is handled via a queue of commands. Commands are resolved in the ord...
Definition: Command.hpp:22
bool forHost() const
Returns whether or not this command is for the active battler.
Definition: Command.cpp:37
const cmd::Message & getMessage() const
Returns the message if this command is a message.
Definition: Command.cpp:25
Type
The type the command is.
Definition: Command.hpp:28
Type getType() const
Returns the type of this command.
Definition: Command.cpp:23
Command(Type type)
Creates a new command of the given type with no data.
Definition: Command.cpp:7
const cmd::Animation & getAnimation() const
Returns the animation if this command is an animation.
Definition: Command.cpp:31
Represents a message to be displayed. The actual message text is generated by the battle controller.
Definition: Message.hpp:26