mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-04-25 01:40:55 +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
748b1a6f66
commit
f2ef270042
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);
|
sym->Variants[0].Implementation->DefaultArgs = std::move(argdefaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PClass *clstype = static_cast<PClass *>(c->Type());
|
||||||
if (varflags & VARF_Virtual)
|
if (varflags & VARF_Virtual)
|
||||||
{
|
{
|
||||||
if (sym->Variants[0].Implementation == nullptr)
|
if (sym->Variants[0].Implementation == nullptr)
|
||||||
|
@ -2349,7 +2350,6 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
||||||
}
|
}
|
||||||
if (forclass)
|
if (forclass)
|
||||||
{
|
{
|
||||||
PClass *clstype = static_cast<PClass *>(c->Type());
|
|
||||||
int vindex = clstype->FindVirtualIndex(sym->SymbolName, sym->Variants[0].Proto);
|
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.
|
// specifying 'override' is necessary to prevent one of the biggest problem spots with virtual inheritance: Mismatching argument types.
|
||||||
if (varflags & VARF_Override)
|
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");
|
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;
|
Loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Use (bool pickup)
|
override bool Use (bool pickup)
|
||||||
{
|
{
|
||||||
Playerinfo p = Owner.player;
|
Playerinfo p = Owner.player;
|
||||||
if (p && p.morphTics && (p.MorphStyle & MRF_UNDOBYTOMEOFPOWER))
|
if (p && p.morphTics && (p.MorphStyle & MRF_UNDOBYTOMEOFPOWER))
|
||||||
|
|
|
@ -220,7 +220,7 @@ class Ripper : Actor
|
||||||
Stop;
|
Stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoSpecialDamage (Actor target, int damage, Name damagetype)
|
override int DoSpecialDamage (Actor target, int damage, Name damagetype)
|
||||||
{
|
{
|
||||||
if (target is "Ironlich")
|
if (target is "Ironlich")
|
||||||
{ // Less damage to Ironlich bosses
|
{ // 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)
|
if (target.player && Random[PhoenixFX2]() < 128)
|
||||||
{ // Freeze player for a bit
|
{ // Freeze player for a bit
|
||||||
|
|
|
@ -402,7 +402,7 @@ class RainPillar : Actor
|
||||||
|
|
||||||
// Rain pillar 1 ------------------------------------------------------------
|
// Rain pillar 1 ------------------------------------------------------------
|
||||||
|
|
||||||
int DoSpecialDamage (Actor target, int damage, Name damagetype)
|
override int DoSpecialDamage (Actor target, int damage, Name damagetype)
|
||||||
{
|
{
|
||||||
if (target.bBoss)
|
if (target.bBoss)
|
||||||
{ // Decrease damage for bosses
|
{ // Decrease damage for bosses
|
||||||
|
|
|
@ -112,7 +112,7 @@ class Heresiarch : Actor
|
||||||
Stop;
|
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
|
// The heresiarch just executes a script instead of a special upon death
|
||||||
int script = special;
|
int script = special;
|
||||||
|
|
|
@ -28,7 +28,7 @@ class FadeSetter : Actor
|
||||||
RenderStyle "None";
|
RenderStyle "None";
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostBeginPlay()
|
override void PostBeginPlay()
|
||||||
{
|
{
|
||||||
Super.PostBeginPlay();
|
Super.PostBeginPlay();
|
||||||
CurSector.SetFade(color(args[0], args[1], args[2]));
|
CurSector.SetFade(color(args[0], args[1], args[2]));
|
||||||
|
|
|
@ -241,7 +241,7 @@ class PhosphorousFire : Actor
|
||||||
Stop;
|
Stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoSpecialDamage (Actor target, int damage, Name damagetype)
|
override int DoSpecialDamage (Actor target, int damage, Name damagetype)
|
||||||
{
|
{
|
||||||
if (target.bNoBlood)
|
if (target.bNoBlood)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue