File indexing completed on 2024-07-21 03:47:42

0001 /***************************************************************************
0002                                cmaplevel.h
0003                              -------------------
0004     begin                : Tue Mar 20 2001
0005     copyright            : (C) 2001 by Kmud Developer Team
0006     email                : kmud-devel@kmud.de
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 
0019 #ifndef CMAPLEVEL_H
0020 #define CMAPLEVEL_H
0021 
0022 #include <QList>
0023 #include <QPoint>
0024 #include <QString>
0025 
0026 #include <kmuddy_export.h>
0027 
0028 class CMapManager;
0029 class CMapRoom;
0030 class CMapText;
0031 class CMapZone;
0032 class CMapElement;
0033 
0034 /**The map level class used to store the map elements
0035   *@author Kmud Developer Team
0036   */
0037 class KMUDDY_EXPORT CMapLevel
0038 {
0039 public:
0040     CMapLevel(CMapManager *mapManager, int pos);
0041     ~CMapLevel();
0042 
0043     /** Get the list of rooms */
0044     QList<CMapRoom *> *getRoomList() { return &m_roomList; }
0045     /** Get the list of text elements */
0046     QList<CMapText *> *getTextList() { return &m_textList; }
0047 
0048         QString getName() const;
0049         void setName(const QString &name);
0050 
0051     /** Used to get the pointer to the previous level */
0052     CMapLevel *getPrevLevel(void);
0053     /** Used to get the pointer to the next level */
0054     CMapLevel *getNextLevel(void);
0055     /** Used to get the zone that the level is in */
0056     CMapZone *getZone(void) const;
0057     /** Used to get the number of the level */
0058     int getNumber(void) const;
0059 
0060         /** Retrieve all elements in the level */
0061         QList<CMapElement *> getAllElements();
0062     /** This is used to get a unique ID for the level */
0063     uint getLevelID(void) const;
0064     /** This is used to set the level ID for the level */
0065     void setLevelID(unsigned int id);
0066     /** Used to find a room with the ID */
0067     CMapRoom *findRoom(unsigned int id);
0068     /** Used to find a room with the ID */
0069     CMapText *findText(unsigned int id);
0070 
0071     QList<CMapElement *> elementsUnderMouse(QPoint mousePos);
0072     CMapElement *findElementAt(QPoint pos, int type = -1);
0073     CMapRoom *findRoomAt(QPoint pos);
0074 
0075 private:
0076     unsigned int m_ID;
0077     CMapManager *m_mapManager;
0078 
0079     /** An array of the elements in the level */
0080     QList<CMapRoom *> m_roomList;
0081     QList<CMapText *> m_textList;
0082         QString name;
0083 };
0084 
0085 #endif