1 /* 2 3 Euchre - a free as in freedom and as in beer version of the 4 euchre card game 5 6 Copyright 2002 C Nathan Buckles (nbuckles@bigfoot.com) 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 2 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 22 */ 23 24 #ifndef HUMANGUIPLAYER_HPP 25 #define HUMANGUIPLAYER_HPP 26 27 #include "Game.hpp" 28 #include "Player.hpp" 29 #include "GuiPlayer.hpp" 30 31 class HumanGuiPlayer : public Player, GuiPlayer { 32 public: 33 HumanGuiPlayer(Common::PlayerPosition myPos); 34 virtual ~HumanGuiPlayer(); 35 36 virtual void setHand(const Hand& theHand); 37 virtual void assignBid(Common::Bid bid, Card::Suit trump = Card::NoSuit); 38 39 virtual int isInteractive() const; 40 virtual void setTopCard(const Card& upCard); 41 virtual void unsetTopCard(); 42 virtual Common::Bid auction1(const Card& upCard, 43 Common::PlayerPosition dealer); 44 virtual void auction1End(const Card& upCard); 45 virtual Common::Bid auction2(Card& yourTrump, 46 const Card& upCard, 47 bool stuck); 48 virtual Card discard(Card& newCard); 49 virtual void setBid(Common::PlayerPosition who, 50 Common::Bid bid); 51 virtual void setTrump(Card::Suit trump); 52 virtual Card getCard(const Round& theRound, 53 Common::PlayerPosition whoStarted); 54 virtual void finishRound(const Round& theRound, 55 Common::PlayerPosition whoStarted); 56 virtual void finishDeal(int NSPoints, int EWPoints); 57 virtual void allPass(); 58 59 int setSelectedCard(int index); 60 61 protected: 62 void resortAndShowHand(); 63 void showBidWindow(GtkWidget* window); 64 int getAutoPlayCard(const Round& theRound, 65 Common::PlayerPosition whoStarted); 66 67 enum State { 68 INIT = 0, 69 INAUCTION1, 70 INAUCTION2, 71 DISCARD1, 72 DISCARD2, 73 INROUND, 74 GETCARD1, 75 GETCARD2, 76 ENDROUND 77 }; 78 79 enum CardButtonState { 80 NO_CARD_STATE = -1, 81 VALID_CARD = 0, 82 INVALID_CARD 83 }; 84 85 State itsState; 86 int itsSelectedCard; 87 int itsPartnerLoner; 88 GtkWidget* itsCards[(Common::CARDS_PER_HAND+1)]; 89 CardButtonState itsCardStates[(Common::CARDS_PER_HAND+1)]; 90 GtkWidget* itsCardBacks[(Common::CARDS_PER_HAND+1)]; 91 92 GtkWidget* itsBidButtons[(Card::Spades+1)]; 93 GtkWidget* itsLonerBidButton; 94 GtkWidget* itsPassBidButton; 95 }; 96 97 #endif 98 99