(08-05-2010 10:32 AM)Dynad Wrote: Why so much trouble??
Just use it like this:
struct NetworkObject
{
Reference<Player> objRef;
};
Map<RakNetGUID,NetworkObject> People;
~Dynad
(08-05-2010 12:05 PM)Esenthel Wrote: and you can put the game object into the map in
void Game::Obj::create(Game::objparams&)
{
__super::create();
map[id]=this;
}
and
Bool Game::Obj::load()
{
if(__super::load())
{
map[id]=this;
}
}
I know you can do in this way, I wondered if it was possible to put everything in the same map "ObjMemx", and not have to create a new map that keeps the Reference to the object. It is just unnecessary to have the same object in two different containers, Do you understand my point?
All I want to do is add the object to a ObjMemx with an objectID and then access the object in the ObjMemx using the objectID from server. Just as you take out an object from a std::map not std::vector like its now.
Is this possible or not?
Sample: ( I want to be enable to do like this )
The Game::ObjMemx acts like a std::vector
vector p;
p.push_back(obj)
p[index 0] = Object.
But I want to be enable to use it as a std::map, Like this.
1) The ObjMemx that hold the objects created.
Game::ObjMemx<
unsigned int, CPlayerObject> CPlayerObjs;
2) Create a new object.
Game::ObjParams &obj = *Game::Objs("Obj/chr/mesh.obj");
Game::World.objCreate(
ObjectID, obj, Matrix(obj.scale(), Vec(0,0,0)));
3) Now the new object will be placed in CPlayerObjs[
ObjectID] NOT [CPlayerObjs.elms()-1];
4) Access the object.
CPlayerObject *pPly = &CPlayerObjs[
ObjectID];
// Do stuff with object *pPly