[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] eliot/game freegame.cpp game.cpp game.h game_mo...
From: |
Olivier Teulière |
Subject: |
[Eliot-dev] eliot/game freegame.cpp game.cpp game.h game_mo... |
Date: |
Sun, 23 Nov 2008 16:58:32 +0000 |
CVSROOT: /cvsroot/eliot
Module name: eliot
Changes by: Olivier Teulière <ipkiss> 08/11/23 16:58:32
Modified files:
game : freegame.cpp game.cpp game.h game_move_cmd.cpp
Log message:
Removed experimental support of the real bag. It was not a good idea
after all...
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/game/freegame.cpp?cvsroot=eliot&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/eliot/game/game.cpp?cvsroot=eliot&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/eliot/game/game.h?cvsroot=eliot&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/eliot/game/game_move_cmd.cpp?cvsroot=eliot&r1=1.1&r2=1.2
Patches:
Index: freegame.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/freegame.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- freegame.cpp 23 Nov 2008 16:55:28 -0000 1.25
+++ freegame.cpp 23 Nov 2008 16:58:31 -0000 1.26
@@ -234,13 +234,9 @@
// It is forbidden to change letters when the bag does not contain at
// least 7 letters (this is explicitly stated in the ODS). But it is
// still allowed to pass
-#ifdef REAL_BAG_MODE
- if (m_bag.getNbTiles() < 7 && !iToChange.empty())
-#else
Bag bag(getDic());
realBag(bag);
if (bag.getNbTiles() < 7 && !iToChange.empty())
-#endif
{
return 1;
}
Index: game.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/game.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- game.cpp 23 Nov 2008 16:55:28 -0000 1.45
+++ game.cpp 23 Nov 2008 16:58:31 -0000 1.46
@@ -125,42 +125,6 @@
m_players[currPlayer()]->setCurrentRack(pld);
}
-#ifdef REAL_BAG_MODE
-
-Bag Game::getBag() const
-{
- Bag bag = m_bag;
-
- vector<Tile> tiles;
-
- // The real content of the bag depends on the game mode
- if (getMode() == kFREEGAME)
- {
- // In freegame mode, replace the letters from all the racks
- BOOST_FOREACH(const Player *player, m_players)
- {
- player->getCurrentRack().getAllTiles(tiles);
- BOOST_FOREACH(const Tile &tile, tiles)
- {
- bag.replaceTile(tile);
- }
- }
- }
- else
- {
- // In training or duplicate mode, replace the rack of the current
- // player only
- getPlayer(m_currPlayer).getCurrentRack().getAllTiles(tiles);
- BOOST_FOREACH(const Tile &tile, tiles)
- {
- bag.replaceTile(tile);
- }
- }
-
- return bag;
-}
-
-#else
void Game::realBag(Bag &ioBag) const
{
@@ -194,7 +158,6 @@
}
}
-#endif
PlayedRack Game::helperSetRackRandom(const PlayedRack &iPld,
bool iCheck, set_rack_mode mode) const
@@ -224,12 +187,8 @@
// Create a copy of the bag in which we can do everything we want,
// and take from it the tiles of the players rack so that "bag"
// contains the right number of tiles.
-#ifdef REAL_BAG_MODE
- Bag &bag = m_bag;
-#else
Bag bag(m_dic);
realBag(bag);
-#endif
if (mode == RACK_NEW && nold != 0)
{
// We may have removed too many letters from the bag (i.e. the 'new'
@@ -448,21 +407,12 @@
PlayedRack pld;
pld.setManual(iLetters);
-#ifdef REAL_BAG_MODE
- vector<Tile> allTiles;
- m_players[p]->getCurrentRack().getAllTiles(allTiles);
- BOOST_FOREACH(const Tile &tile, allTiles)
- {
- m_bag.replaceTile(tile);
- }
-#else
Rack rack;
pld.getRack(rack);
if (!rackInBag(rack, m_bag))
{
return 1;
}
-#endif
if (iCheck)
{
@@ -474,26 +424,10 @@
min = 1;
if (!pld.checkRack(min, min))
{
-#ifdef REAL_BAG_MODE
- // Changing the rack failed, so we restore the tiles we
- // just removed
- BOOST_FOREACH(const Tile &tile, allTiles)
- {
- m_bag.takeTile(tile);
- }
-#endif
return 2;
}
}
-#ifdef REAL_BAG_MODE
- pld.getAllTiles(allTiles);
- BOOST_FOREACH(const Tile &tile, allTiles)
- {
- m_bag.takeTile(tile);
- }
-#endif
-
m_players[p]->setCurrentRack(pld);
return 0;
Index: game.h
===================================================================
RCS file: /cvsroot/eliot/eliot/game/game.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- game.h 23 Nov 2008 16:55:28 -0000 1.40
+++ game.h 23 Nov 2008 16:58:31 -0000 1.41
@@ -100,9 +100,6 @@
const Board& getBoard() const { return m_board; }
Board & accessBoard() { return m_board; }
/// Get the bag
-#ifdef REAL_BAG_MODE
- Bag getBag() const;
-#else
const Bag& getBag() const { return m_bag; }
Bag & accessBag() { return m_bag; }
/**
@@ -114,7 +111,6 @@
* it is important to set m_currPlayer accurately before!
*/
void realBag(Bag &iBag) const;
-#endif
/// Get the history of the game */
Index: game_move_cmd.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/game_move_cmd.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- game_move_cmd.cpp 23 Nov 2008 08:18:07 -0000 1.1
+++ game_move_cmd.cpp 23 Nov 2008 16:58:31 -0000 1.2
@@ -51,16 +51,6 @@
{
playRound();
}
-#ifdef REAL_BAG_MODE
- else if (m_move.getType() == Move::CHANGE_LETTERS)
- {
- // Put the changed letters back into the bag
- BOOST_FOREACH(wchar_t ch, m_move.getChangedLetters())
- {
- m_bag.replaceTile(Tile(ch));
- }
- }
-#endif
}
@@ -87,8 +77,6 @@
// method.
m_round = m_move.getRound();
-#ifdef REAL_BAG_MODE
-#else
// Update the bag
// We remove tiles from the bag only when they are played
// on the board. When going back in the game, we must only
@@ -109,7 +97,6 @@
}
}
}
-#endif
if (m_game.getVariant() == Game::kJOKER)
{
@@ -118,12 +105,8 @@
if (m_round.isPlayedFromRack(i) && m_round.isJoker(i))
{
// Get the real bag
-#ifdef REAL_BAG_MODE
- Bag &bag = m_game.accessBag();
-#else
Bag bag(m_game.getDic());
m_game.realBag(bag);
-#endif
// Is the represented letter still available in the bag?
// XXX: this way to get the represented letter sucks...
@@ -155,8 +138,6 @@
// Update the board
m_game.accessBoard().removeRound(m_game.getDic(), m_round);
-#ifdef REAL_BAG_MODE
-#else
// Update the bag
// We remove tiles from the bag only when they are played
// on the board. When going back in the game, we must only
@@ -177,6 +158,5 @@
}
}
}
-#endif
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Eliot-dev] eliot/game freegame.cpp game.cpp game.h game_mo...,
Olivier Teulière <=