Thread: NPC in CS:S
View Single Post
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-09-2011 , 04:19   Re: NPC in CS:S
Reply With Quote #49

Quote:
Originally Posted by predcrab
Datamaps are so incredibly wrong, it's past being not funny and it's funny again
For normal entity the declare datamap macros calculate the offset from CBaseEntity* to the field
and store this offset
when you request a datamap it takes the thisptr, adds the offset and away we go
By adding the same macros into your custom class, the offsets are generated between CEntity* and the prop
yet at lookup time it's added to the thisptr, CBaseEntity
so your test code looks like it's working, but its just modifying random memory on the valve entity
not the var in the CEntity
use a debugger to break and check if you want
The fix shouldn't be too hard
change the datamap creation code to build its own chain of datamap blocks, and not inject them into the valve list
then reimplement (ie copy) the datamap search code from CBE::AcceptInput() into CE:AcceptInput()
__________________
asherkin is offline