View Single Post
Safe to keep edict_t pointers ?
Old
  (#1)
koraX
Member
 
koraX's Avatar
 
Status: Offline
Posts: 145
Join Date: Jan 2004
Location: Slovak Republic
Default Safe to keep edict_t pointers ? - 02-02-2005

Some edict_t are indeed useful, like listenserver or worldspawn.

Clients edict_t (Bots or players) is also obviously useful. These edicts can be acquired by pfnPEntityOfEntIndex() (or INDEXENT macro), however I don't like idea of calling HL engine if we don't have to.

My question is, is it safe to keep these entities and use them within your plugin ? Of course every map change I shall update listenserver, worldspawn and remove all player edicts.

I don't know what could replace listenserver (acquired in ClientConnect()) and worldspawn (acquired in Spawn()).

Client edicts could be replaced by client indexes and every time I will need edict, I call pfnPEntityOfEntIndex().

I shall think of "new client is here, add it to your list" in ClientPutInServer() and of "client left, remove it from your list" in ClientDisconnect() and on map change.

So is this approach with using edicts OK ? Is it safe to think location of edicts doesn't change as long as client is connected ?

(It really helps to understand the problem when you write everything down )


kXBot
koraX's utils
- see my homepage for other projects (OpenGL CSG Editor, FAT16 Sim, NNetwork Sim, ...)
  
Reply With Quote