initial commit, lordsawar source, slightly modified
[lordsawar] / src / MoveResult.h
diff --git a/src/MoveResult.h b/src/MoveResult.h
new file mode 100644 (file)
index 0000000..abf6b30
--- /dev/null
@@ -0,0 +1,88 @@
+// Copyright (C) 2004 John Farrell
+// Copyright (C) 2005, 2007 Ulf Lorenz
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU Library General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
+//  02110-1301, USA.
+
+#ifndef MOVE_RESULT_H
+#define MOVE_RESULT_H
+
+#include "fight.h"
+
+using namespace std;
+class Stack;
+
+/** 
+  * This is needed by the AI so it can tell when a stack dies.
+  */
+//! The result of a move by a stack.
+class MoveResult
+{
+    public:
+        MoveResult();
+        ~MoveResult();
+
+        //! set the result of any fight that happened
+        void setFightResult(Fight::Result d_fightResult);
+
+        //! set how many steps were taken in this move
+        void setStepCount(int stepCount) { d_stepCount = stepCount; }
+
+        int getStepCount() const {return d_stepCount;};
+
+        //! return the result of the fight, if there was one
+        Fight::Result getFightResult() const { return d_fightResult; }
+
+        //! did anything actually happen in this move?
+        bool didSomething() const { return (d_fight || (d_stepCount > 0) ); }
+
+       void setReachedEndOfPath(bool reached) {d_reached_end = reached;};
+       bool getReachedEndOfPath() const {return d_reached_end;}
+
+       void setOutOfMoves(bool out) {d_out_of_moves = out;}
+       bool getOutOfMoves() const {return d_out_of_moves;}
+
+       void setTreachery(bool treachery) {d_treachery = treachery;}
+       bool getTreachery() const {return d_treachery;}
+
+       void setConsideredTreachery(bool considered) {d_considered_treachery = considered;}
+       bool getConsideredTreachery() const {return d_considered_treachery;}
+
+        void setTooLargeStackInTheWay(bool s) {d_too_large_stack_in_the_way=s;}
+        bool getTooLargeStackInTheWay() const {return d_too_large_stack_in_the_way;}
+
+        void setMoveAborted(bool a) {d_move_aborted = a;}
+        bool getMoveAborted() const {return d_move_aborted;}
+
+       //! fill up d_out_of_moves, d_reached_end, and d_stepCount
+       void fillData(Stack *s, int stepCount);
+
+    private:
+        bool d_result;
+        bool d_fight;
+        int d_stepCount;
+       bool d_out_of_moves;
+       bool d_reached_end;
+       bool d_treachery;
+       bool d_considered_treachery;
+        //this is when we can't jump over a friendly stack.
+        bool d_too_large_stack_in_the_way;
+        Fight::Result d_fightResult;
+        bool d_move_aborted;
+};
+
+#endif // MOVE_RESULT_H
+
+// End of file