File indexing completed on 2024-04-28 04:04:39
0001 /* 0002 This file is part of the game 'KTron' 0003 0004 SPDX-FileCopyrightText: 1998-2000 Matthias Kiefer <matthias.kiefer@gmx.de> 0005 SPDX-FileCopyrightText: 2005 Benjamin C. Meyer <ben at meyerhome dot net> 0006 SPDX-FileCopyrightText: 2008-2009 Stas Verberkt <legolas at legolasweb dot nl> 0007 0008 SPDX-License-Identifier: GPL-2.0-or-later 0009 0010 */ 0011 0012 #ifndef SNAKEPART_H 0013 #define SNAKEPART_H 0014 0015 #include "object.h" 0016 0017 #include <QString> 0018 0019 namespace SnakePartType { 0020 enum Types { 0021 Empty, 0022 Body, 0023 Head, 0024 Tail, 0025 Hole 0026 }; 0027 } 0028 0029 /** 0030 * @short This class represents a part of a snake on the playfield 0031 */ 0032 class SnakePart : public Object 0033 { 0034 public: 0035 explicit SnakePart(int playerNumber); 0036 int getPlayerNumber(); 0037 SnakePartType::Types getPartType() const; 0038 void setPartType(SnakePartType::Types type); 0039 bool getPartTop() const; 0040 void setPartTop(bool value); 0041 bool getPartBottom() const; 0042 void setPartBottom(bool value); 0043 bool getPartLeft() const; 0044 void setPartLeft(bool value); 0045 bool getPartRight() const; 0046 void setPartRight(bool value); 0047 void generateSVGName(); 0048 0049 private: 0050 void initialize(); 0051 QString decodePart(); 0052 0053 int m_playerNumber; 0054 SnakePartType::Types m_partType; 0055 bool m_partTop; 0056 bool m_partBottom; 0057 bool m_partLeft; 0058 bool m_partRight; 0059 }; 0060 0061 #endif // SNAKEPART_H