resonance 1.0.1
Loading...
Searching...
No Matches
netjamenablemgr.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 NetJamEnableMgr : public EnableMgr {
24public:
35 NetJamEnableMgr(int nTrackCount,
36 int nMaxOwned,
37 const std::vector<int> &openTracks,
38 Gamer *pGamer);
39
52 virtual void SetBarOwner(int nTrack, int nBar, Player *pPlayer);
53
63 virtual int QueryBar(int nTrack, int nBar);
64
65private:
66 // The owner identifier of a track nobody owns.
67 enum { kNoOwner = -2 };
68
75 int IsSongSectionEnabled(int nTrack, int nSection) const;
76
83 int FindSection(int nBar);
84
85 PlayMap *mPlayMap;
86 Gamer *mGamer;
87 // Player::mPlayerId of the first local player.
88 int mLocalId;
89 int mTrackCount;
90 int mMaxOwned;
91 std::vector<int> mOpenTracks;
92 // PlayMap::mSteps, the first bar of each section.
93 const std::vector<int> *mSteps;
94 // Per section, the owner identifier of each track.
95 std::vector<std::vector<int> > mOwners;
96};
97
112 int nMaxOwned,
113 const std::vector<int> &openTracks,
114 Gamer *pGamer);
Policy that decides which tracks a player may catch at each bar.
Definition enablemgr.h:16
One participant's view of a session, driven by messages.
Definition gamer.h:47
Enable policy of a network jam, which limits how many tracks one player may own per section.
Definition netjamenablemgr.h:23
virtual void SetBarOwner(int nTrack, int nBar, Player *pPlayer)
Record the owner of a bar's section and invalidate every track whose state it changes.
NetJamEnableMgr(int nTrackCount, int nMaxOwned, const std::vector< int > &openTracks, Gamer *pGamer)
Build the policy with every track free in every section.
virtual int QueryBar(int nTrack, int nBar)
Report whether one bar of one track may be caught.
Traversal order over one playable sequence.
Definition playmap.h:47
One participant in a session, local or remote.
Definition player.h:39
NetJamEnableMgr * NewNetJamEnableMgr(int nTrackCount, int nMaxOwned, const std::vector< int > &openTracks, Gamer *pGamer)
Build the policy for a network jam.