- fixed a bug where CS:S Tools could be loaded more than once on mapchange

- fixed a bug where Core did not interpet some file paths properly
- fixed a crash bug where SourceMod could pass invalid data to ISmmAPI on shutdown

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401514
This commit is contained in:
David Anderson 2007-10-01 18:04:37 +00:00
parent 93e34b17a6
commit 4c4b89a403
2 changed files with 10 additions and 6 deletions

View File

@ -124,11 +124,13 @@ bool CExtension::Load(char *error, size_t maxlength)
CExtension::~CExtension() CExtension::~CExtension()
{ {
char temp_buffer[255];
if (m_pAPI) if (m_pAPI)
{ {
if (m_PlId) if (m_PlId)
{ {
g_pMMPlugins->Unload(m_PlId, true, NULL, 0); g_pMMPlugins->Unload(m_PlId, true, temp_buffer, sizeof(temp_buffer));
} }
} }
@ -435,14 +437,16 @@ IExtension *CExtensionManager::FindExtensionByFile(const char *file)
return FindExtensionByFile(path); return FindExtensionByFile(path);
} }
/* Make sure the file direction is right */ /* Chomp off the path */
char path[PLATFORM_MAX_PATH]; char lookup[PLATFORM_MAX_PATH];
g_LibSys.PathFormat(path, sizeof(path), "%s", file); g_LibSys.GetFileFromPath(lookup, sizeof(lookup), file);
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++) for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{ {
pExt = (*iter); pExt = (*iter);
if (strcmp(pExt->GetFilename(), path) == 0) char short_file[PLATFORM_MAX_PATH];
g_LibSys.GetFileFromPath(short_file, sizeof(short_file), pExt->GetFilename());
if (strcmp(lookup, short_file) == 0)
{ {
return pExt; return pExt;
} }

View File

@ -381,7 +381,7 @@ size_t LibrarySystem::GetFileFromPath(char *buffer, size_t maxlength, const char
for (size_t i = length - 1; for (size_t i = length - 1;
i >= 0 && i <= length - 1; i >= 0 && i <= length - 1;
i++) i--)
{ {
if (path[i] == '/' if (path[i] == '/'
#if defined PLATFORM_WINDOWS #if defined PLATFORM_WINDOWS