[since 4.4.0] Global constant has priority over local scope

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!

[since 4.4.0] Global constant has priority over local scope

Postby m8f » Sun Jul 05, 2020 11:21 am

Steps to reproduce:
  1. Load global-shadow.pk3.
    global-shadow.pk3
  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 allExpand view
// 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.
You do not have the required permissions to view the files attached to this post.
User avatar
m8f
dreamer
 
 
 
Joined: 29 Dec 2017
Location: Siberia (UTC+7)
Discord: m8f#0629
Github ID: mmaulwurff

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

Postby Graf Zahl » Sun Jul 05, 2020 11:23 am

I wonder when this happened. I cannot remember having changed anything in that part of the engine myself.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

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

Postby _mental_ » Thu Jul 09, 2020 1:06 am

Order of lookup inside FxIdentifier::Resolve() changed in this commit. Test for line special now happens earlier than before.
_mental_
 
 
 
Joined: 07 Aug 2011


Return to Bugs

Who is online

Users browsing this forum: No registered users and 0 guests