Don't waste qc field space if the field is doubly-declared.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4362 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
60859bbc9f
commit
fe6704dacb
1 changed files with 27 additions and 3 deletions
|
@ -9920,10 +9920,34 @@ void QCC_PR_ParseDefs (char *classname)
|
|||
if (def->constant)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < type->size*(arraysize?arraysize:1); i++) //make arrays of fields work.
|
||||
*(int *)&qcc_pr_globals[def->ofs+i] = pr.size_fields+i;
|
||||
//if the field already has a value, don't allocate new field space for it as that would confuse things.
|
||||
//otherwise allocate new space.
|
||||
if (*(int *)&qcc_pr_globals[def->ofs])
|
||||
{
|
||||
for (i = 0; i < type->size*(arraysize?arraysize:1); i++) //make arrays of fields work.
|
||||
{
|
||||
if (*(int *)&qcc_pr_globals[def->ofs+i] != i + *(int *)&qcc_pr_globals[def->ofs])
|
||||
{
|
||||
QCC_PR_ParseWarning(0, "Inconsistant field def:");
|
||||
QCC_PR_ParsePrintDef(0, def);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < type->size*(arraysize?arraysize:1); i++) //make arrays of fields work.
|
||||
{
|
||||
if (*(int *)&qcc_pr_globals[def->ofs+i])
|
||||
{
|
||||
QCC_PR_ParseWarning(0, "Field def already has a value:");
|
||||
QCC_PR_ParsePrintDef(0, def);
|
||||
}
|
||||
*(int *)&qcc_pr_globals[def->ofs+i] = pr.size_fields+i;
|
||||
}
|
||||
|
||||
pr.size_fields += i;
|
||||
pr.size_fields += i;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue