Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (event.key.keysym.sym == SDLK_b) { // ce prtisnemo b
- bool ena;
- ifstream dat("prazna.bin", ios::binary);
- if (dat.is_open())
- {
- dat.read((char *)&ena, sizeof(ena));
- if (ena == 1) {
- GameRunning = 0;
- MenuRunning = 0;
- prebrano2 = 1;
- }
- else {
- dat.close();
- dat.open("enemy.bin", ios::binary);
- int i = 0;
- if (dat.is_open()) {
- xx tmp;
- list<xx>::iterator iterator = EnemyL.begin();
- bool okej = 1;
- if (EnemyL.size() == 0) okej = 0;
- while (dat.read((char *)&tmp, sizeof(tmp))) {
- if (okej == 1) {
- if (iterator != EnemyL.end()) {
- iterator->x = tmp.x;
- iterator->y = tmp.y;
- iterator++;
- }
- else {
- iterator = EnemyL.begin();
- EnemyL.push_back(tmp);
- }
- }
- else {
- EnemyL.push_back(tmp);
- }
- }
- dat.close();
- }
- dat.open("smeti.bin", ios::binary);
- if (dat.is_open()) {
- trash tmp;
- bool okej = 1;
- if (TrashL.size() == 0) {
- okej = 0;
- }
- list<trash>::iterator iterator = TrashL.begin();
- while (dat.read((char *)&tmp, sizeof(tmp))) {
- if (okej==1){
- if (iterator != TrashL.end()) {
- iterator->x = tmp.x;
- iterator->y = tmp.y;
- iterator++;
- }
- else {
- iterator = TrashL.begin();
- TrashL.push_back(tmp);
- }
- }
- else {
- TrashL.push_back(tmp);
- }
- }
- dat.close();
- }
- dat.open("ally.bin", ios::binary);
- if (dat.is_open()) {
- ally tmp;
- bool okej = 1;
- if (AllyL.size() == 0) {
- okej = 0;
- }
- list<ally>::iterator iterator = AllyL.begin();
- while (dat.read((char *)&tmp, sizeof(tmp))) {
- if (okej == 1) {
- if (iterator != AllyL.end()) {
- iterator->x = tmp.x;
- iterator->y = tmp.y;
- iterator++;
- }
- else {
- iterator = AllyL.begin();
- AllyL.push_back(tmp);
- }
- }
- else {
- AllyL.push_back(tmp);
- }
- }
- dat.close();
- }
- dat.open("player.bin", ios::binary);
- if (dat.is_open()) {
- dat.read((char *)&boat, sizeof(boat));
- dat.close();
- }
- dat.open("tocke.bin", ios::binary);
- if (dat.is_open()) {
- dat.read((char *)&tocke, sizeof(tocke));
- dat.close();
- }
- MenuRunning = 0;
- }
- }
- else {
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement