Is there any safer way to do this?
#6

Quote:
Originally Posted by Paulice
View Post
Have you tried this?
yes, and this is the result

Code:
foreach(new i : EVM){
    printf("Iterator: %d", i);
    new cur = evmID;
    Iter_SafeRemove(EVM, cur, evmID);
}

Iterator: 7
Iterator: 0
Iterator: -39800
this problem only occurs if I do this
PHP Code:
foreach(new EVM)
        
DeleteEVM(i);
DeleteEVM(evmID){
    
EVMInfo[evmID][e_evmName][0] = EOS;
    
EVMInfo[evmID][e_evmPosX] = 0;
    
EVMInfo[evmID][e_evmPosY] = 0;
    
EVMInfo[evmID][e_evmPosZ] = 0;
    
EVMInfo[evmID][e_evmRotX] = 0;
    
EVMInfo[evmID][e_evmRotY] = 0;
    
EVMInfo[evmID][e_evmRotZ] = 0;
    
EVMInfo[evmID][e_evmIsBlocked] = true;
    
DestroyDynamicObject(EVMInfo[evmID][e_evmObj]);
    
DestroyDynamic3DTextLabel(EVMInfo[evmID][e_evmLabel]);
    new 
cur evmID;
    
Iter_SafeRemove(EVMcurevmID);

but it works fine if I do this

PHP Code:
foreach(new EVM){
        
DeleteEVM(i);
        new 
cur i;
    
Iter_SafeRemove(EVMcuri);
}
DeleteEVM(evmID){
    
EVMInfo[evmID][e_evmName][0] = EOS;
    
EVMInfo[evmID][e_evmPosX] = 0;
    
EVMInfo[evmID][e_evmPosY] = 0;
    
EVMInfo[evmID][e_evmPosZ] = 0;
    
EVMInfo[evmID][e_evmRotX] = 0;
    
EVMInfo[evmID][e_evmRotY] = 0;
    
EVMInfo[evmID][e_evmRotZ] = 0;
    
EVMInfo[evmID][e_evmIsBlocked] = true;
    
DestroyDynamicObject(EVMInfo[evmID][e_evmObj]);
    
DestroyDynamic3DTextLabel(EVMInfo[evmID][e_evmLabel]);

so there is no way I can use Iter_SafeRemove inside a separae function?
Reply


Messages In This Thread
Is there any safer way to do this? - by Eoussama - 14.07.2017, 17:17
Re: Is there any safer way to do this? - by Logic_ - 14.07.2017, 17:30
Re: Is there any safer way to do this? - by Konstantinos - 14.07.2017, 17:33
Re: Is there any safer way to do this? - by Eoussama - 14.07.2017, 17:37
Re: Is there any safer way to do this? - by Paulice - 14.07.2017, 17:45
Re: Is there any safer way to do this? - by Eoussama - 14.07.2017, 17:48
Re: Is there any safer way to do this? - by Paulice - 14.07.2017, 18:09
Re: Is there any safer way to do this? - by Eoussama - 14.07.2017, 18:15

Forum Jump:


Users browsing this thread: 2 Guest(s)