ksquares
ksquaresplayer.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 2006 by Matthew Williams <matt@milliams.com> * 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License as published by * 00006 * the Free Software Foundation; either version 2 of the License, or * 00007 * (at your option) any later version. * 00008 ***************************************************************************/ 00009 00010 #ifndef KSQUARESPLAYER_H 00011 #define KSQUARESPLAYER_H 00012 00013 #include <QColor> 00014 00023 class KSquaresPlayer 00024 { 00025 public: 00033 explicit KSquaresPlayer(const QString &newName, const QColor &newColor, bool isPlayerHuman = true) {setName(newName); playerColour = newColor; human = isPlayerHuman; playerScore = 0;} //defaults to human player 00034 00036 KSquaresPlayer() {} //Needed to do QVector<KSquaresPlayer>::operator[int i] since it has to allocate memory i think 00037 00043 void setName(const QString &newName) {playerName = newName;} 00044 00050 QString name() const {return playerName;} 00051 00057 void setScore(int newScore) {playerScore = newScore;} 00061 int score() const {return playerScore;} 00063 void incScore() {playerScore++;} 00064 00068 bool isHuman() const {return human;} 00069 00073 QColor colour() const {return playerColour;} 00074 00078 QString sig() const {return displaySig;} 00079 00085 bool operator<(const KSquaresPlayer& player) const {return score() < player.score();} 00086 00087 protected: 00089 bool human; 00091 int playerScore; 00093 QString playerName; 00095 QColor playerColour; 00097 QString displaySig; 00098 }; 00099 00100 #endif // KSQUARESPLAYER_H
KDE 4.2 API Reference