mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-22 20:11:17 +00:00
- fixed: The check for virtual function overrides was never done if the overriding function had no qualifier at all.
- fixed several occurences where an 'override' qualifier was missing.
This commit is contained in:
parent
abdfb8788b
commit
7a5171a2e9
8 changed files with 16 additions and 8 deletions
|
@ -2336,6 +2336,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
sym->Variants[0].Implementation->DefaultArgs = std::move(argdefaults);
|
||||
}
|
||||
|
||||
PClass *clstype = static_cast<PClass *>(c->Type());
|
||||
if (varflags & VARF_Virtual)
|
||||
{
|
||||
if (sym->Variants[0].Implementation == nullptr)
|
||||
|
@ -2349,7 +2350,6 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
}
|
||||
if (forclass)
|
||||
{
|
||||
PClass *clstype = static_cast<PClass *>(c->Type());
|
||||
int vindex = clstype->FindVirtualIndex(sym->SymbolName, sym->Variants[0].Proto);
|
||||
// specifying 'override' is necessary to prevent one of the biggest problem spots with virtual inheritance: Mismatching argument types.
|
||||
if (varflags & VARF_Override)
|
||||
|
@ -2383,6 +2383,14 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
Error(p, "Virtual functions can only be defined for classes");
|
||||
}
|
||||
}
|
||||
else if (forclass)
|
||||
{
|
||||
int vindex = clstype->FindVirtualIndex(sym->SymbolName, sym->Variants[0].Proto);
|
||||
if (vindex != -1)
|
||||
{
|
||||
Error(f, "Function %s attempts to override parent function without 'override' qualifier", FName(f->Name).GetChars());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ Class ArtiTomeOfPower : PowerupGiver
|
|||
Loop;
|
||||
}
|
||||
|
||||
bool Use (bool pickup)
|
||||
override bool Use (bool pickup)
|
||||
{
|
||||
Playerinfo p = Owner.player;
|
||||
if (p && p.morphTics && (p.MorphStyle & MRF_UNDOBYTOMEOFPOWER))
|
||||
|
|
|
@ -220,7 +220,7 @@ class Ripper : Actor
|
|||
Stop;
|
||||
}
|
||||
|
||||
int DoSpecialDamage (Actor target, int damage, Name damagetype)
|
||||
override int DoSpecialDamage (Actor target, int damage, Name damagetype)
|
||||
{
|
||||
if (target is "Ironlich")
|
||||
{ // Less damage to Ironlich bosses
|
||||
|
|
|
@ -311,7 +311,7 @@ class PhoenixFX2 : Actor
|
|||
}
|
||||
|
||||
|
||||
int DoSpecialDamage (Actor target, int damage, Name damagetype)
|
||||
override int DoSpecialDamage (Actor target, int damage, Name damagetype)
|
||||
{
|
||||
if (target.player && Random[PhoenixFX2]() < 128)
|
||||
{ // Freeze player for a bit
|
||||
|
|
|
@ -402,7 +402,7 @@ class RainPillar : Actor
|
|||
|
||||
// Rain pillar 1 ------------------------------------------------------------
|
||||
|
||||
int DoSpecialDamage (Actor target, int damage, Name damagetype)
|
||||
override int DoSpecialDamage (Actor target, int damage, Name damagetype)
|
||||
{
|
||||
if (target.bBoss)
|
||||
{ // Decrease damage for bosses
|
||||
|
|
|
@ -112,7 +112,7 @@ class Heresiarch : Actor
|
|||
Stop;
|
||||
}
|
||||
|
||||
void Die (Actor source, Actor inflictor, int dmgflags)
|
||||
override void Die (Actor source, Actor inflictor, int dmgflags)
|
||||
{
|
||||
// The heresiarch just executes a script instead of a special upon death
|
||||
int script = special;
|
||||
|
|
|
@ -28,7 +28,7 @@ class FadeSetter : Actor
|
|||
RenderStyle "None";
|
||||
}
|
||||
|
||||
void PostBeginPlay()
|
||||
override void PostBeginPlay()
|
||||
{
|
||||
Super.PostBeginPlay();
|
||||
CurSector.SetFade(color(args[0], args[1], args[2]));
|
||||
|
|
|
@ -241,7 +241,7 @@ class PhosphorousFire : Actor
|
|||
Stop;
|
||||
}
|
||||
|
||||
int DoSpecialDamage (Actor target, int damage, Name damagetype)
|
||||
override int DoSpecialDamage (Actor target, int damage, Name damagetype)
|
||||
{
|
||||
if (target.bNoBlood)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue