User Tag List

Results 1 to 10 of 14

Thread: [2.xx] Expanded void Remove()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,962
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.55%
    Quote Originally Posted by SUCCESSOR View Post
    Why would you need to remove the pointer? I know what Remove() does. I just fail to see what problem you have. Remove() doesn't do anything with pointers it gets rid of what they point to.
    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.

  2. #2
    Username Kaiser SUCCESSOR's Avatar
    Join Date
    Jul 2000
    Location
    Winning.
    Age
    37
    Posts
    4,436
    Mentioned
    152 Post(s)
    Tagged
    7 Thread(s)
    vBActivity - Stats
    Points
    10,566
    Level
    30
    vBActivity - Bars
    Lv. Percent
    52.46%
    Quote Originally Posted by Gleeok View Post
    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.)
    I get that. I know its a hack. I just don't see the useful difference to ZoriaRPG if it is internalized or not.

    Quote Originally Posted by ZoriaRPG View Post
    Because isValid() still returns that the pointer exists, even if you do Remove(), and for loops still scan it, which lengthens loop time.

    I wrote other functions to cover this, but it's still optimal to actually remove the pointer when it's no longer needed.
    So you want it to remove objects faster? Or are you saying you want if(pointer) to evaluate to false if it is invalid?

  3. #3
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,766
    Level
    21
    vBActivity - Bars
    Lv. Percent
    69.94%
    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:


    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;
    }
    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.

    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social