00001 #ifndef GAME_H
00002 #define GAME_H
00003
00004 #include "team.h"
00005 #include <QPen>
00006
00018 class Game
00019 {
00020
00021 public:
00025 Game(void);
00026
00030 Game(int ID, Team* team1, Team* team2, int result[2]);
00031
00035 Game(int ID, Team* team1, Team* team2, int result[2], Game* leftChild, Game* rightChild);
00036
00040 Game(int ID, Team* team1, Team* team2, int result[2], QString date, QString descr);
00041 ~Game(void);
00042
00044 static const int UNDECIDED = 0;
00046 static const int WINTEAM1 = 1;
00048 static const int WINTEAM2 = 2;
00050 static const int LEFTCHILD = 0;
00052 static const int RIGHTCHILD = 1;
00054 static const int UNDEFINED = 0;
00055
00059 struct Result {
00060 int score[2];
00061 };
00062
00066 struct Bracket {
00068 int y0;
00070 int dy;
00072 int ylink;
00074 int level;
00076 int dir;
00078 int dashOffset;
00079 QPen pen;
00080 };
00081
00082
00083 struct Bracket getBracket(void) const;
00084 int getID (void) const;
00085 int getState(void) const;
00086 QString getDate(void);
00087 QString getDescr(void);
00091 Team* getTeam (int teamnum) const;
00092 struct Result getResult(void) const;
00098 Game* getChild(int dir) const;
00102 bool isChildGamesDecided(void);
00103
00107 int getTeam1(void);
00108
00112 int getTeam2(void);
00113
00117 Team* getTeam1Direct(void);
00118
00122 Team* getTeam2Direct(void);
00123
00124
00128 void setBracket(int y0, int dy, int ylink, int level, int dir, int dashOffset, QPen pen);
00129
00133 void setBracket(int y0, int dy, int ylink, int dashOffset);
00134
00138 void setTeam(int teamnum, Team* team);
00139 void setTeams(Team* team1, Team* team2);
00140 void setResult(int score[2]);
00141 void setChilds(Game* leftChild, Game* rightChild);
00142 void setPen(QPen pen);
00143 void setPenColor(int val);
00144
00145 private:
00146 int ID;
00147 Team* team1;
00148 Team* team2;
00149 struct Result result;
00150 struct Bracket bracket;
00151 Game* leftChild;
00152 Game* rightChild;
00153 QString date;
00154 QString descr;
00155
00156 };
00157
00158 #endif