Source Code (Use browser search to find items of interest.)
Class Index
kabalone'Move (./kdegames/kabalone/Move.h:12)
class Move
{
public:
/* Type of move: Moves are searched in this order */
enum MoveType { out2 = 0, out1with3, out1with2, push2,
push1with3, push1with2, move3, left3, right3,
left2, right2, move2, move1, none };
static const MoveType typeCount = none;
Move() { type = none; }
Move(short f, char d, MoveType t)
{ field = f; direction = d, type = t; }
bool isOutMove() const
{ return type <= out1with2; }
bool isPushMove() const
{ return type <= push1with2; }
static int maxOutType()
{ return out1with2; }
static int maxPushType()
{ return push1with2; }
static int maxMoveType()
{ return move1; }
QString name() const;
void print() const;
/* Directions */
enum { Right=1, RightDown, LeftDown, Left, LeftUp, RightUp };
short field;
char direction;
MoveType type;
};
/* MoveList stores a fixed number of moves (for efficince)
* <getNext> returns reference of next move ordered according to type
* <insert> does nothing if there isn't enough free space
*
* Recommend usage (* means 0 or more times):
* [ clear() ; insert() * ; isElement() * ; getNext() * ] *
*/
kabalone'Move::name() (./kdegames/kabalone/Move.cpp:29)
QString Move::name() const
{
QString s,tmp;
/* sideway moves... */
if (type == left3 || type == right3) {
s.setNum(field + Board::fieldDiffOfDir(direction)); /* middle of the 3 */
s+= '/';
s+= (type == left3) ? nameOfDir(direction-1): nameOfDir(direction+1);
s+= '/';
s+= i18n("Side");
}
else if ( type == left2 || type == right2) {
s.setNum(field);
s+= '/';
s+= (type == left2) ? nameOfDir(direction-1): nameOfDir(direction+1);
s+= '/';
s+= i18n("Side");
}
else {
s.setNum(field);
s += '/';
s += nameOfDir(direction);
tmp = (type <3 ) ? i18n("Out") :
(type <6 ) ? i18n("Push") : QString("");
if (!tmp.isEmpty()) {
s += '/';
s += tmp;
}
}
return s;
}
kabalone'Move::print() (./kdegames/kabalone/Move.cpp:63)
void Move::print() const
{
printf("%s", name().ascii() );
}