1// SuperTux
2// Copyright (C) 2018 Tobias Markus <tobbi@supertux.org>
3//
4// This program 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//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
18#ifndef HEADER_SUPERTUX_OBJECT_PATH_OBJECT_HPP
19#define HEADER_SUPERTUX_OBJECT_PATH_OBJECT_HPP
20
21#include <memory>
22
23#include "object/path.hpp"
24#include "object/path_walker.hpp"
25#include "util/uid.hpp"
26
27/** A class for all objects that contain / make use of a path. */
28class PathObject
29{
30public:
31 PathObject();
32 virtual ~PathObject();
33
34 /** For compatibilty reasons this needs to get the GameObjects
35 main mapping, not the (path ...) mapping */
36 void init_path(const ReaderMapping& mapping, bool running_default);
37 void init_path_pos(const Vector& pos, bool running = false);
38
39 Path* get_path() const;
40 PathWalker* get_walker() const { return m_walker.get(); }
41
42 std::string get_path_ref() const;
43
44private:
45 UID m_path_uid;
46 std::unique_ptr<PathWalker> m_walker;
47
48private:
49 PathObject(const PathObject&) = delete;
50 PathObject& operator=(const PathObject&) = delete;
51};
52
53#endif
54
55/* EOF */
56