update readme
[rofl0r-oopoker.git] / host_terminal.cpp
blob01a96badba014091d9f16249f53d8be1f6c94ca6
1 /*
2 OOPoker
4 Copyright (c) 2010 Lode Vandevenne
5 All rights reserved.
7 This file is part of OOPoker.
9 OOPoker is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 OOPoker is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with OOPoker. If not, see <http://www.gnu.org/licenses/>.
23 #include "host_terminal.h"
25 #include "game.h"
26 #include "info.h"
27 #include "io_terminal.h"
28 #include "statistics.h"
29 #include "table.h"
31 HostTerminal::HostTerminal()
32 : quit(false)
33 , human_detected(false)
34 , dealCount(0)
38 void HostTerminal::onFrame()
40 if(getCharNonBlocking() == 'q') quit = true;
43 void HostTerminal::onDealDone(const Info& info)
45 dealCount++;
46 if(human_detected)
48 drawTable(info);
50 if(pressAnyKeyOrQuit()) quit = true;
52 else
54 /*if(dealCount % 10 == 0)*/ std::cout << std::endl << "Deal " << dealCount << " done." << std::endl << std::endl;
58 void HostTerminal::onGameBegin(const Info& info)
60 std::cout << std::endl;
61 drawTable(info);
64 void HostTerminal::onGameDone(const Info& info)
66 (void)info;
68 std::cout << std::endl << "Game finished. Press any key to show final events." << std::endl;
69 getChar();
72 bool HostTerminal::wantToQuit() const
74 return quit;
77 void HostTerminal::resetWantToQuit()
79 quit = false;
82 void HostTerminal::setQuitSignalFromHumanPlayer()
84 quit = true;
87 void HostTerminal::setHasHumanPlayer(bool has)
89 human_detected = has;