resonance 1.0.1
Loading...
Searching...
No Matches
gameenablemgr.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "game/enablemgr.h"
6
7class Gamer;
8class PlayMap;
9class Player;
10
23class GameEnableMgr : public EnableMgr {
24public:
35 GameEnableMgr(int nConfigCode, int nTrackCount, Gamer *pGamer, int nReleaseWhenMet);
36
46 GameEnableMgr(int nTrackCount, Gamer *pGamer, int nReleaseWhenMet);
47
61 static GameEnableMgr *CreateReleasing(int nConfigCode, int nTrackCount, Gamer *pGamer);
62
75 static GameEnableMgr *CreateInvalidating(int nConfigCode, int nTrackCount, Gamer *pGamer);
76
88 static GameEnableMgr *CreateUnrestricted(int nTrackCount, Gamer *pGamer);
89
99 virtual void SetBarOwner(int nTrack, int nBar, Player *pPlayer);
100
113 virtual void ForceEnabled(int nTrack, int nBar, int nUntilBar);
114
124 virtual void ForceDisable(int nTrack);
125
138 virtual int QueryBar(int nTrack, int nBar);
139
140private:
141 // Tracks the owner table covers.
142 enum { kOwnedTrackCount = 8 };
143 // The requirement entry that disables a track.
144 enum { kNeverEnabled = -1 };
145
155 void Init(int nConfigCode);
156
164 void QueryOwnershipAtSongBar(int *pOwned, int nBar) const;
165
172 int IsTrackEnabled(int nTrack, const int *pOwned);
173
174 int mTrackCount;
175 int mOwnedTrackCount;
176 std::vector<std::vector<int> > mRequirements;
177 // Per track, the first bar the requirements apply to. Starts at -1.
178 std::vector<int> mFreeUntil;
179 Gamer *mGamer;
180 PlayMap *mPlayMap;
181 int mReleaseWhenMet;
182};
Policy that decides which tracks a player may catch at each bar.
Definition enablemgr.h:16
GameEnableMgr(int nTrackCount, Gamer *pGamer, int nReleaseWhenMet)
Build the policy with empty requirement lists, which enable every track.
GameEnableMgr(int nConfigCode, int nTrackCount, Gamer *pGamer, int nReleaseWhenMet)
Build the policy with requirement lists read from a configuration code.
virtual void ForceDisable(int nTrack)
Stop one track from ever being enabled.
virtual void ForceEnabled(int nTrack, int nBar, int nUntilBar)
Leave one track free of its requirements until a bar, or release them for good.
static GameEnableMgr * CreateReleasing(int nConfigCode, int nTrackCount, Gamer *pGamer)
Build the solo game policy, which releases a track's requirements once met.
virtual void SetBarOwner(int nTrack, int nBar, Player *pPlayer)
Record a new owner and act on every track whose state it changes.
static GameEnableMgr * CreateInvalidating(int nConfigCode, int nTrackCount, Gamer *pGamer)
Build a policy from a configuration code that invalidates bars instead of releasing.
virtual int QueryBar(int nTrack, int nBar)
Report whether one bar of one track may be caught.
static GameEnableMgr * CreateUnrestricted(int nTrackCount, Gamer *pGamer)
Build the policy of a game with several players, which enables every track.
One participant's view of a session, driven by messages.
Definition gamer.h:47
Traversal order over one playable sequence.
Definition playmap.h:47
One participant in a session, local or remote.
Definition player.h:39