AndrewBGS
Member
|
Cusom save/load
After many failed attempts I decided it's time to ask around how do I go about saving and loading custom parameters. I did manage to save and load some integers related to items, that worked.
But now I want to save and load the meshes on the character, i.e. armor.
f<<armor; in save() and f>>armor(); in load seems to save or load (not sure which one is the problem), but after loading the character wears a completely random item. So how would I go about saving and loading my player's armor?
//armor is added in player as in the Rendering/Armor Rendering Tutorial.
|
|
05-21-2013 08:38 AM |
|
neo22
Member
|
RE: Cusom save/load
Hi!
Maybe your armor object does have a pointer in it (probably on the mesh).
You'll better create a save ans load structure for this :
Code:
Bool armor::save(File &f){
f.putStr(T.name);
f.putStr(T.mesh->name())
}
void armor::load(File &f){
T.name = f.getStr();
T.mesh = Meshes(f.getStr());
}
//replace f<<armor by armor.save(f); and f>>armor by armor.load(f);
|
|
05-29-2013 08:57 AM |
|