J :
* Remove ^M's. * Re-indent automatically. * Remove whitespace at the end of lines.
This commit is contained in:
@@ -1,40 +1,40 @@
|
||||
#include "../include/debug.h"
|
||||
#include "../include/PlayerData.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
PlayerData::PlayerData(MTGAllCards * allcards){
|
||||
//CREDITS
|
||||
credits = 3000; //Default value
|
||||
std::ifstream file(PLAYER_SAVEFILE);
|
||||
std::string s;
|
||||
if(file){
|
||||
if(std::getline(file,s)){
|
||||
credits = atoi(s.c_str());
|
||||
}else{
|
||||
//TODO error management
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
|
||||
//COLLECTION
|
||||
collection = NEW MTGDeck("Res/player/collection.dat", allcards->mCache , allcards);
|
||||
}
|
||||
|
||||
|
||||
int PlayerData::save(){
|
||||
std::ofstream file(PLAYER_SAVEFILE);
|
||||
char writer[10];
|
||||
if (file){
|
||||
sprintf(writer,"%i\n", credits);
|
||||
file<<writer;
|
||||
file.close();
|
||||
}
|
||||
collection->save();
|
||||
return 1;
|
||||
#include "../include/debug.h"
|
||||
#include "../include/PlayerData.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
PlayerData::PlayerData(MTGAllCards * allcards){
|
||||
//CREDITS
|
||||
credits = 3000; //Default value
|
||||
std::ifstream file(PLAYER_SAVEFILE);
|
||||
std::string s;
|
||||
if(file){
|
||||
if(std::getline(file,s)){
|
||||
credits = atoi(s.c_str());
|
||||
}else{
|
||||
//TODO error management
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
|
||||
//COLLECTION
|
||||
collection = NEW MTGDeck("Res/player/collection.dat", allcards->mCache , allcards);
|
||||
}
|
||||
|
||||
|
||||
int PlayerData::save(){
|
||||
std::ofstream file(PLAYER_SAVEFILE);
|
||||
char writer[10];
|
||||
if (file){
|
||||
sprintf(writer,"%i\n", credits);
|
||||
file<<writer;
|
||||
file.close();
|
||||
}
|
||||
collection->save();
|
||||
return 1;
|
||||
}
|
||||
|
||||
PlayerData::~PlayerData(){
|
||||
SAFE_DELETE(collection);
|
||||
}
|
||||
SAFE_DELETE(collection);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user