diff --git a/bot/gamemodes.cpp b/bot/gamemodes.cpp index 2927dbf..a47b08b 100644 --- a/bot/gamemodes.cpp +++ b/bot/gamemodes.cpp @@ -1,6 +1,7 @@ #include "main.h" +int AMXAPI aux_LoadProgram(AMX* amx, char* filename); void AMXPrintError(CGameMode* pGameMode, AMX *amx, int error); char szGameModeFileName[256]; @@ -22,6 +23,31 @@ CGameMode::~CGameMode() //---------------------------------------------------------------------------------- +bool CGameMode::Load(char* pFileName) +{ + if (m_bInitialised) + Unload(); + + FILE* f = fopen(pFileName, "rb"); + if (!f) return false; + fclose(f); + + memset((void*)&m_amx, 0, sizeof(AMX)); + m_fSleepTime = 0.0f; + strcpy(szGameModeFileName, pFileName); + + int err = aux_LoadProgram(&m_amx, szGameModeFileName); + if (err != AMX_ERR_NONE) + { + AMXPrintError(this, &m_amx, err); + return false; + } + + return false; +} + +//---------------------------------------------------------------------------------- + void CGameMode::Unload() { // TODO: CGameMode::Unload diff --git a/bot/gamemodes.h b/bot/gamemodes.h index 4c4389e..9c6221b 100644 --- a/bot/gamemodes.h +++ b/bot/gamemodes.h @@ -20,6 +20,7 @@ public: char* GetFileName() { return &szGameModeFileName[0]; }; + bool Load(char* pFileName); void Unload(); void Frame(float fElapsedTime);