mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 22:47:29 +08:00
[bot] Add CGameMode::Load(...)
This commit is contained in:
parent
089ff5df25
commit
1bdaff6125
@ -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
|
||||
|
@ -20,6 +20,7 @@ public:
|
||||
|
||||
char* GetFileName() { return &szGameModeFileName[0]; };
|
||||
|
||||
bool Load(char* pFileName);
|
||||
void Unload();
|
||||
|
||||
void Frame(float fElapsedTime);
|
||||
|
Loading…
Reference in New Issue
Block a user