Internalise void Remove() so that it entirely kills any pointer object.
Internalise void Remove() so that it entirely kills any pointer object.
http://www.zoriarpg.com/zc/LoE_Userbar.png http://zoriarpg.com/zc/EiyuuUserbar.png
http://www.zoriarpg.com/zc/CIS_Original.pnghttp://www.zoriarpg.com/zc/CIS_II_Userbar.png
Latest ZC 2.53 (Win32) | (Technical Specification | Changelog)
Latest ZC 2.55(Win32) | 2.55 Modules | (Techical Specification | Changelog)
ZC Source Code | ZClaunch Source Code
Featured Scripts & Headers: RPG.zh ( v. a0.97.1 ) ( RPG.zh Thread ) | Zelda 3 Thief's Town Treasure Chest Minigame (ffc) | Bobomb (enemy)
ZScript & ZC-Related Pastebin | ZC Dev & Builds | ARCHIVED ZC Dev & Builds | YouTube Channel | Quests and ZScript Repository
All of the code that I create and publish here is free for use, modification and distribution under the GPL v2.0, or v3.0 where applicable.
Remove() does not fully invalidate pointers for datatypes ffc, item, lweapon, eweapon, and uses a substandard way to remove npc pointers. Have a look at what void Remove() does, and you'll understand.
An internal Remove() would fully remove the pointer.
http://www.zoriarpg.com/zc/LoE_Userbar.png http://zoriarpg.com/zc/EiyuuUserbar.png
http://www.zoriarpg.com/zc/CIS_Original.pnghttp://www.zoriarpg.com/zc/CIS_II_Userbar.png
Latest ZC 2.53 (Win32) | (Technical Specification | Changelog)
Latest ZC 2.55(Win32) | 2.55 Modules | (Techical Specification | Changelog)
ZC Source Code | ZClaunch Source Code
Featured Scripts & Headers: RPG.zh ( v. a0.97.1 ) ( RPG.zh Thread ) | Zelda 3 Thief's Town Treasure Chest Minigame (ffc) | Bobomb (enemy)
ZScript & ZC-Related Pastebin | ZC Dev & Builds | ARCHIVED ZC Dev & Builds | YouTube Channel | Quests and ZScript Repository
All of the code that I create and publish here is free for use, modification and distribution under the GPL v2.0, or v3.0 where applicable.
http://www.zoriarpg.com/zc/LoE_Userbar.png http://zoriarpg.com/zc/EiyuuUserbar.png
http://www.zoriarpg.com/zc/CIS_Original.pnghttp://www.zoriarpg.com/zc/CIS_II_Userbar.png
Latest ZC 2.53 (Win32) | (Technical Specification | Changelog)
Latest ZC 2.55(Win32) | 2.55 Modules | (Techical Specification | Changelog)
ZC Source Code | ZClaunch Source Code
Featured Scripts & Headers: RPG.zh ( v. a0.97.1 ) ( RPG.zh Thread ) | Zelda 3 Thief's Town Treasure Chest Minigame (ffc) | Bobomb (enemy)
ZScript & ZC-Related Pastebin | ZC Dev & Builds | ARCHIVED ZC Dev & Builds | YouTube Channel | Quests and ZScript Repository
All of the code that I create and publish here is free for use, modification and distribution under the GPL v2.0, or v3.0 where applicable.
Remove is actually a bit of a hack. It doesn't really remove the object, it just makes it so that the next frame ZC will see that it should be removed (deleted). Internalizing it is actually a good suggestion, though actually deleting it might be bad. (Like my pappy used to say: Don't change horses midstream.)
This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.
Right, isValid() should evaluate false when a pointer is specifically removed.Iit would avoid the hack-ish methods that I'm using to determine if it should be skipped. Again, for loops (especially with a Waitframe(), as those can become cumulative) would be optimised if pointers are removed. It would allow the loop to advance in the same frame, and wouldn't require workarounds for multiple loops that run per frame.
If you're curious, here is a set of utility functions that I use with the present Remove() function:
I use those, in place of isValid(), which works for the present, but it would still be better to remove the pointers. They otherwise just use stack/ heap space anyway.Code:///Used to check if any given pointer is on screen. Move pointers to X = 32768 to effectively kill them with void Remove(). bool isOnScreen(item i){ if( i->isValid() && i->X != 32768 ) { return true; } return false; } bool isOnScreen(ffc f){ if( f->Data > 0 && f->X != 32768 ) { return true; } return false; } bool isOnScreen(npc n){ if( n->isValid() && n->X != 32768 ) { return true; } return false; } bool isOnScreen(eweapon e){ if( e->isValid() && e->X != 32768 ) { return true; } return false; } bool isOnScreen(lweapon l){ if( l->isValid() && l->X != 32768 ) { return true; } return false; }
Again, it's a request for the future. It would be cleaner to remove the pointers, rather than moving them off-screen.
I can see how deleting the ZScript void Remove might be bad, if anything depends on it.
You could do void Rem() for the internal side, to prevent compatibility conflicts.
Last edited by ZoriaRPG; 06-08-2015 at 04:59 AM.
http://www.zoriarpg.com/zc/LoE_Userbar.png http://zoriarpg.com/zc/EiyuuUserbar.png
http://www.zoriarpg.com/zc/CIS_Original.pnghttp://www.zoriarpg.com/zc/CIS_II_Userbar.png
Latest ZC 2.53 (Win32) | (Technical Specification | Changelog)
Latest ZC 2.55(Win32) | 2.55 Modules | (Techical Specification | Changelog)
ZC Source Code | ZClaunch Source Code
Featured Scripts & Headers: RPG.zh ( v. a0.97.1 ) ( RPG.zh Thread ) | Zelda 3 Thief's Town Treasure Chest Minigame (ffc) | Bobomb (enemy)
ZScript & ZC-Related Pastebin | ZC Dev & Builds | ARCHIVED ZC Dev & Builds | YouTube Channel | Quests and ZScript Repository
All of the code that I create and publish here is free for use, modification and distribution under the GPL v2.0, or v3.0 where applicable.
I could have, and then answered other questions from someone else, about why I don't want to wait a frame...
It's low priority, and for the record, I'll make suggestions for improvements, even if they don't directly pertain to my own goals. In this case, I have utility functions that mimic the behaviour that I need, but I've run into instances in other projects where this became an issue. That notwithstanding, I would likely have made this suggestion in time, simply because if a user can create a pointer, they should be able to directly remove it. It's tidier that way.
When was I required to have reasons, anyway?
http://www.zoriarpg.com/zc/LoE_Userbar.png http://zoriarpg.com/zc/EiyuuUserbar.png
http://www.zoriarpg.com/zc/CIS_Original.pnghttp://www.zoriarpg.com/zc/CIS_II_Userbar.png
Latest ZC 2.53 (Win32) | (Technical Specification | Changelog)
Latest ZC 2.55(Win32) | 2.55 Modules | (Techical Specification | Changelog)
ZC Source Code | ZClaunch Source Code
Featured Scripts & Headers: RPG.zh ( v. a0.97.1 ) ( RPG.zh Thread ) | Zelda 3 Thief's Town Treasure Chest Minigame (ffc) | Bobomb (enemy)
ZScript & ZC-Related Pastebin | ZC Dev & Builds | ARCHIVED ZC Dev & Builds | YouTube Channel | Quests and ZScript Repository
All of the code that I create and publish here is free for use, modification and distribution under the GPL v2.0, or v3.0 where applicable.
There are currently 1 users browsing this thread. (0 members and 1 guests)