stmm-games-doc  0.32.0
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
stmg::FillerEvent Class Reference
Inheritance diagram for stmg::FillerEvent:
Inheritance graph
[legend]

Classes

struct  FillGen
 
struct  Init
 
struct  LocalInit
 

Public Types

enum  FILL_MODE { FILL_MODE_REPLACE = 0, FILL_MODE_OVER = 1, FILL_MODE_UNDER = 2, FILL_MODE_IGNORE = 3 }
 
enum  { MESSAGE_FILL = 100, MESSAGE_FILL_JUST_POS = 101, MESSAGE_FILL_BUT_POS = 102 }
 
enum  { LISTENER_GROUP_FILLED = 10 }
 
- 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

 FillerEvent (Init &&oInit) noexcept
 Constructor. More...
 
void trigger (int32_t nMsg, int32_t nValue, Event *p0TriggeringEvent) noexcept override
 The trigger 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...
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MESSAGE_FILL 

Fill the rect.

nValue contains the number of tiles to fill. If 0 calculated by Init::m_nTotTiles and Init::m_fFactorOfAvailablePositions.

MESSAGE_FILL_JUST_POS 

Fill the position passed as nValue if it is within rect.

MESSAGE_FILL_BUT_POS 

Fill the rect except for the position in nValue packed with Util::packPointToInt32(x,y).

◆ anonymous enum

anonymous enum
Enumerator
LISTENER_GROUP_FILLED 

Fill happend with nValue containing the number of filled tiles.

◆ FILL_MODE

Enumerator
FILL_MODE_REPLACE 

The generated tile replaces the board tile.

FILL_MODE_OVER 

The non empty traits of the generated tile replace the traits of the board tile.

FILL_MODE_UNDER 

The non empty traits of the generated tile replace the traits of the board tile only if they are empty.

FILL_MODE_IGNORE 

The board tile is left unchanged.

Useful when this class is used to count tiles.

Constructor & Destructor Documentation

◆ FillerEvent()

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

Constructor.

If m_oFillGen.m_eFillMode is FILL_MODE_IGNORE m_oFillGen.m_oProbTileGen is ignored, otherwise at least one its trait set must contain a non empty value.

Parameters
oInitThe initialization data.

Member Function Documentation

◆ reInit()

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

Reinitialization.

Parameters
oInitThe initialization data.

◆ trigger()

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

The trigger function.

This function provides the functionality of the event and can be called in two ways.

It can be called by an event through informListeners() this event was listening to. Note: events can listen to themselves.

It can also be called by the timer if the event was active.

When this function is called the event has already been deactivated by the level (if it was active in the first place).

When this function is called the filters of this event have already been applied.

Parameters
nMsgThe message received.
nValueThe value received.
p0TriggeringEventThe triggering event or null if triggered by timer.

Implements stmg::Event.