From 34319c89704860f56406e64de47f69ce9ab693bf Mon Sep 17 00:00:00 2001 From: TheHresvelgian <sigrunhog@hotmail.com> Date: Fri, 29 Apr 2022 03:42:26 +0200 Subject: [PATCH] played against now stores playerIDs instead of pointers to enable saving --- src/kode/Tournament.cpp | 4 ++-- src/kode/player.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kode/Tournament.cpp b/src/kode/Tournament.cpp index ed3eb72..12567be 100644 --- a/src/kode/Tournament.cpp +++ b/src/kode/Tournament.cpp @@ -29,8 +29,8 @@ void Tournament::enterResults() cout << endl << "Enter results for round " << currentRound; for (int i = 0; i < nrOfTables; ++i) { - playerList[searchByID(white[i],playerList)]->playedAgainst.push_back( playerList[searchByID(black[i],playerList)]); - playerList[searchByID(black[i],playerList)]->playedAgainst.push_back(playerList[searchByID(white[i],playerList)]); + playerList[searchByID(white[i],playerList)]->playedAgainst.push_back( playerList[searchByID(black[i],playerList)]->playerID); + playerList[searchByID(black[i],playerList)]->playedAgainst.push_back(playerList[searchByID(white[i],playerList)]->playerID); playerList[searchByID(white[i],playerList)]->white++; int answer; cout << endl << "Enter results for table " << i+1 << "with " diff --git a/src/kode/player.h b/src/kode/player.h index 6d12e9a..70567b3 100644 --- a/src/kode/player.h +++ b/src/kode/player.h @@ -27,7 +27,7 @@ class Player float score; vector <int> results; //stores the results of each match, 0 for loss, 1 for draw and 2 for win - vector <Player*> playedAgainst; //has every person they have played against + vector <int> playedAgainst; //has every person they have played against Player(); Player(string name, string surName, string clubName, int rating, int playerID, float score); -- GitLab