Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Problem about object stack for a game editor!!

Author
Message
Khappa
16
Years of Service
User Offline
Joined: 18th Aug 2009
Location:
Posted: 20th May 2010 18:24
Hi, im creating an editor and i found a problem like this. My program is actually able to create objects but now i need to delete some random object by stack (array)!

so i declared the object type:



the routine to put file .x into the array stack:



well!! now, in the main loop when i try to delete last object of the stack is fine, but when i delete an object randomly i got problem with the rest of the code!!

i use:

nObj is the number of object variable (last object)
delete object nObj
nObj = nObj - 1

but if i try to do this:
delete object 15
nObj = nObj - 1

ERROR!!

any help???
thanx a lot


www.myspace.com/spacekhappa
www.khappa.com
paul5147
20
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 20th May 2010 18:38
Arrays dont work like stacks,there random access,if you delete an element in an array thats all you have done,the rest wont "fall down" like they do in a stack to take its place,hope this helps.

Login to post a reply

Server time is: 2026-07-25 16:21:08
Your offset time is: 2026-07-25 16:21:08