initial commit, lordsawar source, slightly modified
[lordsawar] / src / MoveResult.h
1 // Copyright (C) 2004 John Farrell
2 // Copyright (C) 2005, 2007 Ulf Lorenz
3 //
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.
8 //
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.
13 //
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 
17 //  02110-1301, USA.
18
19 #ifndef MOVE_RESULT_H
20 #define MOVE_RESULT_H
21
22 #include "fight.h"
23
24 using namespace std;
25 class Stack;
26
27 /** 
28   * This is needed by the AI so it can tell when a stack dies.
29   */
30 //! The result of a move by a stack.
31 class MoveResult
32 {
33     public:
34         MoveResult();
35         ~MoveResult();
36
37         //! set the result of any fight that happened
38         void setFightResult(Fight::Result d_fightResult);
39
40         //! set how many steps were taken in this move
41         void setStepCount(int stepCount) { d_stepCount = stepCount; }
42
43         int getStepCount() const {return d_stepCount;};
44
45         //! return the result of the fight, if there was one
46         Fight::Result getFightResult() const { return d_fightResult; }
47
48         //! did anything actually happen in this move?
49         bool didSomething() const { return (d_fight || (d_stepCount > 0) ); }
50
51         void setReachedEndOfPath(bool reached) {d_reached_end = reached;};
52         bool getReachedEndOfPath() const {return d_reached_end;}
53
54         void setOutOfMoves(bool out) {d_out_of_moves = out;}
55         bool getOutOfMoves() const {return d_out_of_moves;}
56
57         void setTreachery(bool treachery) {d_treachery = treachery;}
58         bool getTreachery() const {return d_treachery;}
59
60         void setConsideredTreachery(bool considered) {d_considered_treachery = considered;}
61         bool getConsideredTreachery() const {return d_considered_treachery;}
62
63         void setTooLargeStackInTheWay(bool s) {d_too_large_stack_in_the_way=s;}
64         bool getTooLargeStackInTheWay() const {return d_too_large_stack_in_the_way;}
65
66         void setMoveAborted(bool a) {d_move_aborted = a;}
67         bool getMoveAborted() const {return d_move_aborted;}
68
69         //! fill up d_out_of_moves, d_reached_end, and d_stepCount
70         void fillData(Stack *s, int stepCount);
71
72     private:
73         bool d_result;
74         bool d_fight;
75         int d_stepCount;
76         bool d_out_of_moves;
77         bool d_reached_end;
78         bool d_treachery;
79         bool d_considered_treachery;
80         //this is when we can't jump over a friendly stack.
81         bool d_too_large_stack_in_the_way;
82         Fight::Result d_fightResult;
83         bool d_move_aborted;
84 };
85
86 #endif // MOVE_RESULT_H
87
88 // End of file