diff -r 2c214830d01c -r d254e257cac2 core/sourcemod.cpp --- a/core/sourcemod.cpp Tue Feb 13 06:26:01 2007 +0000 +++ b/core/sourcemod.cpp Tue Feb 13 16:11:04 2007 +0000 @@ -226,7 +226,7 @@ } } -bool SourceModBase::IsMapLoading() +bool SourceModBase::IsMapLoading() const { return m_IsMapLoading; } @@ -296,6 +296,16 @@ pBase = pBase->m_pGlobalClassNext; } + /* Delete all data packs */ + CStack::iterator iter; + CDataPack *pd; + for (iter=m_freepacks.begin(); iter!=m_freepacks.end(); iter++) + { + pd = (*iter); + delete pd; + } + m_freepacks.popall(); + /* Notify! */ pBase = SMGlobalClass::head; while (pBase) @@ -361,12 +371,12 @@ return atcprintf(buffer, maxlength, fmt, pContext, params, &lparam); } -const char *SourceModBase::GetSourceModPath() +const char *SourceModBase::GetSourceModPath() const { return m_SMBaseDir; } -const char *SourceModBase::GetModPath() +const char *SourceModBase::GetModPath() const { return g_BaseDir.c_str(); } @@ -386,6 +396,31 @@ return m_target; } +IDataPack *SourceModBase::CreateDataPack() +{ + CDataPack *pack; + if (m_freepacks.empty()) + { + pack = new CDataPack; + } else { + pack = m_freepacks.front(); + m_freepacks.pop(); + pack->Initialize(); + } + return pack; +} + +void SourceModBase::FreeDataPack(IDataPack *pack) +{ + m_freepacks.push(static_cast(pack)); +} + +Handle_t SourceModBase::GetDataPackHandleType(bool readonly) +{ + //:TODO: + return 0; +} + SMGlobalClass *SMGlobalClass::head = NULL; SMGlobalClass::SMGlobalClass()