1 | /********************************************************************************** |
2 | This file is part of the game 'KTron' |
3 | |
4 | Copyright (C) 1998-2000 by Matthias Kiefer <matthias.kiefer@gmx.de> |
5 | Copyright (C) 2005 Benjamin C. Meyer <ben at meyerhome dot net> |
6 | Copyright (C) 2008-2009 Stas Verberkt <legolas at legolasweb dot nl> |
7 | |
8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
21 | |
22 | *******************************************************************************/ |
23 | |
24 | #ifndef SNAKEPART_H |
25 | #define SNAKEPART_H |
26 | |
27 | #include "object.h" |
28 | |
29 | #include <QString> |
30 | |
31 | namespace SnakePartType { |
32 | enum Types { |
33 | Empty, |
34 | Body, |
35 | Head, |
36 | Tail, |
37 | Hole |
38 | }; |
39 | } |
40 | |
41 | /** |
42 | * @short This class represents a part of a snake on the playfield |
43 | */ |
44 | class SnakePart : public Object |
45 | { |
46 | public: |
47 | SnakePart(int playerNumber); |
48 | int getPlayerNumber(); |
49 | SnakePartType::Types getPartType(); |
50 | void setPartType(SnakePartType::Types type); |
51 | bool getPartTop(); |
52 | void setPartTop(bool value); |
53 | bool getPartBottom(); |
54 | void setPartBottom(bool value); |
55 | bool getPartLeft(); |
56 | void setPartLeft(bool value); |
57 | bool getPartRight(); |
58 | void setPartRight(bool value); |
59 | void generateSVGName(); |
60 | |
61 | private: |
62 | void initialize(); |
63 | QString decodePart(); |
64 | |
65 | int m_playerNumber; |
66 | SnakePartType::Types m_partType; |
67 | bool m_partTop; |
68 | bool m_partBottom; |
69 | bool m_partLeft; |
70 | bool m_partRight; |
71 | }; |
72 | |
73 | #endif // SNAKEPART_H |
74 | |