Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

move.h

00001 /*
00002  *   EasySok --- A(nother) sokoban game for KDE.
00003  *
00004  *   Copyright (C) 2001 by Ralf Schmelter (ralfs@pc2a.chemie.uni-dortmund.de).
00005  *
00006  *   This program is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License version 2 as
00008  *   published by the Free Software Foundation.
00009  *
00010  *   This program is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with this program; if not, write to the Free Software
00017  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  */
00019 
00020 
00021 #ifndef EASYSOK_MOVE_INC_GUARD_H
00022 #define EASYSOK_MOVE_INC_GUARD_H
00023 
00024 
00025 #include <qpoint.h>
00026 #include <qstring.h>
00027 
00028 #include "atomic_move.h"
00029 
00030 
00031 class QDataStream;
00032 
00033 
00034 
00035 
00060 class Move
00061 {
00062 
00063 public:
00064 
00069     Move();
00070 
00071 
00080     Move(QPoint from, AtomicMove atomic_move, bool stone_pushed);
00081 
00082 
00091     Move(QPoint from, QPoint to, bool stone_pushed);
00092 
00093 
00100     Move(QDataStream & stream);
00101 
00102 
00107     bool isEmpty() const;
00108 
00109 
00114     QPoint from() const;
00115 
00116 
00121     QPoint to() const;
00122 
00123 
00128     bool stonePushed() const;
00129 
00130 
00135     bool isAtomicMove() const;
00136 
00137 
00144     AtomicMove atomicMove() const;
00145 
00146 
00151     bool operator == (Move const & other_move) const;
00152 
00153 
00158     bool operator != (Move const & other_move) const;
00159 
00160 
00165     QPoint diff() const;
00166 
00167 
00172     QPoint diffSign() const;
00173 
00174 
00179     void reverse();
00180 
00181 
00186     QString toText() const;
00187 
00188 
00198     void writeToStream(QDataStream & stream) const;
00199 
00200 
00201 private:
00202 
00207     int sign(int number) const;
00208 
00209 
00214     QPoint m_from;
00215 
00216 
00221     QPoint m_to;
00222 
00223 
00228     bool m_stone_pushed;
00229 };
00230 
00231 
00232 #endif

Generated at Sun Jan 6 18:49:09 2002 for EasySok by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001