Skip to content

Commit 1ac7847

Browse files
committed
export and import questioning
1 parent 244d0e5 commit 1ac7847

1 file changed

Lines changed: 32 additions & 4 deletions

File tree

monopoly.cpp

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include "FileExport.hpp"
2+
#include "FileImport.hpp"
13
#include <chrono>
24
#include <iostream>
35
#include <limits>
@@ -1299,11 +1301,22 @@ bool lastManStanding(){
12991301

13001302
// Main function to initialize and run the Monopoly game loop
13011303
int main(){
1304+
int sel;
13021305
// Initialize Gameboard
1303-
gameBoard = initializeGameBoard();
1306+
std::cout<<"Do you want to load last saved game?\n"
1307+
<<"┌────────┬────────┐\n"
1308+
<<"│ 1: YES │ 0: NO │\n"
1309+
<<"└────────┴────────┘\n"
1310+
<<std::endl;
1311+
std::cin>>sel;
1312+
if(sel == 1 && std::cin.good()){
1313+
//importFile();
1314+
}else{
1315+
gameBoard = initializeGameBoard();
1316+
players = initializePlayers();
1317+
}
13041318
chanceCards = initializeChanceCards();
13051319
communityCards = initializeCommunityCards();
1306-
players = initializePlayers();
13071320

13081321
// Randomize turn order
13091322
// create vector with player indices
@@ -1317,7 +1330,6 @@ int main(){
13171330
displayGameBoard();
13181331

13191332
//start of Gameloop :)
1320-
int sel;
13211333
do{
13221334
for( int index : turnOrder){
13231335
player &currentPlayer = players[index];
@@ -1357,7 +1369,23 @@ int main(){
13571369
}
13581370
}
13591371
} else {
1360-
std::cout << "Game ended early." << std::endl;
1372+
std::cout << "Game ended early.\n"
1373+
<<"Do you want to export the game state?\n"
1374+
<<"┌────────┬────────┐\n"
1375+
<<"│ 1: YES │ 0: NO │\n"
1376+
<<"└────────┴────────┘\n"
1377+
<< std::endl;
1378+
std::cin>>sel;
1379+
if(sel == 1 && std::cin.good()){
1380+
//exportFile();
1381+
std::cout<<"Exited with saving"<<std::endl;
1382+
1383+
}else if(sel == 0 && std::cin.good()){
1384+
std::cout<<"Exited without saving"<<std::endl;
1385+
}else{
1386+
//exportFile()
1387+
std::cout<<"Saved you :)"<<std::endl;
1388+
}
13611389
}
13621390
return 0;
13631391
}

0 commit comments

Comments
 (0)