PDA

View Full Version : Save/Restore keyvalues


goddzillajk
07-04-2007, 07:01 AM
Hi there,
i have a question, is there a way to save/restore a keyvalue within a utlvector via the hl2 save/restore method? If yes, how should i do this?

thx in advance

lodle
07-04-2007, 09:52 AM
convert the vector to a key value tree then save it. and when reading in the keyvalue convert it strait to a vector.

goddzillajk
07-05-2007, 09:38 AM
hmm thx, but i meant something like this:

i have a utlvector:

CUtlVector<KeyValues *> vKeyValueData;

and then something like this:

BEGIN_DATADESC( CHL2Player )
...
DEFINE_UTLVECTOR( vKeyValueData, FIELD_STRING ),
...
END_DATADESC()

lodle
07-06-2007, 01:26 AM
Why u have a vector of key values? That is a really ineffecent way of storing information.

Key values are used to parse information from script files which is human readable and thus makes it very slow to deal with. Make a new class to store the info you want from it then if needed make a vector array from that.

goddzillajk
07-06-2007, 06:27 AM
yo thx, i already did this, just wanted to know if there is a way with keyvalues but it does not matter anymore :)