View Issue Details

IDProjectCategoryView StatusLast Update
0000458Gameplay + OpenGL[All Projects] Bugpublic2017-03-20 16:07
ReporterMajor Cooke 
Assigned To 
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionno change required 
Summary0000458: [2.4maint] Menus not casting items properly
DescriptionIt appears menus cannot cast classes properly for some reason or another. See steps to reproduce for more information on reproduction.

I have tried to reproduce this with a cut-down version but with unsuccessful results.

In particular, this code can be found in ZMenu.txt inside of the D4DMenu.pk3 file. Areas of emphasis added via <<< surrounding the two lines of code.

override void Init(Menu parent = NULL, ListMenuDescriptor desc = NULL)
{
    Super.Init(parent, desc);
    m = new("MenuItemList");
    m.Reset();
    m.plr = players[consoleplayer].mo;
    
    if (m.plr)
    {
        int cashamt = m.plr.CountInv("D4DCash");
        m.SetItem("D4DCash", cashamt);
        Console.Printf("Cash pushed.");
    }
    
    int childsize = mDesc.mItems.Size();
    if (childsize > 0)
    {
        int counter = 0;
        Console.Printf("Searching for children...");
        for (int i = 0; i < mDesc.mItems.Size(); i++)
        {
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            
let c1 = D4DOptionMenuUpgrades(mDesc.mItems[i]); // This isn't working for some reason.
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            
if (c1)	
            {
                counter++;
                Console.Printf("Found an option menu upgrade class.");
                c1.m = m;
                c1.NotifyItems();
                continue;
            }
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            
let c2 = D4DListMenu(mDesc.mItems[i]); //Neither is this.
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            
if (c2)	
            {
                counter++;
                Console.Printf("Found a D4D list menu class.");
                c2.m = m;
                continue;
            }
        }
        if (counter > 0)
        {
            Console.Printf("Found %d.", counter);
        }
        else
        {
            Console.Printf("ERROR: Nothing found!");
        }
    }
    else
    {
        Console.Printf("No children to give to.");
    }
}
Steps To ReproduceDownload this D4D file.
And the resources, if needed.

Load order:
- D4DResources
- D4DMenu

You don't need standard D4D for this.

1. Launch GZDoom and start a new game.
2. Enter "UpgradeMenu" into console.
Some text will display in the console/log.

"Searching for children...
ERROR: Nothing found!"

As described in the Description, for some reason the the variables are not casting properly.
TagsNo tags attached.

Relationships

Activities

Graf Zahl

Graf Zahl

2017-03-20 16:06

administrator   ~0001066

A clear case of user error: The classes are not related.
Major Cooke

Major Cooke

2017-03-20 16:07

reporter   ~0001067

Tell me how do I fix this?

Issue History

Date Modified Username Field Change
2017-03-20 15:56 Major Cooke New Issue
2017-03-20 16:06 Graf Zahl Status new => closed
2017-03-20 16:06 Graf Zahl Resolution open => no change required
2017-03-20 16:06 Graf Zahl Note Added: 0001066
2017-03-20 16:07 Major Cooke Note Added: 0001067