1//////////////////////////////////////////////////////////////////////
2// This file is part of Remere's Map Editor
3//////////////////////////////////////////////////////////////////////
4// Remere's Map Editor 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// Remere's Map Editor 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 RME_WAYPOINTS_H_
19#define RME_WAYPOINTS_H_
20
21#include "position.h"
22
23class Waypoint {
24public:
25 std::string name;
26 Position pos;
27};
28
29typedef std::map<std::string, Waypoint*> WaypointMap;
30
31class Waypoints {
32 Map& map;
33
34public:
35 Waypoints(Map& map) :
36 map(map) { }
37 ~Waypoints() {
38 for (WaypointMap::iterator iter = waypoints.begin(); iter != waypoints.end(); ++iter) {
39 delete iter->second;
40 }
41 }
42
43 void addWaypoint(Waypoint* wp);
44 Waypoint* getWaypoint(std::string name);
45 Waypoint* getWaypoint(TileLocation* location);
46 void removeWaypoint(std::string name);
47
48 WaypointMap waypoints;
49
50 WaypointMap::iterator begin() {
51 return waypoints.begin();
52 }
53 WaypointMap::const_iterator begin() const {
54 return waypoints.begin();
55 }
56 WaypointMap::iterator end() {
57 return waypoints.end();
58 }
59 WaypointMap::const_iterator end() const {
60 return waypoints.end();
61 }
62};
63
64#endif
65