stmm-games-doc  0.32.0
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
stmg::SysEvent Class Reference

Instances of this class end the game for a team or player. More...

Inheritance diagram for stmg::SysEvent:
Inheritance graph
[legend]

Classes

struct  Init
 
struct  LocalInit
 

Public Types

enum  SYS_EVENT_TYPE { SYS_EVENT_TYPE_INVALID = -1, SYS_EVENT_TYPE_LEVEL_COMPLETED = 1, SYS_EVENT_TYPE_LEVEL_FAILED = 2, SYS_EVENT_TYPE_PLAYER_OUT = 3 }
 
enum  { LISTENER_GROUP_TEAM_FINISHED = 20, LISTENER_GROUP_GAME_OVER = 50 }
 
- Public Types inherited from stmg::Event
enum  MSG_FILTER_VALUE_OP {
  MSG_FILTER_VALUE_OP_FIRST = 0, MSG_FILTER_VALUE_OP_UNCHANGED = 0, MSG_FILTER_VALUE_OP_SET = 1, MSG_FILTER_VALUE_OP_MULT_ADD = 2,
  MSG_FILTER_VALUE_OP_DIV_ADD = 3, MSG_FILTER_VALUE_OP_PERCENT_ADD = 4, MSG_FILTER_VALUE_OP_PERMILL_ADD = 5, MSG_FILTER_VALUE_OP_MOD_ADD = 6,
  MSG_FILTER_VALUE_OP_MIN_ADD = 7, MSG_FILTER_VALUE_OP_MAX_ADD = 8, MSG_FILTER_VALUE_OP_LAST = 8
}
 Value filter. More...
 
enum  { LISTENER_GROUP_FINISHED = 0 }
 

Public Member Functions

 SysEvent (Init &&oInit) noexcept
 Constructor. More...
 
void trigger (int32_t nMsg, int32_t nValue, Event *p0TriggeringEvent) noexcept override
 The common triggering function. More...
 
- Public Member Functions inherited from stmg::Event
virtual ~Event () noexcept=default
 
virtual void addMsgFilter (int32_t nInFromMsg, int32_t nInToMsg, int32_t nInFromValue, int32_t nInToValue, bool bOutMsgDefined, int32_t nOutMsg, MSG_FILTER_VALUE_OP eOutValueOperator, int32_t nOutValueOperand, int32_t nOutValueAdd) noexcept
 Add a message filter. More...
 
virtual void addListener (int32_t nGroupId, Event *p0ListenerEvent, int32_t nMsg) noexcept
 Adds a listener to the event. More...
 
bool isActive () const noexcept
 Tells whether the event is active. More...
 
int32_t getTriggerTime () const noexcept
 The triggering time. More...
 
int32_t getPriority () const noexcept
 The priority. More...
 
int32_t getDebugTag () const noexcept
 The debug tag. More...
 

Protected Member Functions

void reInit (Init &&oInit) noexcept
 Reinitialization. More...
 
- Protected Member Functions inherited from stmg::Event
 Event (Init &&oInit) noexcept
 Constructor. More...
 
void reInit (Init &&oInit) noexcept
 Reinitialization. More...
 
virtual void informListeners (int32_t nGroupId, int32_t nValue) noexcept
 Calls the trigger function of a group of listeners. More...
 
const Levellevel () const noexcept
 The level this event belongs to. More...
 
Levellevel () noexcept
 The level this event belongs to. More...
 

Detailed Description

Instances of this class end the game for a team or player.

If the type of action is SYS_EVENT_TYPE_PLAYER_OUT and it's the last player of the team still playing, the team is terminated with SYS_EVENT_TYPE_LEVEL_FAILED.

If the team terminating is the last the game is ended.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
LISTENER_GROUP_TEAM_FINISHED 

The team is finished (succeeded or failed).

Useful with SYS_EVENT_TYPE_PLAYER_OUT.

LISTENER_GROUP_GAME_OVER 

Listener group triggered when the input to the instance causes game over.

◆ SYS_EVENT_TYPE

Enumerator
SYS_EVENT_TYPE_INVALID 
SYS_EVENT_TYPE_LEVEL_COMPLETED 

Team completed level.

SYS_EVENT_TYPE_LEVEL_FAILED 

Team failed level.

SYS_EVENT_TYPE_PLAYER_OUT 

Player out with mate passed as nMsg to the trigger function.

Constructor & Destructor Documentation

◆ SysEvent()

stmg::SysEvent::SysEvent ( Init &&  oInit)
explicitnoexcept

Constructor.

Parameters
oInitThe parameters.

Member Function Documentation

◆ reInit()

void stmg::SysEvent::reInit ( Init &&  oInit)
protectednoexcept

Reinitialization.

Parameters
oInitThe parameters.

◆ trigger()

void stmg::SysEvent::trigger ( int32_t  nMsg,
int32_t  nValue,
Event p0TriggeringEvent 
)
overridevirtualnoexcept

The common triggering function.

Parameters
nMsgEither ignored or represents the mate number of a player. If invalid as if 0 is was passed.
nValueIgnored.
p0TriggeringEventNot used. Can be null.

Implements stmg::Event.