CSCommon: MQuestLevel.h 소스 파일

MAIET

MQuestLevel.h

00001 #ifndef _MQUEST_LEVEL_H
00002 #define _MQUEST_LEVEL_H
00003 
00004 #include "MBaseQuest.h"
00005 #include "MQuestScenario.h"
00006 #include <vector>
00007 #include <map>
00008 #include <set>
00009 using namespace std;
00010 
00011 struct MTD_QuestGameInfo;
00012 struct MQuestNPCSetInfo;
00013 
00015 class MQuestNPCQueue
00016 {
00017 private:
00018     vector<MQUEST_NPC>          m_Queue;            
00019     int                         m_nCursor;
00020 public:
00021     MQuestNPCQueue();                                       
00022     ~MQuestNPCQueue();                                      
00023 
00027     void Make(int nQLD, MQuestNPCSetInfo* pNPCSetInfo);     
00028     void Clear();                                           
00029     bool Pop(MQUEST_NPC& outNPC);                           
00030     bool GetFirst(MQUEST_NPC& outNPC);                      
00031     bool IsEmpty();                                         
00032     int GetCount();                                         
00033 };
00034 
00035 
00037 struct MQuestLevelSectorNode
00038 {
00039     int     nSectorID;
00040     int     nNextLinkIndex;
00041 
00042     // 여기에 추가정보 들어갈듯
00043 };
00044 
00045 
00047 struct MQuestLevelStaticInfo
00048 {
00049     MQuestScenarioInfo*             pScenario;          
00050     set<MQUEST_NPC>                 NPCs;               
00051     vector<MQuestLevelSectorNode>   SectorList;         
00052     int                             nQL;                
00053     float                           fNPC_TC;            
00054     int                             nQLD;               
00055     int                             nLMT;               
00056 
00057     MQuestLevelStaticInfo()
00058     {
00059         pScenario=NULL;
00060         nQL=0;
00061         fNPC_TC = 1.0f;
00062         nQLD = 0;
00063         nLMT = 1;
00064     }
00065 };
00066 
00068 struct MQuestLevelItem
00069 {
00070     unsigned long int   nItemID;        
00071     bool                bObtained;      
00072     MQuestLevelItem() : nItemID(0), bObtained(false) {}
00073 };
00074 
00076 class MQuestLevelItemMap : public multimap<unsigned long int, MQuestLevelItem*>
00077 {
00078 public:
00079     MQuestLevelItemMap() {}
00080     ~MQuestLevelItemMap() { Clear(); }
00081     void Clear()
00082     {
00083         for (iterator itor = begin(); itor != end(); ++itor)
00084         {
00085             delete (*itor).second;
00086         }
00087         clear();
00088     }
00089 };
00090 
00091 
00093 struct MQuestLevelDynamicInfo
00094 {
00095     int                     nCurrSectorIndex;                               
00096     MQuestMapSectorInfo*    pCurrSector;                                    
00097     int                     nQLD;                                           
00098     MQuestLevelItemMap      ItemMap;                                        
00099 
00100     MQuestLevelDynamicInfo()
00101     {
00102         nCurrSectorIndex = 0;
00103         pCurrSector = NULL;
00104         nQLD = 0;
00105     }
00106 };
00107 
00108 
00110 class MQuestLevel
00111 {
00112 private:
00114     struct MQuestLevelSpawnInfo
00115     {
00116         int                 nIndex;                             
00117         unsigned long int   nRecentSpawnTime[MAX_SPAWN_COUNT];  
00118     };
00119 
00120     MQuestLevelStaticInfo       m_StaticInfo;                   
00121     MQuestLevelDynamicInfo      m_DynamicInfo;                  
00122     MQuestNPCQueue              m_NPCQueue;                     
00123 
00124     MQuestLevelSpawnInfo        m_SpawnInfos[MNST_END];         
00125 
00126     bool InitSectors();
00127     bool InitNPCs();                                            
00128     void InitStaticInfo();
00129     void InitCurrSector();
00130 
00131 public:
00132     MQuestLevel();                      
00133     ~MQuestLevel();                     
00134 
00137     void Init(int nScenarioID);
00139     void Make_MTDQuestGameInfo(MTD_QuestGameInfo* pout);
00142     int GetMapSectorCount();
00145     int GetCurrSectorIndex();
00148     bool MoveToNextSector();    
00152     int GetRecommendedSpawnPosition(MQuestNPCSpawnType nSpawnType, unsigned long int nNowTime);
00156     bool IsEnableSpawnNow(MQuestNPCSpawnType nSpawnType, unsigned long int nNowTime);
00159     int GetSpawnPositionCount(MQuestNPCSpawnType nSpawnType);
00160 
00163     void OnItemCreated(unsigned long int    nItemID);       
00166     bool OnItemObtained(unsigned long int   nItemID);       
00167 
00168     MQuestNPCQueue* GetNPCQueue()               { return &m_NPCQueue; }
00169     MQuestLevelStaticInfo* GetStaticInfo()      { return &m_StaticInfo; }
00170     MQuestLevelDynamicInfo* GetDynamicInfo()    { return &m_DynamicInfo; }
00171 };
00172 
00173 
00174 
00175 
00176 
00177 
00178 #endif


MAIET entertainment