1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#include "Player.h"
#include <iostream>
#include <fstream>
using namespace std;
Player::Player()
{
}
void Player::IncrStat(int s, int d, int a, int h, int e){
Strg += s;
Def += d;
Agil += a;
Health += h;
Exp += e;
}
void Player::DecrStat(int s, int d, int a, int h, int e){
Strg -= s;
Def -= d;
Agil -= a;
Health -= h;
Exp -= e;
}
void Player::save(){
ofstream S;
S.open("SAVE.bin", ios::binary | ios::out);
binfil.write((char*)(&Strg), sizeof(Strg));
binfil.write((char*)(&Def), sizeof(Def));
binfil.write((char*)(&Agil), sizeof(Agil));
binfil.write((char*)(&Exp), sizeof(Exp));
fbin.close();
}
void Player::load(){
ifstream S;
S.open("SAVE.bin", ios::binary | ios::in);
binfil.read((char*)(&Strg), sizeof(Strg));
binfil.read((char*)(&Def), sizeof(Def));
binfil.read((char*)(&Agil), sizeof(Agil));
binfil.read((char*)(&Exp), sizeof(Exp));
fbin.close();
}
|