| 1 | // This file is part of Dust Racing 2D. |
| 2 | // Copyright (C) 2015 Jussi Lind <[email protected]> |
| 3 | // |
| 4 | // Dust Racing 2D is free software: you can redistribute it and/or modify |
| 5 | // it under the terms of the GNU General Public License as published by |
| 6 | // the Free Software Foundation, either version 3 of the License, or |
| 7 | // (at your option) any later version. |
| 8 | // Dust Racing 2D is distributed in the hope that it will be useful, |
| 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | // GNU General Public License for more details. |
| 12 | // |
| 13 | // You should have received a copy of the GNU General Public License |
| 14 | // along with Dust Racing 2D. If not, see <http://www.gnu.org/licenses/>. |
| 15 | |
| 16 | #ifndef TRACKDATABASE_HPP |
| 17 | #define TRACKDATABASE_HPP |
| 18 | |
| 19 | #include <QString> |
| 20 | |
| 21 | class Objects; |
| 22 | class Route; |
| 23 | class MapBase; |
| 24 | |
| 25 | //! Common base class for track data shared by the editor and the game. |
| 26 | class TrackDataBase |
| 27 | { |
| 28 | public: |
| 29 | |
| 30 | //! Constructor. |
| 31 | TrackDataBase(QString name, bool isUserTrack); |
| 32 | |
| 33 | //! Copy constructor. |
| 34 | TrackDataBase(const TrackDataBase & other); |
| 35 | |
| 36 | TrackDataBase & operator=(const TrackDataBase & other) = delete; |
| 37 | |
| 38 | //! Destructor. |
| 39 | virtual ~TrackDataBase(); |
| 40 | |
| 41 | //! Get name. |
| 42 | virtual QString name() const; |
| 43 | |
| 44 | //! Set name. |
| 45 | virtual void setName(QString name); |
| 46 | |
| 47 | //! Get file name. |
| 48 | virtual QString fileName() const = 0; |
| 49 | |
| 50 | //! Set file name. |
| 51 | virtual void setFileName(QString fileName) = 0; |
| 52 | |
| 53 | //! Get lap index. |
| 54 | virtual unsigned int index() const; |
| 55 | |
| 56 | //! Set track index. |
| 57 | virtual void setIndex(unsigned int index); |
| 58 | |
| 59 | //! Get if the track is user track (unlocked by default). |
| 60 | virtual bool isUserTrack() const; |
| 61 | |
| 62 | //! Set user track option. |
| 63 | virtual void setUserTrack(bool isUserTrack); |
| 64 | |
| 65 | //! Get map object. |
| 66 | virtual MapBase & map() = 0; |
| 67 | |
| 68 | //! Get map object. |
| 69 | virtual const MapBase & map() const = 0; |
| 70 | |
| 71 | //! Get route object. |
| 72 | virtual Route & route() = 0; |
| 73 | |
| 74 | //! Get route object. |
| 75 | virtual const Route & route() const = 0; |
| 76 | |
| 77 | //! Get objects object. |
| 78 | virtual Objects & objects() = 0; |
| 79 | |
| 80 | //! Get objects object. |
| 81 | virtual const Objects & objects() const = 0; |
| 82 | |
| 83 | private: |
| 84 | QString m_name; |
| 85 | |
| 86 | unsigned int m_index; |
| 87 | |
| 88 | bool m_isUserTrack; |
| 89 | }; // namespace DataKeywords |
| 90 | |
| 91 | #endif // TRACKDATABASE_HPP |