[since 4.4.0] Global constant has priority over local scope

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
m8f
 
 
Posts: 1445
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Location: Siberia (UTC+7)
Contact:

[since 4.4.0] Global constant has priority over local scope

Post by m8f »

Steps to reproduce:
  1. Load global-shadow.pk3.
    global-shadow.pk3
    (306 Bytes) Downloaded 23 times
  2. Start a new game.
  3. summon global_shadow.
Expected result: console prints "Teleport 1" (this the result is for GZDoom ... - 4.3.3).
Actual result: console prints "Teleport 70" (this is the result for GZDoom 4.4.0 - 4.4.2).

global-shadow.pk3 contents:

Code: Select all

// zscript.zs
version "3.0"

class global_shadow : DoomImp
{
  enum E
  {
    teleport = 1
  }

  override
  void BeginPlay()
  {
    Console.Printf("Teleport: %d", teleport);
  }
}
Teleport is a global constant defined in playsim/actionspecials.h. Before 4.4.0, the value from enum has priority over that global constant. Starting from 4.4.0, global constant has priority.

Workaround: use only fully qualified enum values, like global_shadow.teleport in this case.

This behavior change caused a bug in at least one mod.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [since 4.4.0] Global constant has priority over local sc

Post by Graf Zahl »

I wonder when this happened. I cannot remember having changed anything in that part of the engine myself.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: [since 4.4.0] Global constant has priority over local sc

Post by _mental_ »

Order of lookup inside FxIdentifier::Resolve() changed in this commit. Test for line special now happens earlier than before.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [since 4.4.0] Global constant has priority over local sc

Post by Graf Zahl »

fixed
Post Reply

Return to “Closed Bugs [GZDoom]”