Peoplemon  0.1.0
Peoplemon 3 game source documentation
Classes | Public Types | Public Member Functions | List of all members
core::battle::Command Class Reference

Emitted by the BattleFSM. All UI is handled via a queue of commands. Commands are resolved in the order they are received. Commands are sent over the network and each player individually resolves them. More...

#include <Command.hpp>

Public Types

enum  Type : std::uint8_t {
  DisplayMessage = 0 , PlayAnimation = 1 , SyncStateNoSwitch = 2 , SyncStateSwitch = 3 ,
  WaitForView = 4 , NotifyBattleWinner = 5
}
 The type the command is. More...
 

Public Member Functions

 Command (Type type)
 Creates a new command of the given type with no data. More...
 
 Command (Type type, bool forHost)
 Creates a new command of the given type and a bool to indicate which battler it is for. More...
 
 Command (cmd::Message &&message)
 Creates a new DisplayMessage command. More...
 
 Command (cmd::Animation &&anim)
 Creates a new PlayAnimation command. More...
 
Type getType () const
 Returns the type of this command. More...
 
const cmd::MessagegetMessage () const
 Returns the message if this command is a message. More...
 
const cmd::AnimationgetAnimation () const
 Returns the animation if this command is an animation. More...
 
bool forHost () const
 Returns whether or not this command is for the active battler. More...
 

Detailed Description

Emitted by the BattleFSM. All UI is handled via a queue of commands. Commands are resolved in the order they are received. Commands are sent over the network and each player individually resolves them.

Definition at line 22 of file Command.hpp.

Member Enumeration Documentation

◆ Type

enum core::battle::Command::Type : std::uint8_t

The type the command is.

Enumerator
DisplayMessage 
PlayAnimation 
SyncStateNoSwitch 
SyncStateSwitch 
WaitForView 
NotifyBattleWinner 

Definition at line 28 of file Command.hpp.

Constructor & Destructor Documentation

◆ Command() [1/4]

core::battle::Command::Command ( Type  type)

Creates a new command of the given type with no data.

Parameters
typeThe command type to create

Definition at line 7 of file Command.cpp.

◆ Command() [2/4]

core::battle::Command::Command ( Type  type,
bool  forHost 
)

Creates a new command of the given type and a bool to indicate which battler it is for.

Parameters
typeThe command type to create
forActiveBattlerTrue if cmd is for active battler, false for inactive

Definition at line 11 of file Command.cpp.

◆ Command() [3/4]

core::battle::Command::Command ( cmd::Message &&  message)

Creates a new DisplayMessage command.

Parameters
messageThe message to display

Definition at line 15 of file Command.cpp.

◆ Command() [4/4]

core::battle::Command::Command ( cmd::Animation &&  anim)

Creates a new PlayAnimation command.

Parameters
animThe animation descriptor to play

Definition at line 19 of file Command.cpp.

Member Function Documentation

◆ forHost()

bool core::battle::Command::forHost ( ) const

Returns whether or not this command is for the active battler.

Definition at line 37 of file Command.cpp.

◆ getAnimation()

const cmd::Animation & core::battle::Command::getAnimation ( ) const

Returns the animation if this command is an animation.

Definition at line 31 of file Command.cpp.

◆ getMessage()

const cmd::Message & core::battle::Command::getMessage ( ) const

Returns the message if this command is a message.

Definition at line 25 of file Command.cpp.

◆ getType()

Command::Type core::battle::Command::getType ( ) const

Returns the type of this command.

Definition at line 23 of file Command.cpp.


The documentation for this class was generated from the following files: