1 // Copyright (C) 2008, 2009 Ben Asselstine
2 // Copyright (C) 2008 Ole Laursen
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Library General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 #ifndef NETWORK_PLAYER_H
20 #define NETWORK_PLAYER_H
32 /** This class implements the network player.
35 class NetworkPlayer : public Player
39 NetworkPlayer(std::string name, guint32 armyset, Gdk::Color color, int width, int height,
40 Player::Type type = Player::HUMAN, int player_no = -1);
41 NetworkPlayer(const Player&);
42 NetworkPlayer(XML_Helper* helper);
46 virtual bool save(XML_Helper* helper) const;
48 virtual bool isComputer() const {return false;};
50 //! Actions, see player.h for explanation
51 virtual void abortTurn();
52 virtual bool startTurn();
53 virtual void endTurn();
54 virtual void invadeCity(City* c);
55 virtual bool chooseHero(HeroProto *hero, City* c, int gold);
57 virtual Reward *chooseReward(Ruin *ruin, Sage *sage, Stack *stack);
58 virtual void heroGainsLevel(Hero * a);
59 virtual bool chooseTreachery (Stack *stack, Player *player, Vector <int> pos);
60 virtual Army::Stat chooseStat(Hero *hero);
61 virtual bool chooseQuest(Hero *hero);
63 void decodeAction(const Action *action);
64 void decodeActions(std::list<Action *> actions);
66 bool isConnected() const {return d_connected;}
67 void setConnected(bool connected) {d_connected = connected;}
70 bool d_abort_requested;
71 void decodeActionMove(const Action_Move *action);
72 void decodeActionSplit(const Action_Split *action);
73 void decodeActionFight(const Action_Fight *action);
74 void decodeActionJoin(const Action_Join *action);
75 void decodeActionRuin(const Action_Ruin *action);
76 void decodeActionTemple(const Action_Temple *action);
77 void decodeActionOccupy(const Action_Occupy *action);
78 void decodeActionPillage(const Action_Pillage *action);
79 void decodeActionSack(const Action_Sack *action);
80 void decodeActionRaze(const Action_Raze *action);
81 void decodeActionUpgrade(const Action_Upgrade *action);
82 void decodeActionBuy(const Action_Buy *action);
83 void decodeActionProduction(const Action_Production *action);
84 void decodeActionReward(const Action_Reward *action);
85 void decodeActionQuest(const Action_Quest *action);
86 void decodeActionEquip(const Action_Equip *action);
87 void decodeActionLevel(const Action_Level *action);
88 void decodeActionDisband(const Action_Disband *action);
89 void decodeActionModifySignpost(const Action_ModifySignpost *action);
90 void decodeActionRenameCity(const Action_RenameCity *action);
91 void decodeActionVector(const Action_Vector *action);
92 void decodeActionFightOrder(const Action_FightOrder *action);
93 void decodeActionResign(const Action_Resign *action);
94 void decodeActionPlant(const Action_Plant *action);
95 void decodeActionProduce(const Action_Produce *action);
96 void decodeActionProduceVectored(const Action_ProduceVectored *action);
97 void decodeActionDiplomacyState(const Action_DiplomacyState *action);
98 void decodeActionDiplomacyProposal(const Action_DiplomacyProposal *action);
99 void decodeActionDiplomacyScore(const Action_DiplomacyScore *action);
100 void decodeActionEndTurn(const Action_EndTurn *action);
101 void decodeActionConquerCity(const Action_ConquerCity *action);
102 void decodeActionRecruitHero(const Action_RecruitHero *action);
103 void decodeActionRenamePlayer(const Action_RenamePlayer *action);
104 void decodeActionCityTooPoorToProduce(const Action_CityTooPoorToProduce *action);
105 void decodeActionInitTurn(const Action_InitTurn*action);
106 void decodeActionLoot(const Action_Loot*action);
109 #endif // NETWORK_PLAYER_H