how to destroy all instances of CRunObjType* pMyType

This forum is currently in read-only mode.
  • given CRunObjType* pMyType,

    how can I destroy all instances of pMyType?

    assuming that no picking of any kind has been done

  • Call VRuntime::GetTypeInstances to get a list of the instances in that type, then call VRuntime::DestroyObject on each of them.

  • I know you don't have time to teach me c++, ash

    but honestly, I just need to get around this so I can get the other bitmap text stuff done on my weekend

    I'll be learning about vectors on a later date,

    but I just need to destroy all instances, so if anyone, ashley or otherwise

    wants to help me out with

    GetTypeInstances(CRunObjType* pType,  CRunObject**& instancesList, int& count)[/code:27394pvf]
    I'm pretty much lost on the whole thing
    I get that I need to pass it a pointer to a pointer to a CRunObject, but I'm really just shooting in the dark reading through the sprite plugin, and trying to speed learn vectors
    
    given pType, and an int named count
    how do I set up a loop iterating through all the instances?
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It has nothing to do with vectors

    CRunObject** instances;
    int count;
    pRuntime->GetTypeInstances(pType, instances, count);
    
    if (instances != NULL) {
    	CRunObject** i = instances;
    	CRunObject** end = instances + count;
    
    	for ( ; i != end; ++i)
    		pRuntime->DestroyObject(*i);
    }[/code:f76xay8n]
  • thanks ash, you rock

    I was totally lost in the sprite collision test vector iteration Sol modification code

    now I can finish the rest of this plugin, and I'll have time to read my c++ pdfs

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)