1 // Copyright (C) 2004 John Farrell
2 // Copyright (C) 2005, 2007 Ulf Lorenz
3 // Copyright (C) 2009, 2010, 2014 Ben Asselstine
4 //
5 //  This program is free software; you can redistribute it and/or modify
6 //  it under the terms of the GNU General Public License as published by
7 //  the Free Software Foundation; either version 3 of the License, or
8 //  (at your option) any later version.
9 //
10 //  This program is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU Library General Public License for more details.
14 //
15 //  You should have received a copy of the GNU General Public License
16 //  along with this program; if not, write to the Free Software
17 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 //  02110-1301, USA.
19 
20 #pragma once
21 #ifndef MOVE_RESULT_H
22 #define MOVE_RESULT_H
23 
24 #include "fight.h"
25 
26 class Stack;
27 
28 /**
29   * This is needed by the AI so it can tell when a stack dies.
30   */
31 //! The result of a move by a stack.
32 class MoveResult
33 {
34     public:
35         MoveResult();
~MoveResult()36         ~MoveResult() {};
37 
38         //! set the result of any fight that happened
39         void setFightResult(Fight::Result d_fightResult);
40 
41         //! set how many steps were taken in this move
setStepCount(int stepCount)42         void setStepCount(int stepCount) { d_stepCount = stepCount; }
43 
getStepCount()44         int getStepCount() const {return d_stepCount;};
45 
46         //! return the result of the fight, if there was one
getFightResult()47         Fight::Result getFightResult() const { return d_fightResult; }
48 
49         //! did anything actually happen in this move?
didSomething()50         bool didSomething() const { return (d_fight || (d_stepCount > 0) ); }
51 
setReachedEndOfPath(bool reached)52 	void setReachedEndOfPath(bool reached) {d_reached_end = reached;};
getReachedEndOfPath()53 	bool getReachedEndOfPath() const {return d_reached_end;}
54 
setOutOfMoves(bool out)55 	void setOutOfMoves(bool out) {d_out_of_moves = out;}
getOutOfMoves()56 	bool getOutOfMoves() const {return d_out_of_moves;}
57 
setTreachery(bool treachery)58 	void setTreachery(bool treachery) {d_treachery = treachery;}
getTreachery()59 	bool getTreachery() const {return d_treachery;}
60 
setConsideredTreachery(bool considered)61 	void setConsideredTreachery(bool considered) {d_considered_treachery = considered;}
getConsideredTreachery()62 	bool getConsideredTreachery() const {return d_considered_treachery;}
63 
setTooLargeStackInTheWay(bool s)64         void setTooLargeStackInTheWay(bool s) {d_too_large_stack_in_the_way=s;}
getTooLargeStackInTheWay()65         bool getTooLargeStackInTheWay() const {return d_too_large_stack_in_the_way;}
66 
setMoveAborted(bool a)67         void setMoveAborted(bool a) {d_move_aborted = a;}
getMoveAborted()68         bool getMoveAborted() const {return d_move_aborted;}
69 
setComputerGotQuest(bool got_quest)70         void setComputerGotQuest(bool got_quest) {d_computer_got_quest = got_quest;}
getComputerGotQuest()71         bool getComputerGotQuest() const {return d_computer_got_quest;}
72 
setComputerSearchedTemple(bool searched)73         void setComputerSearchedTemple(bool searched) {d_computer_searched_temple = searched;}
getComputerSearchedTemple()74         bool getComputerSearchedTemple() {return d_computer_searched_temple;}
75 
setComputerSearchedRuin(bool searched)76         void setComputerSearchedRuin(bool searched) {d_computer_searched_ruin = searched;}
getComputerSearchedRuin()77         bool getComputerSearchedRuin() {return d_computer_searched_ruin;}
78 
setRuinFightResult(Fight::Result result)79         void setRuinFightResult(Fight::Result result) {d_ruinfightResult = result;}
getRuinFightResult()80         Fight::Result getRuinFightResult() const {return d_ruinfightResult;}
81 
setComputerPickedUpBag(bool picked_up)82         void setComputerPickedUpBag(bool picked_up) {d_computer_picked_up_bag = picked_up;}
getComputerPickedUpBag()83         bool getComputerPickedUpBag() {return d_computer_picked_up_bag;}
84 	//! fill up d_out_of_moves, d_reached_end, and d_stepCount
85 	void fillData(Stack *s, int stepCount, bool searched_temple, bool searched_ruin, bool got_quest, bool picked_up);
86 
87     private:
88         bool d_result;
89         bool d_fight;
90         int d_stepCount;
91 	bool d_out_of_moves;
92 	bool d_reached_end;
93 	bool d_treachery;
94 	bool d_considered_treachery;
95         //this is when we can't jump over a friendly stack.
96         bool d_too_large_stack_in_the_way;
97         Fight::Result d_fightResult;
98         bool d_move_aborted;
99         bool d_computer_searched_temple;
100         bool d_computer_searched_ruin;
101         bool d_computer_got_quest;
102         Fight::Result d_ruinfightResult;
103         bool d_computer_picked_up_bag;
104 };
105 
106 #endif // MOVE_RESULT_H
107 
108 // End of file
109