Alright, I have a question about the MakeCopy function.
What I do is iterate through an existing object and I /want/ to copy
over existing values.
Even better, is if you can tell me how to delete a key. Because I tried
RemoveSubKey and it doesn't work; so I am iterating through the object
and skipping the key I want to remove and copying over the new data to
the old object to be used.
KeyValues *Key = SaveData->GetFirstSubKey();
KeyValues *NewData = new KeyValues("Data");
while(Key)
{
// is this the key we don't want?
if(!strcmp(Key->GetName(), RemoveData->GetName()))
{
// do nothing, skip
} else {
// It's not, so let's add it.
KeyValues *NewKey = NewData->CreateNewKey();
NewKey = ItemKey->MakeCopy();
DevMsg("New key name: %s\n", NewKey->GetName());
}
Key = Key->GetNextKey();
}
I end up with an empty NewData object, but my devmsg tells me the
correct values. If I do "SetString" instead of MakeCopy, it works. But I
don't want to do that... since sometimes my object has different values.
It seems that once it goes onto a new key, it loses the data assigned by
MakeCopy.
--
Kamran A
Get Firefox! Safer, Faster, Better.
<http://www.spreadfirefox.com/?q=affiliates&id=0&t=85>
Down with Internet Explorer! Say "NO!" to Spyware! Use Firefox
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders