forked from metin2/client
101 lines
2.4 KiB
C++
101 lines
2.4 KiB
C++
|
#include "StdAfx.h"
|
|||
|
#include "MapBase.h"
|
|||
|
|
|||
|
CMapBase::CMapBase()
|
|||
|
{
|
|||
|
Clear();
|
|||
|
}
|
|||
|
|
|||
|
CMapBase::~CMapBase()
|
|||
|
{
|
|||
|
Clear();
|
|||
|
}
|
|||
|
|
|||
|
void CMapBase::Clear()
|
|||
|
{
|
|||
|
m_strName = "";
|
|||
|
m_eType = MAPTYPE_INVALID;
|
|||
|
mc_pEnvironmentData = NULL;
|
|||
|
Leave();
|
|||
|
}
|
|||
|
|
|||
|
bool CMapBase::Enter()
|
|||
|
{
|
|||
|
m_bReady = true;
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
bool CMapBase::Leave()
|
|||
|
{
|
|||
|
m_bReady = false;
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
void CMapBase::SetEnvironmentDataPtr(const TEnvironmentData * c_pEnvironmentData)
|
|||
|
{
|
|||
|
mc_pEnvironmentData = c_pEnvironmentData;
|
|||
|
OnSetEnvironmentDataPtr();
|
|||
|
}
|
|||
|
|
|||
|
void CMapBase::ResetEnvironmentDataPtr(const TEnvironmentData * c_pEnvironmentData)
|
|||
|
{
|
|||
|
mc_pEnvironmentData = c_pEnvironmentData;
|
|||
|
OnResetEnvironmentDataPtr();
|
|||
|
}
|
|||
|
|
|||
|
void CMapBase::Render()
|
|||
|
{
|
|||
|
if (IsReady())
|
|||
|
OnRender();
|
|||
|
}
|
|||
|
|
|||
|
bool CMapBase::LoadProperty()
|
|||
|
{
|
|||
|
std::string strFileName = GetName() + "\\MapProperty.txt";
|
|||
|
|
|||
|
CTokenVectorMap stTokenVectorMap;
|
|||
|
|
|||
|
if (!LoadMultipleTextData(strFileName.c_str(), stTokenVectorMap))
|
|||
|
{
|
|||
|
TraceError("CMapBase::LoadProperty(FileName=%s) - LoadMultipleTextData ERROR <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.", strFileName.c_str());
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
if (stTokenVectorMap.end() == stTokenVectorMap.find("scripttype"))
|
|||
|
{
|
|||
|
TraceError("CMapBase::LoadProperty(FileName=%s) - FIND 'scripttype' - FAILED", strFileName.c_str());
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
if (stTokenVectorMap.end() == stTokenVectorMap.find("maptype"))
|
|||
|
{
|
|||
|
TraceError("CMapBase::LoadProperty(FileName=%s) - FIND 'maptype' - FAILED", strFileName.c_str());
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
// NOTE: <20>̹<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><>, <20><> <20><><EFBFBD><EFBFBD> <20>뷮<EFBFBD><EBB7AE> <20><><EFBFBD>̱<EFBFBD> <20><><EFBFBD><EFBFBD> <20>۾<EFBFBD>.
|
|||
|
// MapProperty.txt <20><><EFBFBD>Ͽ<EFBFBD> ParentMapName <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD> <20>ִٸ<D6B4>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD> ParentMap<61><70><EFBFBD><EFBFBD> <20>о<EFBFBD><D0BE>´<EFBFBD>.
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>κа<CEBA><D0B0><EFBFBD>(<28>κ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ?) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʿ<EFBFBD> <20><><EFBFBD>뼭, Parent Map<61><70><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>о<EFBFBD><D0BE><EFBFBD>.
|
|||
|
if (stTokenVectorMap.end() != stTokenVectorMap.find("parentmapname"))
|
|||
|
{
|
|||
|
m_strParentMapName = stTokenVectorMap["parentmapname"][0];
|
|||
|
}
|
|||
|
|
|||
|
const std::string & c_rstrType = stTokenVectorMap["scripttype"][0];
|
|||
|
const std::string & c_rstrMapType = stTokenVectorMap["maptype"][0];
|
|||
|
|
|||
|
if (0 != c_rstrType.compare("MapProperty"))
|
|||
|
{
|
|||
|
TraceError("CMapBase::LoadProperty(FileName=%s) - Resourse Type ERROR", strFileName.c_str());
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
if (0 == c_rstrMapType.compare("Indoor"))
|
|||
|
SetType(MAPTYPE_INDOOR);
|
|||
|
else if (0 == c_rstrMapType.compare("Outdoor"))
|
|||
|
SetType(MAPTYPE_OUTDOOR);
|
|||
|
else if (0 == c_rstrMapType.compare("Invalid"))
|
|||
|
SetType(MAPTYPE_OUTDOOR);
|
|||
|
|
|||
|
return true;
|
|||
|
}
|