diff --git a/engine/qclib/qcc_pr_lex.c b/engine/qclib/qcc_pr_lex.c index f51d00ab2..49359ccee 100644 --- a/engine/qclib/qcc_pr_lex.c +++ b/engine/qclib/qcc_pr_lex.c @@ -6095,6 +6095,50 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail) } } } + + + /* iterate over every parent-class and see if our method already exists in conflicting nonvirtual type form */ + if (isvirt) + { + for(pc = newt; pc && !found; pc = pc->parentclass) + { + struct QCC_typeparam_s *pp; + int numpc; + int i; + found = false; + + if (pc == newt) + continue; + + pp = parms; + numpc = numparms; + + /* iterate over all of the virtual methods */ + for (i = 0; i < numpc; i++) + { + if (pp[i].type->type == newparm->type) + { + /* if we found it, abandon this loop - we still have to check the other classes however */ + if (!strcmp(pp[i].paramname, parmname)) + { + found = true; + break; + } + } + } + + /* we didn't find it as a field... so check if it exists as a nonvirtual method */ + if (found == false) + { + QC_snprintfz(membername, sizeof(membername), "%s::%s", pc->name, parmname); + + /* if we found it, game over */ + if (QCC_PR_GetDef(NULL, membername, NULL, false, 0, 0)) + QCC_PR_ParseError(0, "%s defined as virtual in %s, but nonvirtual in %s\n", parmname, newt->name, pc->name); + } + } + } + parms[numparms].ofs = basicindex; //ulp, its new numparms++;