File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#pragma once
22#include < fstream>
33#include < vector>
4- #include " Eintrag.hpp"
4+ #include " player.hpp"
5+ #include " tile.hpp"
56
6- inline void exportFile (std::vector<eintrag > *vec){
7- std::ofstream csv (" Telefonbuch .csv" );
7+ inline void exportFile (std::vector<tile > *vec){
8+ std::ofstream csv (" Tiles .csv" );
89
9- for (eintrag e : *vec){
10- csv<<e. nachname <<" ;" <<e. vorname <<" ;" <<e. telefonnummer <<" \n " ;
10+ for (tile t : *vec){
11+ csv<<t. tileIndex <<" ;" <<t. ownerId <<" ;" <<t. buyable << " ; " <<t. buyPrice << " ; " <<t. isMortgaged << " ; " <<t. housePrice << " ; " <<t. upgradeStage << " ; " <<t. price0 << " ; " <<t. price1 << " ; " <<t. price2 << " ; " <<t. price3 << " ; " <<t. price4 << " ; " <<t. price5 << " ; " <<t. color << " ; " <<t. tileName << " ; " <<t. shortName <<" \n " ;
1112 }
1213 csv.close ();
14+ }
15+
16+ inline void exportFile (std::vector<player> *vec){
17+ std::ofstream csv (" Players.csv" );
18+ std::ofstream ownedStreetsFile (" OwnedStreets.csv" );
19+
20+ for (player p : *vec){
21+ csv<<p.playerId <<" ;" <<p.symbol <<" ;" <<p.name <<" ;" <<p.money <<" ;" <<p.currentPosition <<" ;" <<p.jailed <<" ;" <<p.color <<" ;" <<p.jailCounter <<" ;" <<p.jailFreeCard <<" ;" <<p.bankrupt <<" \n " ;
22+ for (int street : p.ownedStreets ){
23+ ownedStreetsFile<<p.playerId <<" ;" <<street<<" \n " ;
24+ }
25+ }
26+ csv.close ();
27+ }
28+
29+ inline void exportFile (int freeParkingMoney, int currentPlayerTurn, std::vector<std::size_t > turnOrder){
30+ std::ofstream csv (" otherData.csv" );
31+
32+ csv<<freeParkingMoney<<" \n " ;
33+ csv<<currentPlayerTurn<<" \n " ;
34+ for (std::size_t i : turnOrder){
35+ csv<<i<<" ;" ;
36+ }
37+ csv<<" \n " ;
38+ csv.close ();
1339}
Original file line number Diff line number Diff line change @@ -81,6 +81,8 @@ const std::string RESET_COLOR = "\033[0m";
8181#include " player.hpp"
8282#include " tile.hpp"
8383#include " card.hpp"
84+ #include " FileExport.hpp"
85+ #include " FileImport.hpp"
8486std::vector<tile> gameBoard;
8587std::vector<player> players;
8688std::vector<card> communityCards;
Original file line number Diff line number Diff line change 1111#include < algorithm>
1212
1313typedef struct player {
14+ int playerId;
15+ std::string symbol;
1416 std::string name;
1517 bool jailed;
1618 int money;
1719 int currentPosition;
18- int playerId;
1920 std::vector<int > ownedStreets;
20- std::string symbol;
2121 ColorGroup color;
2222 int jailCounter;
2323 int jailFreeCard;
You can’t perform that action at this time.
0 commit comments