initial commit, lordsawar source, slightly modified
[lordsawar] / src / MoveResult.cpp
1 // Copyright (C) 2004 John Farrell
2 // Copyright (C) 2005 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 #include <iostream>
20 #include "MoveResult.h"
21 #include "fight.h"
22 #include "stack.h"
23 #include "path.h"
24
25 using namespace std;
26
27 #define debug(x) {cerr<<__FILE__<<": "<<__LINE__<<": "<<x<<flush<<endl;}
28 //#define debug(x)
29
30 MoveResult::MoveResult()
31     : d_fight(false), d_stepCount(0), d_out_of_moves(false), 
32     d_reached_end(false), d_treachery(false), d_considered_treachery(false),
33     d_too_large_stack_in_the_way(false), d_fightResult(Fight::DRAW)
34 {
35 }
36
37 MoveResult::~MoveResult()
38 {
39 }
40
41 void MoveResult::fillData(Stack *s, int stepCount)
42 {
43   if (s->getPath()->size() == 0)
44     d_reached_end = true;
45
46   if (s->enoughMoves() == false)
47     d_out_of_moves = true;
48
49   d_stepCount = stepCount;
50 }
51
52 void MoveResult::setFightResult(Fight::Result fightResult)
53 {
54     d_fight = true;
55     d_fightResult = fightResult;
56 }
57 // End of file