//============================================================================================================================= /// SharedFieldInfo class /** @author Kim Min Wook < taiyo@webzen.co.kr > @since 2006. 2. 24 @purpose - *.mapÀÇ Á¤º¸¸¦ ·ÎµåÇÏ¿© °ÔÀÓ Àüü¿¡ °øÀ¯µÇ´Â Çʵå Á¤º¸ Ŭ·¡½º */ //============================================================================================================================= #pragma once #include #include #include #include <3DEngine/Common/BoundingVolume.h> #include #include typedef STLX_HASH_MAP MAPOBJECT_INFO_HASH; typedef MAPOBJECT_INFO_HASH::iterator MAPOBJECT_INFO_HASH_IT; typedef std::pair MAPOBJECT_INFO_PAIR; class SharedFieldInfo { enum { _MAX_MAPOBJECT_INFO_NUM = 100 }; public: SharedFieldInfo(void); ~SharedFieldInfo(void); BOOL Create( FIELDCODE fieldcode , const char* field_path , FIELDCODE wmocode , BOOL bNewPathEngine , BOOL bWarCastle ); VOID Destroy(); inline DWORD GetRandomStartingTileIndex( BYTE byClass ); inline BOOL CheckMapVersion( DWORD dwCheckSum ); inline TriggerGroupInfo* GetTriggerGroupInfo( const TCHAR * pszGroupName ); inline CWorldBase* GetWorldBase() { return m_pWorldBase; } inline MAPOBJECT_INFO_HASH& GetMapObjectInfoHashTable() { return m_MapObjectInfoHash; } inline MAPOBJECT_INFO* FindMapObjectInfo( DWORD dwObjectID ) { MAPOBJECT_INFO_HASH_IT it = m_MapObjectInfoHash.find(dwObjectID); if( it != m_MapObjectInfoHash.end() ) return it->second; return NULL; } inline BOOL IsNewPathEngine() { return m_bNewPathEngine; } inline BOOL IsWarCastle() { return m_bWarCastle; } // (f100623.1L) cache for checksums const EngineFileChecksum& GetFileChecksum() const { return checksums_; } protected: BOOL _Load( const char * field_path ); BOOL _Serialize_WMO( CWzArchive & archive ); BOOL _LoadMapObjectInfo( const char * pszFilePath ); BOOL _LoadPathEngineCollision( char * pszFileName ); VOID _SerializeMapObjectAll( CWzArchive & archive ); VOID _SetStartingTileIndex(); VOID _SetCRStartingTileIndex(); VOID _UnloadMapObjectInfo(); VOID _CheckVersionBetweenMapWmo( DWORD MapVersion, DWORD WmoVersion ); private: __PROPERTY( FIELDCODE, Code ); __PROPERTY( FIELDCODE, WMOCode ); __PROPERTY( WORD, Version ); CWorldBase* m_pWorldBase; MAPOBJECT_INFO_HASH m_MapObjectInfoHash; STLX_VECTOR m_StartTiles; STLX_VECTOR m_CR1StartTiles; STLX_VECTOR m_CR2StartTiles; INT m_LastUsedRoomIndex; friend class nsAI::MovingPlanner; BOOL m_bNewPathEngine; BOOL m_bWarCastle; // (f100623.1L) cache for checksums EngineFileChecksum checksums_; TriggerInfoManager m_TriggerInfoManager; TCHAR m_tszMapPath[MAX_PATH]; TCHAR m_tszWmoPath[MAX_PATH]; }; // // byClass == 0 ÀÌ¸é ¸ðµç ij¸¯ÅÍ Village inline DWORD SharedFieldInfo::GetRandomStartingTileIndex( BYTE byClass ) { const DWORD dwCR1 = (1< byClass ) { STLX_VECTOR* pStartTiles = NULL; DWORD dwBitField = (1<empty() ) { SUNLOG( eCRITICAL_LOG, "Warning:[FieldCode:%d][Class:%d]m_StartTiles == 0\n", m_Code, byClass ); return 0; } random_shuffle( pStartTiles->begin(), pStartTiles->end() ); return *(pStartTiles->begin()); } return 0; } inline TriggerGroupInfo* SharedFieldInfo::GetTriggerGroupInfo( const TCHAR * pszGroupName ) { return m_TriggerInfoManager.FindTriggerGruopInfo( pszGroupName ); } inline BOOL SharedFieldInfo::CheckMapVersion( DWORD dwCheckSum ) { if( m_pWorldBase->GetCheckSum() != dwCheckSum ) { return FALSE; } else { if( 0 == dwCheckSum ) //< 0ÀÎ °æ¿ì´Â ±¸¹öÀü ¸Ê!! return FALSE; } return TRUE; }