View Issue Details

IDProjectCategoryView StatusLast Update
0000571Gameplay + OpenGL[All Projects] Bugpublic2017-04-12 09:42
ReporterRaveYard 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Summary0000571: ZScript - Array.delete doesn't work.
DescriptionDelete method for dynamic arrays containing pointers doesn't work if the second parameter isn't specified.
Steps To Reproduce

class DerpClass {
    int asdf;
}

class Test : Thinker {
    Array<DerpClass> derps;

    Test Init() {
        ChangeStatNum(STAT_DEFAULT);
        return self;
    }

    override void Tick() {
        DerpClass d = new("DerpClass");

        derps.Push(d);
        Console.Printf(String.Format("new: %p", d));

        derps.Delete(0);

        for (int i = 0; i < derps.size(); ++i) {
            Console.Printf(String.Format("%d -> content: %p", i, derps[i]));
        }
        Console.Printf("");
    }

    static Test Get() {
        ThinkerIterator it = ThinkerIterator.Create("Test", STAT_DEFAULT);
        let p = Test(it.Next());
        if (p == null) {
            p = new("Test").Init();
        }
        return p;
    }
}
Additional InformationOutput in specified example:

new: 00000000069097E0
0 -> content: 00000000069097E0


new: 000000000690B120
0 -> content: 00000000069097E0
1 -> content: 000000000690B120


new: 000000000690B160
0 -> content: 00000000069097E0
1 -> content: 000000000690B120
2 -> content: 000000000690B160


new: 000000000690B1A0
0 -> content: 00000000069097E0
1 -> content: 000000000690B120
2 -> content: 000000000690B160
3 -> content: 000000000690B1A0

...


Tested with:

gzdoom-x64-2.5pre-73-g309d086
gzdoom-x64-2.5pre-295-g1febf27
TagsNo tags attached.

Relationships

Activities

Major Cooke

Major Cooke

2017-04-12 09:20

reporter   ~0001317

If I recall correctly, this is one of those things where you need to delete by the definition count instead of n - 1. Did you try doing Delete(1) instead?
_mental_

_mental_

2017-04-12 09:34

developer   ~0001318

Nope, it's a bug indeed.
_mental_

_mental_

2017-04-12 09:42

developer   ~0001319

Fixed in 20a9f17

Issue History

Date Modified Username Field Change
2017-04-12 08:49 RaveYard New Issue
2017-04-12 09:17 _mental_ Steps to Reproduce Updated View Revisions
2017-04-12 09:17 _mental_ Additional Information Updated View Revisions
2017-04-12 09:17 _mental_ Additional Information Updated View Revisions
2017-04-12 09:20 Major Cooke Note Added: 0001317
2017-04-12 09:34 _mental_ Status new => confirmed
2017-04-12 09:34 _mental_ Note Added: 0001318
2017-04-12 09:42 _mental_ Status confirmed => resolved
2017-04-12 09:42 _mental_ Resolution open => fixed
2017-04-12 09:42 _mental_ Note Added: 0001319