File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040# debug information files
4141* .dwo
4242
43+ # Save Files
44+ * .csv
45+
4346# build directory
4447build /
Original file line number Diff line number Diff line change @@ -1310,16 +1310,23 @@ bool lastManStanding(){
13101310 return activePlayers == 1 ;
13111311}
13121312
1313+ bool fileExists (const std::string& name) {
1314+ std::ifstream f (name);
1315+ return f.is_open ();
1316+ }
1317+
13131318// Main function to initialize and run the Monopoly game loop
13141319int main (){
13151320 int sel;
13161321 // Initialize Gameboard
1317- std::cout<<" Do you want to load last saved game?\n "
1318- <<" ┌────────┬────────┐\n "
1319- <<" │ 1: YES │ 0: NO │\n "
1320- <<" └────────┴────────┘\n "
1321- <<std::endl;
1322- std::cin>>sel;
1322+ if (fileExists (" Tiles.csv" ) && fileExists (" Players.csv" ) && fileExists (" OwnedStreets.csv" ) && fileExists (" otherData.csv" )) {
1323+ std::cout<<" Do you want to load last saved game?\n "
1324+ <<" ┌────────┬────────┐\n "
1325+ <<" │ 1: YES │ 0: NO │\n "
1326+ <<" └────────┴────────┘\n "
1327+ <<std::endl;
1328+ std::cin>>sel;
1329+ } else { sel = 0 ; }
13231330 if (sel == 1 && std::cin.good ()){
13241331 importFile (gameBoard);
13251332 importFile (players);
You can’t perform that action at this time.
0 commit comments