using namespace std;
-extern bool debugmode;
+extern bool devtools;
vector<Account*> Account::accounts = vector<Account*>();
return NULL;
}
}
- printf("Unexpected error : User %s not found\n", a->getName());
+ printf("Unexpected error : User %s not found\n", a->getName().c_str());
return accounts.front();
}
void Account::winLevel(int level, float score, float time)
{
- if (!debugmode) {
+ if (!devtools) {
if (score > highscore[level])
highscore[level] = score;
if (time < fasttime[level] || fasttime[level] == 0)
FILE *tfile;
int numaccounts;
int accountactive;
+ errno = 0;
tfile = fopen(filename.c_str(), "rb" );
void Account::saveFile(string filename, Account* accountactive)
{
FILE *tfile;
+ errno = 0;
tfile = fopen(filename.c_str(), "wb" );
if (tfile) {
- printf("writing %d accounts :\n", getNbAccounts());
fpackf(tfile, "Bi", getNbAccounts());
fpackf(tfile, "Bi", indice(accountactive));
for (int i = 0; i < getNbAccounts(); i++) {
Account* a = Account::get(i);
- printf("writing account %d/%d (%s)\n", i + 1, getNbAccounts(), a->getName());
+ printf("writing account %d/%d (%s)\n", i + 1, getNbAccounts(), a->getName().c_str());
fpackf(tfile, "Bi", a->difficulty);
fpackf(tfile, "Bi", a->progress);
fpackf(tfile, "Bi", a->campaignProgress.size());