Page 1 of 1

space.Clear()

Posted: Wed Dec 21, 2011 11:06 pm
by snoozbuster
So, remember how I was talking about putting a Clear() function in Space? Well, I decided to actually do that, since extensions just weren't cutting it for me. Here's a copy of Space.cs, in case you feel like using it. I marked all the spots I changed with // AGV. I also modified ISpace.cs to have a method stub for Clear().

The reason I use while(objectList.Count > 0) instead of foreach in Clear() is because objects get removed from the list in Remove() (and any recursive calls thereof), thereby invalidating enumerators and crashing. This works just as good.

Re: space.Clear()

Posted: Sat Dec 24, 2011 6:57 am
by Fe_Yoshi
Clearing space would be helpful in getting rid of all that nasty debris and asteroids, but we'd also lose the planets and stars!!!

Please don't end all of existence mister :(

Re: space.Clear()

Posted: Sun Dec 25, 2011 4:19 am
by snoozbuster
Fe_Yoshi wrote:Clearing space would be helpful in getting rid of all that nasty debris and asteroids, but we'd also lose the planets and stars!!!

Please don't end all of existence mister :(
Don't worry. I won't.