minor changes

This commit is contained in:
Pavol Marko 2004-09-04 18:31:59 +00:00
parent de30d647d4
commit 8df987cf95
3 changed files with 11 additions and 20 deletions

View File

@ -522,19 +522,11 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
char *outptr = outbuf; char *outptr = outbuf;
cell *src = get_amxaddr(amx, params[parm++]); cell *src = get_amxaddr(amx, params[parm++]);
enum State
{
S_Normal,
S_PercentSign,
};
State curState = S_Normal;
while (*src) while (*src)
{ {
if (*src == '%' && curState == S_Normal) if (*src == '%')
curState = S_PercentSign;
else if (curState == S_PercentSign)
{ {
++src;
if (*src=='L') if (*src=='L')
{ {
cell langName = params[parm]; // "en" case (langName contains the address to the string) cell langName = params[parm]; // "en" case (langName contains the address to the string)
@ -592,7 +584,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
if (*def == '%') if (*def == '%')
{ {
++def; ++def;
char format[32]; static char format[32];
format[0] = '%'; format[0] = '%';
char *ptr = format+1; char *ptr = format+1;
while (ptr-format<sizeof(format) && !isalpha(*ptr++ = *def++)) while (ptr-format<sizeof(format) && !isalpha(*ptr++ = *def++))
@ -604,7 +596,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
{ {
case 's': case 's':
{ {
char tmpString[4096]; static char tmpString[4096];
char *tmpPtr = tmpString; char *tmpPtr = tmpString;
NEXT_PARAM(); NEXT_PARAM();
cell *tmpCell = get_amxaddr(amx, params[parm++]); cell *tmpCell = get_amxaddr(amx, params[parm++]);
@ -676,7 +668,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
} }
else else
{ {
char tmpString[4096]; static char tmpString[4096];
char *tmpPtr = tmpString; char *tmpPtr = tmpString;
int tmpLen = 0; int tmpLen = 0;
char format[32]; char format[32];
@ -730,7 +722,6 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
*outptr++ = '%'; *outptr++ = '%';
} }
} }
curState = S_Normal;
} }
else else
{ {

View File

@ -157,7 +157,6 @@ extern XVars g_xvars;
extern bool g_bmod_cstrike; extern bool g_bmod_cstrike;
extern bool g_bmod_dod; extern bool g_bmod_dod;
extern bool g_dontprecache; extern bool g_dontprecache;
extern bool g_initialized;
extern int g_srvindex; extern int g_srvindex;
extern cvar_t* amxmodx_version; extern cvar_t* amxmodx_version;
extern cvar_t* hostname; extern cvar_t* hostname;

View File

@ -81,7 +81,6 @@ bool g_bmod_dod;
bool g_dontprecache; bool g_dontprecache;
bool g_forcedmodules; bool g_forcedmodules;
bool g_forcedsounds; bool g_forcedsounds;
bool g_initialized;
fakecmd_t g_fakecmd; fakecmd_t g_fakecmd;
float g_game_restarting; float g_game_restarting;
float g_game_timeleft; float g_game_timeleft;
@ -200,9 +199,6 @@ const char* get_localinfo( const char* name , const char* def )
// Call precache forward function from plugins // Call precache forward function from plugins
int C_Spawn( edict_t *pent ) { int C_Spawn( edict_t *pent ) {
if ( g_initialized ) RETURN_META_VALUE(MRES_IGNORED, 0);
g_initialized = true;
g_forcedmodules = false; g_forcedmodules = false;
g_forcedsounds = false; g_forcedsounds = false;
@ -299,6 +295,9 @@ int C_Spawn( edict_t *pent ) {
} }
// HACKHACK:
// Make sure this function wont be called anymore
g_FakeMeta.m_Plugins.begin()->GetDllFuncTable().pfnSpawn = NULL;
RETURN_META_VALUE(MRES_IGNORED, 0); RETURN_META_VALUE(MRES_IGNORED, 0);
} }
@ -440,7 +439,9 @@ void C_ServerDeactivate() {
// However leave AMX modules which are loaded only once // However leave AMX modules which are loaded only once
void C_ServerDeactivate_Post() { void C_ServerDeactivate_Post() {
g_initialized = false; // HACKHACK:
// Make sure the spawn function will be called again
g_FakeMeta.m_Plugins.begin()->GetDllFuncTable().pfnSpawn = C_Spawn;
detachReloadModules(); detachReloadModules();