for (i = 0;i < PRVM_PROG_MAX;i++)
{
prog = &prvm_prog_list[i];
- if (prog->loaded && var->globaldefindex_progid[i] == prog->id)
+ if (prog->loaded && var->globaldefindex_progid[i] == prog->id && var->globaldefindex[i] >= 0)
return true;
}
return false;
for (i = 0;i < PRVM_PROG_MAX;i++)
{
prog = &prvm_prog_list[i];
- if (prog->loaded && var->globaldefindex_progid[i] == prog->id)
+ if (prog->loaded && var->globaldefindex_progid[i] == prog->id && var->globaldefindex[i] >= 0)
{
// MUST BE SYNCED WITH prvm_edict.c PRVM_LoadProgs
switch(prog->globaldefs[var->globaldefindex[i]].type & ~DEF_SAVEGLOBAL)
unsigned int d;
char vabuf[1024];
char vabuf2[1024];
+ cvar_t *cvar;
if (prog->loaded)
prog->error_cmd("PRVM_LoadProgs: there is already a %s program loaded!", prog->name );
}
}
+ for (cvar = cvar_vars; cvar; cvar = cvar->next)
+ cvar->globaldefindex[prog - prvm_prog_list] = -1;
+
for (i=0 ; i<prog->numglobaldefs ; i++)
{
const char *name;
)
{
prvm_eval_t *val = PRVM_GLOBALFIELDVALUE(prog->globaldefs[i].ofs);
- cvar_t *cvar = Cvar_FindVar(name + 9);
+ cvar = Cvar_FindVar(name + 9);
//Con_Printf("PRVM_LoadProgs: autocvar global %s in %s, processing...\n", name, prog->name);
if(!cvar)
{