EHANDLE: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
[http://u4it.com/images/videos/mpg/bbcpdg.html skanks] [http://playstation3facts.com/datas/img/icon/mlcqlp.html max power cars for sale] [http://www.globaltable.com/imageuploads/small/vccwnr.html big tits getting fucked] [http://nkibuilders.com/jpg/icons/1/apvdsa.html tettone] [http://stargalaxypub.com/images/pics/img/faeqfp.html horse dick sex] [http://peterlenkefi.com/photos/albums/userpics/1001/hgviqf.html south bend in schools] [http://harmonysandgravel.com/pre-art/art/cache/tfasbk.html free see through panty galleries] [http://trickropingbylassue.com/media/video/gpg/hdxrpx.html dwarf porn] [http://consumerfireproducts.com/ccount/cache/xspxcn.html take off my bra] [http://drjekyllrocks.com/photogallery/photo/1/sskqum.html cumeater] [http://mepacon.com/data/larp/lart/uaksud.html jewish single group] [http://mepacon.com/data/larp/lart/jcmwvj.html jacks mannequin] [http://guthsville.com/Download/Bullseye/tmp/1/stbgqv.html tawnee and rachel] [http://secondstreetspeed.com/faq/faq/img/plmrgb.html mormons] [http://robmorgan.net/images-lancaster/lan/tmp/icnewu.html toby] [http://mepacon.com/data/larp/lart/qlnrvh.html six pack abs] [http://encksgunbarn.com/templates_c/tmp/qrwbdn.html highland games] [http://nkibuilders.com/jpg/icons/1/gbiowf.html scrub uniforms] [http://abceastpa.org/myuploads/File/tmp/wdnims.html bbk] [http://secondstreetspeed.com/faq/faq/img/jfvbih.html urology cancer] [http://www.globaltable.com/imageuploads/small/caosdq.html dark gothic arts] [http://abceastpa.org/myuploads/File/tmp/cbimka.html warner brothers] [http://amfm2go.com/images/Image/img/cimxwf.html bandannas] [http://secondstreetspeed.com/faq/faq/img/awarwu.html rate my boob job] [http://trickropingbylassue.com/media/video/gpg/wgetot.html uncensored tv bloopers] [http://playstation3facts.com/datas/img/icon/elvajm.html graduation invitations] [http://atlanticwindow.net/images/Doors/door/picture/wjoeer.html spring break boobs] [http://encksgunbarn.com/templates_c/tmp/odwomi.html easy guitar tabs] [http://drjekyllrocks.com/photogallery/photo/1/xmlmwt.html pokemon porn] [http://secondstreetspeed.com/faq/faq/img/rglldl.html natuerliche zahlen] [http://stargalaxypub.com/images/pics/img/fwcpqj.html sensual babes] [http://robmorgan.net/images-lancaster/lan/tmp/weucho.html skirt and panties off for spanking] [http://mepacon.com/data/larp/lart/twqmbu.html sun country] [http://trickropingbylassue.com/media/video/gpg/cdbqse.html huge penetrations] [http://billdailey.net/maptest/images/qcnjcr.html latter day saints geneology records] [http://robmorgan.net/images-lancaster/lan/tmp/ikvhae.html pocket pc 2003 operating system] [http://metalsculptures.com/images/img/tmp/xnvhoh.html sex be creative] [http://consumerfireproducts.com/ccount/cache/dfcqnw.html glamour models] [http://consumerfireproducts.com/ccount/cache/cwmakh.html check printing] [http://billdailey.net/maptest/images/fvelll.html goverment] [http://stargalaxypub.com/images/pics/img/qnwkwv.html freemilfs] [http://playstation3facts.com/datas/img/icon/kcpida.html sexpo] [http://consumerfireproducts.com/ccount/cache/xhswvu.html freedom fuel america] [http://consumerfireproducts.com/ccount/cache/hvotqp.html new account password] [http://guthsville.com/Download/Bullseye/tmp/1/nwhodt.html madchen amick] [http://nkibuilders.com/jpg/icons/1/ubgcvg.html know nothing] [http://secondstreetspeed.com/faq/faq/img/lpbqae.html los lobos] [http://waterbedheaven.com/images/premier/cache/tmp/oaoqcf.html sims bustin out] [http://secondstreetspeed.com/faq/faq/img/vvnsim.html free anime porn clips] [http://atlanticwindow.net/images/Doors/door/picture/ewtgnp.html wrestling nip slips] [http://stargalaxypub.com/images/pics/img/whkhid.html interracial cuckold] [http://nkibuilders.com/jpg/icons/1/oussuc.html logo maker] [http://executiveautogallery.com/data/cars/small/jsgewf.html ashlee simpson naked] [http://secondstreetspeed.com/faq/faq/img/tqgswg.html sonic the hedgehog porn] [http://drjekyllrocks.com/photogallery/photo/1/moaqbo.html pedal boat] [http://harmonysandgravel.com/pre-art/art/cache/dkmupf.html myspace editor] [http://guthsville.com/Download/Bullseye/tmp/1/lojnfk.html lexus fuel injection] [http://robmorgan.net/images-lancaster/lan/tmp/tsxisa.html arkansas arrests] [http://secondstreetspeed.com/faq/faq/img/rrubbf.html hospitality jobs] [http://stargalaxypub.com/images/pics/img/ndxlfq.html tenacious] [http://nkibuilders.com/jpg/icons/1/cpikdb.html free fisting pics] [http://billdailey.net/maptest/images/stqocg.html new york multiple listing] [http://u4it.com/images/videos/mpg/wbwdfh.html oln] [http://waterbedheaven.com/images/premier/cache/tmp/leolsv.html tv stars nude] [http://mepacon.com/data/larp/lart/showpa.html anime nude] [http://drjekyllrocks.com/photogallery/photo/1/gfhfra.html free cartoons] [http://wcmfl.org/Forms/doc/docs/kidrbh.html athletic shoes] [http://afpli.org/documents/cache/kwwrop.html us calling country codes] [http://secondstreetspeed.com/faq/faq/img/akfpex.html psychology] [http://encksgunbarn.com/templates_c/tmp/viviqw.html kiddieporn] [http://consumerfireproducts.com/ccount/cache/mxsoje.html student loan repayment nursing] [http://afpli.org/documents/cache/kbhabs.html franchise business opportunities] [http://playstation3facts.com/datas/img/icon/qrjgkv.html erotic wallpapers] [http://afpli.org/documents/cache/bfawrl.html ai no kusabi] [http://peterlenkefi.com/photos/albums/userpics/1001/ddesph.html incest cartoon 3d] [http://secondstreetspeed.com/faq/faq/img/qviwvv.html kareena] [http://waterbedheaven.com/images/premier/cache/tmp/pouplu.html i d go to hell] [http://wcmfl.org/Forms/doc/docs/sdofug.html schoolgirl free gallery] [http://amfm2go.com/images/Image/img/fcljdo.html paris phone number listing] [http://secondstreetspeed.com/faq/faq/img/vkvrdl.html kid snow] [http://nkibuilders.com/jpg/icons/1/aefpmr.html sondra locke] [http://quakermaid.com/upload/tmp/jxgsmi.html couples swapping] [http://drjekyllrocks.com/photogallery/photo/1/rmltmm.html fax number 10] [http://robmorgan.net/images-lancaster/lan/tmp/rsllwg.html night life] [http://playstation3facts.com/datas/img/icon/wtguht.html young wet pussy] [http://mepacon.com/data/larp/lart/jidjsq.html lesbianas tetonas] [http://nkibuilders.com/jpg/icons/1/umvqbu.html hot boobs] [http://u4it.com/images/videos/mpg/vlrvwr.html wet t shirt teens] [http://robmorgan.net/images-lancaster/lan/tmp/tttcun.html lcds] [http://mepacon.com/data/larp/lart/xomcqo.html romantic evening tip] [http://atlanticwindow.net/images/Doors/door/picture/uuuekb.html cheap package hosting web] [http://secondstreetspeed.com/faq/faq/img/pmgvep.html little april sample videos] [http://trickropingbylassue.com/media/video/gpg/fuwauf.html maxwells models] [http://gethairless.com/media/mp3/melodiy/dktpqe.html st josephs day table] [http://metalsculptures.com/images/img/tmp/mfotln.html amadoras] [http://drjekyllrocks.com/photogallery/photo/1/siicld.html maternity underwear] [http://stargalaxypub.com/images/pics/img/gleaox.html girls in revealing bikinis bikini girl] [http://stargalaxypub.com/images/pics/img/jvujsi.html hells angel] [http://secondstreetspeed.com/faq/faq/img/nhalgu.html super fiesta plaza] [http://metalsculptures.com/images/img/tmp/xqfpwx.html jdbc definition]
Entities in the Source Engine are created and deleted all the time. Each time a new entity is instantiated, the engine looks up an unused entity-index and assigns this to the new entity. Once the entity is destroyed, its entity index becomes available again and may be reused for a different entity.
Entities in the Source Engine are created and deleted all the time. Each time a new entity is instantiated, the engine looks up an unused entity-index and assigns this to the new entity. Once the entity is destroyed, its entity index becomes available again and may be reused for a different entity.



Revision as of 18:51, 17 November 2007

Entities in the Source Engine are created and deleted all the time. Each time a new entity is instantiated, the engine looks up an unused entity-index and assigns this to the new entity. Once the entity is destroyed, its entity index becomes available again and may be reused for a different entity.

It's often nessary to keep track of an entity. This done mostly with pointers and entindex (index of the entity). However, when the entity is destroyed, using the pointer crashes (because it still points to a non-NULL location) and the entindex is not suitable because it may point to an other entity.

A better and safer way is to use an EHANDLE (or CBaseHandle) to keep track of entities. An EHANDLE encapsulate a 32-bit ID that is unique for an entity instance during the whole game and can be used on both server and client to refer to entity objects (An EHANDLE is a combination of an entity index and an increasing serial number). An EHANDLE can be transformed to CBaseEntity and vice versa just by using its overloaded operators. If an EHANDLE resolves to NULL, the entity is not valid anymore.

Example

// Find a player, if no player is available pPlayer and hPlayer are NULL
CBasePlayer* pPlayer = gEntList.FindEntityByClassname( NULL, "player" );

// Store it in a EHANDLE
EHANDLE hPlayer = pPlayer;

// Convert back to CBasePlayer
pPlayer = dynamic_cast<CBasePlayer*>((CBaseEntity*)hPlayer);

EHANDLEs must always be converted to the class CBaseEntity first, before casting to a derived class.

Related content

Networking Entities