From: Keith F. <ven...@us...> - 2003-04-24 06:59:54
|
Update of /cvsroot/planeshift/planeshift/src/common/engine In directory sc8-pr-cvs1:/tmp/cvs-serv14702 Modified Files: netpersist.h netpersist.cpp Log Message: Removed proxlist as a CEL PC and merged into server code. Index: netpersist.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/common/engine/netpersist.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** netpersist.h 1 Mar 2003 02:24:02 -0000 1.29 --- netpersist.h 24 Apr 2003 06:59:51 -0000 1.30 *************** *** 26,29 **** --- 26,31 ---- #include <csutil/memfile.h> #include <util/psscf.h> + #include <net/netbase.h> + class MsgHandler; *************** *** 42,47 **** enum { ! NO_MAPPING = 0, ! MAPPED = 1 }; psNetPersist(); --- 44,49 ---- enum { ! NO_MAPPING = 0, ! MAPPED = 1 }; psNetPersist(); *************** *** 51,57 **** bool SendEntity(uint32_t clientnum, iCelEntity* entity); ! bool BroadcastEntity(uint32_t clientnum, iCelEntity* entity); bool SendWorld(uint32_t clientnum,const char *sectorname); ! bool SendActors(uint32_t clientnum, uint32_t clientselfid = 0); void RequestWorld(uint32_t clientnum = 0); void RequestActors(uint32_t clientnum = 0); --- 53,59 ---- bool SendEntity(uint32_t clientnum, iCelEntity* entity); ! bool BroadcastEntity(uint32_t clientnum, iCelEntity* entity,PublishVector& multi); bool SendWorld(uint32_t clientnum,const char *sectorname); ! bool SendActors(uint32_t clientnum, uint32_t clientselfid,iCelEntity *proxactors); void RequestWorld(uint32_t clientnum = 0); void RequestActors(uint32_t clientnum = 0); Index: netpersist.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/common/engine/netpersist.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** netpersist.cpp 18 Apr 2003 06:27:46 -0000 1.48 --- netpersist.cpp 24 Apr 2003 06:59:51 -0000 1.49 *************** *** 29,34 **** #include "net/msghandler.h" #include "net/messages.h" ! ! #include "psprop/pc/pspcproxlist.h" // Define for debugging printfs. You probably want this on for development, off for server. --- 29,33 ---- #include "net/msghandler.h" #include "net/messages.h" ! #include "util/psconst.h" // Define for debugging printfs. You probably want this on for development, off for server. *************** *** 146,156 **** } ! bool psNetPersist::BroadcastEntity(uint32_t clientnum, iCelEntity* entity) { ! // Get list of interested clients ! csRef<iPcProximityList> proxlist = ! CEL_QUERY_PROPCLASS (entity->GetPropertyClassList(), iPcProximityList); ! ! if (!proxlist || !proxlist->GetClients().Length()) return false; --- 145,151 ---- } ! bool psNetPersist::BroadcastEntity(uint32_t clientnum, iCelEntity* entity,PublishVector& multi) { ! if (!multi.Length()) return false; *************** *** 167,177 **** entity->GetID(), memfile); #ifdef PSNETPERSISTDEBUG ! printf("Multicasting entity %s to %d clients.\n",entity->GetName(),proxlist->GetClients().Length() ); #endif ! msghandler->Multicast(pmsg.me, ! proxlist->GetClients(), ! clientnum, // rhia parm excludes self from multicast if non-zero ! PROX_LIST_ANY_RANGE); // Obsolete: Used to broadcast all entities to all clients --- 162,172 ---- entity->GetID(), memfile); #ifdef PSNETPERSISTDEBUG ! printf("Multicasting entity %s to %d clients.\n",entity->GetName(),multi.Length() ); #endif ! msghandler->Multicast(pmsg.me, ! multi, ! clientnum, // rhia parm excludes self from multicast if non-zero ! PROX_LIST_ANY_RANGE); // Obsolete: Used to broadcast all entities to all clients *************** *** 198,260 **** } - csPtr<iCelEntity> psNetPersist::CreateProxActorList(uint32_t clientnum) - { - // Make list as entity with inventory - csRef<iCelEntity> list = celbase->GetPlLayer()->CreateEntity(); - list->SetName ("actorlist"); - - if (!celbase->GetPlLayer()->CreatePropertyClass (list, "pcinventory")) - return NULL; - - csRef<iPcInventory> listinv = - CEL_QUERY_PROPCLASS(list->GetPropertyClassList(), - iPcInventory); - if (!listinv) - return NULL; - - // Now cycle through complete actor list to find relevant entities - csRef<iPcInventory> pcinv = - CEL_QUERY_PROPCLASS(celbase->GetActors()->GetPropertyClassList(), - iPcInventory); - if (!pcinv) - return NULL; - - #ifdef PSNETPERSISTDEBUG - printf("Building custom prox list for client %d\n",clientnum); - #endif ! for (int i=0; i<pcinv->GetEntityCount(); i++) ! { ! iCelEntity *candidate = pcinv->GetEntity(i); ! ! #ifdef PSNETPERSISTDEBUG ! printf(" Checking #%d (%s)...",i,candidate->GetName() ); ! #endif ! ! // Get list of interested clients ! csRef<iPcProximityList> proxlist = ! CEL_QUERY_PROPCLASS (candidate->GetPropertyClassList(), iPcProximityList); ! ! if (proxlist && proxlist->FindClient(clientnum)) ! { ! // This was subscribed, so add to temp list ! listinv->AddEntity(candidate); ! #ifdef PSNETPERSISTDEBUG ! printf("Added\n"); ! #endif ! } ! #ifdef PSNETPERSISTDEBUG ! else ! { ! printf("Not added.\n"); ! } ! #endif ! } ! ! //list->IncRef (); ! return csPtr<iCelEntity> (list); ! } ! ! bool psNetPersist::SendActors(uint32_t clientnum, uint32_t clientselfid) { csMemFile* memfile = new csMemFile; --- 193,198 ---- } ! bool psNetPersist::SendActors(uint32_t clientnum, uint32_t clientselfid,iCelEntity *proxactors) { csMemFile* memfile = new csMemFile; *************** *** 262,267 **** memfile->DecRef(); - csRef<iCelEntity> proxactors = CreateProxActorList(clientnum); - CS_ID n = proxactors->GetID(); proxactors->SetID(0x80000001); --- 200,203 ---- |