About Store Forum Documentation Contact



Post Reply 
Problem with deleting objects
Author Message
kulesz Offline
Member

Post: #1
Problem with deleting objects
I've got a strange issue I can't bare with (using manual world loading).

I'm setting area active with:
Code:
Memc < Game::WorldManager::AreaState > areaStates;
areaStates.New().set(VecI2(0,0, Game::AREA_ACTIVE);
Game::World.areaSetState(areaStates, true);

Then I'm generating heightmap and adding some objects with:
Code:
Game::ObjParamsPtr object = Game::Objs.ptrRequire("Data/Obj/plant/Grass/0.obj");
object->type(true, "OBJ_STATIC");
Game::Obj *obj=Game::World.objCreateNear(*object, Matrix(object->scale(), Vec(meshX, meshY, meshZ)));

It works OK, the area is created, set active and the objects appear.
Then I'm comencing a:
Code:
Memc < Game::WorldManager::AreaState > areaStates;
Game::World.areaSetState(areaStates, true);

Because container is empty, all areas are unloaded. It's OK.

But now, when I'm doing again the first two steps (setting area active and putting object), area appears and the previous object is already placed... In result, I have 2 objects, but I want only the new one. Aren't the objects deleted, when I set an area inactive? How can I delete them?[/align]
10-27-2011 08:45 PM
Find all posts by this user Quote this message in a reply
alkirah Offline
Member

Post: #2
RE: Problem with deleting objects
In declaration
Game::ObjMemx<Teleport > ObjParticles;
Game::ObjMemx<Game::Static> Statics;
Game::ObjMemx<Player > Players;

In Init
Game::World.init ( )
.setObjType(Players , OBJ_PLAYER )
.setObjType(Statics , OBJ_STATIC )
.setObjType(ObjParticles, OBJ_PARTICLES)
.New ("World/world.world");

Then try to use
Statics.clear() before loading your new area.

You can also disables all item and reenable them later if needed
REPAO(Statics).disable();
10-28-2011 04:51 PM
Find all posts by this user Quote this message in a reply
kulesz Offline
Member

Post: #3
RE: Problem with deleting objects
I'm doing it like this, but it does not work.
10-28-2011 09:29 PM
Find all posts by this user Quote this message in a reply
Post Reply