Newer
Older
Import / applications / Chess / AbstractChessPiece.cpp
/*
 * =====================================================================================
 *
 *       Filename:  AbstractChessPiece.cpp
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  21/02/2011 08:15:50
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  John Ryland (jryland), jryland@xiaofrog.com
 *        Company:  InvertedLogic
 *
 * =====================================================================================
 */


#include <AbstractChessPiece.h>
#include <QString>


AbstractChessPiece::AbstractChessPiece(ChessPieceType typ, ChessPieceColor col, int rank, int file)
{
   type = typ;
   color = col;
   position.rank = rank;
   position.file = file;
}


AbstractChessPiece::~AbstractChessPiece()
{
}


QString AbstractChessPiece::pieceName(ChessPieceType type)
{
    switch (type)
    {
        case Pawn:   return "Pawn";
        case Knight: return "Knight";
        case Bishop: return "Bishop";
        case Rook:   return "Rook";
        case Queen:  return "Queen";
        case King:   return "King";
        case None:   return "None";
        default:     break;
    }
    return "Unknown";
}