eliot-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Eliot-dev] Changes to eliot/game/player.cpp


From: eliot-dev
Subject: [Eliot-dev] Changes to eliot/game/player.cpp
Date: Sun, 06 Nov 2005 09:53:15 -0500

Index: eliot/game/player.cpp
diff -u eliot/game/player.cpp:1.7 eliot/game/player.cpp:1.8
--- eliot/game/player.cpp:1.7   Sat Nov  5 23:57:41 2005
+++ eliot/game/player.cpp       Sun Nov  6 14:53:15 2005
@@ -24,6 +24,7 @@
 #include "results.h"
 #include "board.h"
 #include "player.h"
+#include "turn.h"
 
 #include "debug.h"
 
@@ -36,10 +37,8 @@
 
 Player::~Player()
 {
-    for (unsigned int i = 0; i < m_playedRacks.size(); i++)
-        delete m_playedRacks[i];
-    for (unsigned int i = 0; i < m_rounds.size(); i++)
-        delete m_rounds[i];
+    for (unsigned int i = 0; i < m_history.size(); i++)
+        delete m_history[i];
 }
 
 
@@ -57,13 +56,13 @@
 
 const PlayedRack & Player::getLastRack() const
 {
-    return *m_playedRacks.back();
+    return m_history.back()->getPlayedRack();
 }
 
 
 const Round & Player::getLastRound() const
 {
-    return *m_rounds.back();
+    return m_history.back()->getRound();
 }
 
 
@@ -74,9 +73,8 @@
  */
 void Player::endTurn(const Round &iRound, int iTurn)
 {
-    m_turns.push_back(iTurn);
-    m_rounds.push_back(new Round(iRound));
-    m_playedRacks.push_back(new PlayedRack(m_pldrack));
+    // FIXME: the number of the player is wrong here!
+    m_history.push_back(new Turn(iTurn, iTurn, m_pldrack, iRound));
 
     Rack rack;
     m_pldrack.getRack(rack);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]