Game Development Community

Retrieving dynamic fields from c++ code

by Bryan "daerid" Ross · in Torque Game Engine · 12/07/2001 (2:12 pm) · 9 replies

how would you do it?

ie: say, you add a dynamic field 'status' to a clientconnection object ( meaning it's not part of that class by default ).

How would you then access that value from c++ code?

#1
12/10/2001 (1:19 pm)
Bump.

Come on, this has GOT to be an easy one for any of GG's staff :)
#2
12/10/2001 (11:35 pm)
I find it a bit disheartening that there isn't a reply to this yet :(
#3
12/10/2001 (11:56 pm)
Try this:
clientConnection->getFieldDictionary()->getFieldValue("status");
#4
12/11/2001 (9:53 am)
omg thank you.

That's exactly what I was looking for.
#5
12/11/2001 (10:48 am)
Been a little behind on the forums... but it looks like this one is solved :)
#6
12/11/2001 (11:46 am)
Gotcha covered.
www.flyingtemple.com/files/salute.jpg(Sorry, really bad pun/inside joke.)
#7
12/01/2007 (11:26 am)
Someone know if this is currently valid/working?
I cannot make it work...

edit: btw, sorry for the necro thread rising...
#8
12/01/2007 (11:41 am)
It's changed since way back when, but I'd first suggest an analysis of why you want to access a dynamic field from c++.

Just about by definition, if c++ code needs access to a field, then that field should be a persistent field, assigned in the class' ::initPersistFields(..) method. There are very few, if any (other than editors) reason why c++ would want to access a dynamic field.

The way to do it now as far as I can remember (I've never had reason to do this in all my prototyping and development work) is the SimObject::get/setDataField(..) methods.
#9
12/01/2007 (11:47 am)
Thanks Stephen. You are right indeed, I was just trying make a shortcut, but yes, a persistent field is the right way of do it.