core/sourcemod.cpp
changeset 484 d254e257cac2
parent 448 25984ddd0ce0
child 496 a16c05dcf584
     1.1 --- a/core/sourcemod.cpp	Tue Feb 13 06:26:01 2007 +0000
     1.2 +++ b/core/sourcemod.cpp	Tue Feb 13 16:11:04 2007 +0000
     1.3 @@ -226,7 +226,7 @@
     1.4  	}
     1.5  }
     1.6  
     1.7 -bool SourceModBase::IsMapLoading()
     1.8 +bool SourceModBase::IsMapLoading() const
     1.9  {
    1.10  	return m_IsMapLoading;
    1.11  }
    1.12 @@ -296,6 +296,16 @@
    1.13  		pBase = pBase->m_pGlobalClassNext;
    1.14  	}
    1.15  
    1.16 +	/* Delete all data packs */
    1.17 +	CStack<CDataPack *>::iterator iter;
    1.18 +	CDataPack *pd;
    1.19 +	for (iter=m_freepacks.begin(); iter!=m_freepacks.end(); iter++)
    1.20 +	{
    1.21 +		pd = (*iter);
    1.22 +		delete pd;
    1.23 +	}
    1.24 +	m_freepacks.popall();
    1.25 +
    1.26  	/* Notify! */
    1.27  	pBase = SMGlobalClass::head;
    1.28  	while (pBase)
    1.29 @@ -361,12 +371,12 @@
    1.30  	return atcprintf(buffer, maxlength, fmt, pContext, params, &lparam);
    1.31  }
    1.32  
    1.33 -const char *SourceModBase::GetSourceModPath()
    1.34 +const char *SourceModBase::GetSourceModPath() const
    1.35  {
    1.36  	return m_SMBaseDir;
    1.37  }
    1.38  
    1.39 -const char *SourceModBase::GetModPath()
    1.40 +const char *SourceModBase::GetModPath() const
    1.41  {
    1.42  	return g_BaseDir.c_str();
    1.43  }
    1.44 @@ -386,6 +396,31 @@
    1.45  	return m_target;
    1.46  }
    1.47  
    1.48 +IDataPack *SourceModBase::CreateDataPack()
    1.49 +{
    1.50 +	CDataPack *pack;
    1.51 +	if (m_freepacks.empty())
    1.52 +	{
    1.53 +		pack = new CDataPack;
    1.54 +	} else {
    1.55 +		pack = m_freepacks.front();
    1.56 +		m_freepacks.pop();
    1.57 +		pack->Initialize();
    1.58 +	}
    1.59 +	return pack;
    1.60 +}
    1.61 +
    1.62 +void SourceModBase::FreeDataPack(IDataPack *pack)
    1.63 +{
    1.64 +	m_freepacks.push(static_cast<CDataPack *>(pack));
    1.65 +}
    1.66 +
    1.67 +Handle_t SourceModBase::GetDataPackHandleType(bool readonly)
    1.68 +{
    1.69 +	//:TODO:
    1.70 +	return 0;
    1.71 +}
    1.72 +
    1.73  SMGlobalClass *SMGlobalClass::head = NULL;
    1.74  
    1.75  SMGlobalClass::SMGlobalClass()