Why does the game saves your colection after every game and every time you save your deck? doing so really slows the game (using psp the memory stick takes a long time to save and rewrite? )
I have made some modifications to the code, playing with the method save() in class playerdata and it really speeds up the process of writing data after games and deck saves, I haven't experienced any loss of information or any other bugs.
Question on method saving() in playerdata
Question on method saving() in playerdata
Newest Wagic release:
https://github.com/WagicProject/wagic/releases
How to code cards:
https://github.com/WagicProject/wagic/wiki/CardCode
Discord
https://discord.gg/k8AYAZCXuq
https://github.com/WagicProject/wagic/releases
How to code cards:
https://github.com/WagicProject/wagic/wiki/CardCode
Discord
https://discord.gg/k8AYAZCXuq
Re: Question on method saving() in playerdata
I think the calls to the save method have been done by several devs, who not always knew what they were actually saving. (including myself)
For example, at the end of a game, we want to save a player's statistics (win/lose), and its credits and options (because unlocked decks are saved in the options).
But you're right, the collection should be saved in the shop, and that's pretty much it...
I'd be interested to see your patch
For example, at the end of a game, we want to save a player's statistics (win/lose), and its credits and options (because unlocked decks are saved in the options).
But you're right, the collection should be saved in the shop, and that's pretty much it...
I'd be interested to see your patch
Re: Question on method saving() in playerdata
Hi wololo, thanks for this wonderful game.
At the moment the method PlayerData::save() writes information about the credits, "Story Saves" (would like to know more about this) and then a condition if (collection)
then collection->save();
In what case the condition doesn't meet? What would make collection==0?
The collection shouldn't be saved after every duel, (it's really slow in the psp having a entire colletion), and save only after deck edit because you can sell your cards in that mode and thus modifying the cards you have, and while exiting the shop.
I think that separate the code of save() to make a exclusive saveCollection() method could be a solution.
With the neccesary references:
At the moment the method PlayerData::save() writes information about the credits, "Story Saves" (would like to know more about this) and then a condition if (collection)
then collection->save();
In what case the condition doesn't meet? What would make collection==0?
The collection shouldn't be saved after every duel, (it's really slow in the psp having a entire colletion), and save only after deck edit because you can sell your cards in that mode and thus modifying the cards you have, and while exiting the shop.
I think that separate the code of save() to make a exclusive saveCollection() method could be a solution.
Code: Select all
int PlayerData::save(){
std::ofstream file(options.profileFile(PLAYER_SAVEFILE).c_str());
char writer[512];
if (file){
sprintf(writer, "%i\n", credits);
file << writer;
//Story Saves
for (map<string,string>::iterator it = storySaves.begin(); it != storySaves.end(); ++it){
sprintf(writer, "s %s=%s\n", it->first.c_str(), it->second.c_str());
file << writer;
}
file.close();
}
taskList->save();
return 1;
}
Code: Select all
int PlayerData::savecollection(){
if (collection) collection->save();
return 1;
}
Newest Wagic release:
https://github.com/WagicProject/wagic/releases
How to code cards:
https://github.com/WagicProject/wagic/wiki/CardCode
Discord
https://discord.gg/k8AYAZCXuq
https://github.com/WagicProject/wagic/releases
How to code cards:
https://github.com/WagicProject/wagic/wiki/CardCode
Discord
https://discord.gg/k8AYAZCXuq