CSCommon: MMatchStageSetting.h 소스 파일

MAIET

MMatchStageSetting.h

00001 #ifndef _MMATCHSTAGESETTING_H
00002 #define _MMATCHSTAGESETTING_H
00003 
00004 #include <list>
00005 using namespace std;
00006 #include "MUID.h"
00007 #include "MMatchGlobal.h"
00008 #include "MMatchGameType.h"
00009 #include "MMatchObject.h"
00010 #include "MMatchMap.h"
00011 
00012 class MMatchObject;
00013 class MMatchStage;
00014 
00015 #define MMATCH_TEAM_MAX_COUNT       2
00016 
00017 #define MMATCH_SPECTATOR_STR        "SPECTATOR"
00018 #define MMATCH_TEAM1_NAME_STR       "RED TEAM"
00019 #define MMATCH_TEAM2_NAME_STR       "BLUE TEAM"
00020 
00021 
00022 inline const char* GetTeamNameStr(MMatchTeam nTeam)
00023 {
00024     switch (nTeam)
00025     {
00026     case MMT_SPECTATOR:
00027         return MMATCH_SPECTATOR_STR;
00028     case MMT_RED:
00029         return MMATCH_TEAM1_NAME_STR;
00030     case MMT_BLUE:
00031         return MMATCH_TEAM2_NAME_STR;
00032     default:
00033         return "";
00034     }
00035     return "";
00036 }
00037 
00038 
00039 enum STAGE_STATE {
00040     STAGE_STATE_STANDBY     = 0,
00041     STAGE_STATE_COUNTDOWN,
00042     STAGE_STATE_RUN,
00043     STAGE_STATE_CLOSE
00044 };
00045 
00046 #define MSTAGENODE_FLAG_FORCEDENTRY_ENABLED     1       // 난입
00047 #define MSTAGENODE_FLAG_PRIVATE                 2       // 비밀방
00048 #define MSTAGENODE_FLAG_LIMITLEVEL              4       // 레벨제한
00049 
00050 
00051 struct MSTAGE_SETTING_NODE {
00052     MUID                uidStage;
00053     char                szMapName[MAPNAME_LENGTH];  // 맵이름
00054     char                nMapIndex;                  // 맵인덱스
00055     MMATCH_GAMETYPE     nGameType;                  // 게임타입
00056     int                 nRoundMax;                  // 라운드
00057     int                 nLimitTime;                 // 제한시간(1 - 1분)
00058     int                 nLimitLevel;                // 제한레벨
00059     int                 nMaxPlayers;                // 최대인원
00060     bool                bTeamKillEnabled;           // 팀킬여부
00061     bool                bTeamWinThePoint;           // 선승제 여부
00062     bool                bForcedEntryEnabled;        // 게임중 참가 여부
00063 
00064 #ifdef _VOTESETTING
00065     bool                bVoteEnabled;               // 투표가능 여부
00066     bool                bObserverEnabled;           // 관전모드 여부
00067 #endif
00068 };
00069 
00070 // 방 처음 만들었을때 스테이지 세팅 초기값
00071 #define MMATCH_DEFAULT_STAGESETTING_MAPNAME         "Mansion"
00072 
00073 #define MMATCH_DEFAULT_STAGESETTING_GAMETYPE            MMATCH_GAMETYPE_DEATHMATCH_SOLO
00074 #define MMATCH_DEFAULT_STAGESETTING_ROUNDMAX            10      // 10라운드
00075 #define MMATCH_DEFAULT_STAGESETTING_LIMITTIME           30      // 30분
00076 #define MMATCH_DEFAULT_STAGESETTING_LIMITLEVEL          0       // 무제한
00077 #define MMATCH_DEFAULT_STAGESETTING_MAXPLAYERS          8       // 8명
00078 #define MMATCH_DEFAULT_STAGESETTING_TEAMKILL            false   // 팀킬불가
00079 #define MMATCH_DEFAULT_STAGESETTING_TEAM_WINTHEPOINT    false   // 선승제 여부
00080 #define MMATCH_DEFAULT_STAGESETTING_FORCEDENTRY         true    // 난입가능
00081 
00082 #define STAGESETTING_LIMITTIME_UNLIMITED                0       // 제한시간이 무제한은 0
00083 
00084 
00085 struct MSTAGE_CHAR_SETTING_NODE {
00086     MUID    uidChar;
00087     int     nTeam;
00088     MMatchObjectStageState  nState;
00089     MSTAGE_CHAR_SETTING_NODE() : uidChar(MUID(0,0)), nTeam(0), nState(MOSS_NONREADY) {  }
00090 };
00091 class MStageCharSettingList : public list<MSTAGE_CHAR_SETTING_NODE*> {
00092 public:
00093     void DeleteAll() {
00094         for (iterator i=begin(); i!=end(); i++) {
00095             delete (*i);
00096         }
00097         clear();
00098     }
00099 };
00100 
00101 
00102 
00103 
00104 class MMatchStageSetting {
00105 protected:
00106     MSTAGE_SETTING_NODE     m_StageSetting;
00107     MUID                    m_uidMaster;    // 방장
00108     STAGE_STATE             m_nStageState;  // 현재 State (게임중,대기중,..)
00109 public:
00110     MStageCharSettingList   m_CharSettingList;
00111 public:
00112     MMatchStageSetting();
00113     virtual ~MMatchStageSetting();
00114     void Clear();
00115     void SetDefault();
00116     unsigned long GetChecksum();
00117     MSTAGE_CHAR_SETTING_NODE* FindCharSetting(const MUID& uid);
00118 
00119     // Get
00120     char* GetMapName()                              { return m_StageSetting.szMapName; }
00121     int GetMapIndex()                               { return m_StageSetting.nMapIndex; }
00122     int GetRoundMax()                               { return m_StageSetting.nRoundMax; }
00123     int GetLimitTime()                              { return m_StageSetting.nLimitTime; }
00124     int GetLimitLevel()                             { return m_StageSetting.nLimitLevel; }
00125     MUID GetMasterUID()                             { return m_uidMaster; }
00126     STAGE_STATE GetStageState()                     { return m_nStageState; }
00127     MMATCH_GAMETYPE GetGameType()                   { return m_StageSetting.nGameType; }
00128     int GetMaxPlayers()                             { return m_StageSetting.nMaxPlayers; }
00129     bool GetForcedEntry()                           { return m_StageSetting.bForcedEntryEnabled; }
00130     MSTAGE_SETTING_NODE* GetStageSetting()          { return &m_StageSetting; }
00131     const MMatchGameTypeInfo* GetCurrGameTypeInfo();
00132 
00133     // Set
00134     void SetMasterUID(const MUID& uid)      { m_uidMaster = uid; }
00135     void SetMapName(char* pszName);
00136     void SetMapIndex(int nMapIndex);
00137     void SetRoundMax(int nRound)            { m_StageSetting.nRoundMax = nRound; }
00138     void SetLimitTime(int nTime)            { m_StageSetting.nLimitTime = nTime; }
00139     void SetGameType(MMATCH_GAMETYPE type)  { m_StageSetting.nGameType=type; }
00140     void SetStageState(STAGE_STATE nState)  { m_nStageState = nState; }
00141     void SetTeamWinThePoint(bool bValue)    { m_StageSetting.bTeamWinThePoint = bValue; }
00142     
00143     void UpdateStageSetting(MSTAGE_SETTING_NODE* pSetting);
00144     void UpdateCharSetting(const MUID& uid, unsigned int nTeam, MMatchObjectStageState nStageState);
00145 
00146     void ResetCharSetting()         { m_CharSettingList.DeleteAll(); }
00147     bool IsTeamPlay();
00148     //static bool IsTeamPlay(MMATCH_GAMETYPE nType);
00149     bool IsTeamWinThePoint()        { return m_StageSetting.bTeamWinThePoint; }     
00150 };
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 #endif


MAIET entertainment