resonance 1.0.1
Loading...
Searching...
No Matches
barstatusmsg.h
Go to the documentation of this file.
1#pragma once
2
3#include <bitset>
4
5#include "msg/message.h"
6
7class Player;
8
34class BarStatusMsg : public Message {
35public:
37 enum { kEffectCount = 13 };
38
45 typedef std::bitset<kEffectCount> Effects;
46
56
68 BarStatusMsg(int nBar, int nTrack, Player *pPlayer)
69 : mBar(nBar), mTrack(nTrack), mPlayer(pPlayer), mRefreshing(0), mFlags(kFieldPlayer) {
70 }
71
78 }
79
89 static Message *New();
90
98 virtual Message *Clone();
99
107 virtual int Type();
108
116 virtual const char *GetName() const;
117
128 virtual void PrintExtra(std::ostream &stream) const;
129
138 int Has(int nField) const;
139
147 Player *GetPlayer() const {
148 Has(kFieldPlayer); // Yes, the binary discards this result.
149 return mPlayer;
150 }
151
159 int GetEnabled() const {
160 Has(kFieldEnabled); // Yes, the binary discards this result.
161 return mEnabled;
162 }
163
171 int GetPowerup() const {
172 Has(kFieldPowerup); // Yes, the binary discards this result.
173 return mPowerup;
174 }
175
184 Has(kFieldEffects); // Yes, the binary discards this result.
185 return mEffects;
186 }
187
188 int mBar;
189 int mTrack;
190
198
205
213
220
227
228 int mFlags;
229};
230
241extern int g_nBarStatusMsgType;
int g_nBarStatusMsgType
Identity that BarStatusMsg::Type() reports.
int mBar
Definition barstatusmsg.h:188
int mTrack
Definition barstatusmsg.h:189
BarStatusMsg(int nBar, int nTrack, Player *pPlayer)
Report a bar's player, with no other optional field set.
Definition barstatusmsg.h:68
Field
Bits of mFlags, one per optional field.
Definition barstatusmsg.h:50
@ kFieldEnabled
Definition barstatusmsg.h:52
@ kFieldPlayer
Definition barstatusmsg.h:51
@ kFieldEffects
Definition barstatusmsg.h:54
@ kFieldPowerup
Definition barstatusmsg.h:53
BarStatusMsg()
Start with no optional field set and the effect mask clear.
Definition barstatusmsg.h:77
int Has(int nField) const
Report whether one optional field is set.
virtual Message * Clone()
Produce a heap copy of this message.
static Message * New()
Build an empty message on the heap for the message registry.
int mEnabled
Non-zero when the bar is enabled.
Definition barstatusmsg.h:204
int mPowerup
The powerup kind on the bar.
Definition barstatusmsg.h:219
int mRefreshing
Non-zero when PhraseMgr posted the message while refreshing bars.
Definition barstatusmsg.h:212
virtual void PrintExtra(std::ostream &stream) const
Write the bar, the track, and each set optional field.
Player * GetPlayer() const
Report the player field.
Definition barstatusmsg.h:147
Effects mEffects
One bit per effect kind.
Definition barstatusmsg.h:226
@ kEffectCount
Definition barstatusmsg.h:37
int GetEnabled() const
Report the enabled field.
Definition barstatusmsg.h:159
virtual const char * GetName() const
Report this message's class name.
int GetPowerup() const
Report the powerup field.
Definition barstatusmsg.h:171
int mFlags
Definition barstatusmsg.h:228
Player * mPlayer
The player whose track the bar belongs to.
Definition barstatusmsg.h:197
Effects GetEffects() const
Report the effect mask.
Definition barstatusmsg.h:183
virtual int Type()
Report this message's registered identity.
std::bitset< kEffectCount > Effects
One bit per effect kind.
Definition barstatusmsg.h:45
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:41
One participant in a session, local or remote.
Definition player.h:39