View Issue Details

IDProjectCategoryView StatusLast Update
0000051Gameplay + OpenGL[All Projects] Bugpublic2017-01-15 03:47
ReporterMajor Cooke 
Assigned To 
Status resolvedResolutionno change required 
Summary0000051: Pointer issues


The pinatas from killing enemies with the chainsaw altfire just hang around instead of disappearing.

The code:

Class D4PinataBorder : Actor
        Scale 0.3;
        DistanceCheck "user_MaxDrawDistance";
        TNT1 A 0 NoDelay
            if (!master) { OnDestroy(); return ResolveState(null); }
            if (master.GetClass() == "D4PinataArmor") { return ResolveState(1); }
            if (master.GetClass() == "D4PinataHealth") { return ResolveState(2); }
            if (master is "D4Carrion") { return ResolveState(3); }
            if (master is "D4BFGAmmo") { return ResolveState(4); }
            if (master is "Ammo") { return ResolveState(3); }
            return ResolveState("Null");
        PIN3 ABDH 0 A_Jump(256,"Enact");
        "####" "#" 1
            if (!master) { OnDestroy(); return; }
TagsNo tags attached.



Major Cooke

Major Cooke

2017-01-14 21:01

reporter   ~0000083

Forgot to set this as 'major' instead of 'minor'.
Major Cooke

Major Cooke

2017-01-14 21:42

reporter   ~0000084

...Hmmm. I think it's something to do with the recent Ammo scriptifying.
Major Cooke

Major Cooke

2017-01-14 22:06

reporter   ~0000085

Okay, updated to the latest with the health changes. It happens to those too.
Graf Zahl

Graf Zahl

2017-01-15 02:38

administrator   ~0000086

You have to call 'Destroy' not 'OnDestroy'. 'OnDestroy' is just a callback to report that the item is about to be destroyed but does nothing itself, hence the 'On...' in the name. For technical reasons it is not possible to make 'Destroy' itself virtual because that'd badly crash an engine shutdown.


2017-01-15 03:24

developer   ~0000087

The original problem was solved, so it could be possible to try again to make Destroy virtual...
Graf Zahl

Graf Zahl

2017-01-15 03:47

administrator   ~0000088

I already solved the problem by making the cleanup function something that is being called by the actual Destroy method.

This is absolutely necessary here, because Destroy can be called after the class table cleanup where a virtual scripted call will thoroughly crash the engine if not done properly and that means keeping code execution under tight control.

The original implementation was something I never liked because it depended on everybody implementing it properly, if just one intermediate class forgets to call the super method big problems would ensue. This cannot happen anymore.

Issue History

Date Modified Username Field Change
2017-01-14 21:00 Major Cooke New Issue
2017-01-14 21:01 Major Cooke Note Added: 0000083
2017-01-14 21:42 Major Cooke Note Added: 0000084
2017-01-14 22:06 Major Cooke Note Added: 0000085
2017-01-15 02:38 Graf Zahl Note Added: 0000086
2017-01-15 02:38 Graf Zahl Status new => resolved
2017-01-15 02:38 Graf Zahl Resolution open => no change required
2017-01-15 03:24 Edward-san Note Added: 0000087
2017-01-15 03:47 Graf Zahl Note Added: 0000088