ScummVM API documentation
annotation.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ULTIMA4_MAP_ANNOTATION_H
23 #define ULTIMA4_MAP_ANNOTATION_H
24 
25 #include "ultima/ultima4/core/coords.h"
26 #include "ultima/ultima4/core/types.h"
27 #include "ultima/ultima4/map/map_tile.h"
28 #include "common/list.h"
29 
30 namespace Ultima {
31 namespace Ultima4 {
32 
33 class Annotation;
34 
42 class Annotation {
43 public:
45 
46  Annotation(const Coords &coords, MapTile tile, bool visual = false, bool coverUp = false);
47 
48  void debug_output() const;
49 
50  // Getters
54  const Coords &getCoords() const {
55  return _coords;
56  }
57 
62  return _tile;
63  }
64 
68  bool isVisualOnly() const {
69  return _visual;
70  }
71 
75  int getTTL() const {
76  return _ttl;
77  }
78 
79  bool isCoverUp() const {
80  return _coverUp;
81  }
82 
83  // Setters
87  void setCoords(const Coords &c) {
88  _coords = c;
89  }
90 
94  void setTile(const MapTile &t) {
95  _tile = t;
96  }
97 
101  void setVisualOnly(bool v) {
102  _visual = v;
103  }
104 
108  void setTTL(int turns) {
109  _ttl = turns;
110  }
111 
115  void passTurn() {
116  if (_ttl > 0) _ttl--;
117  }
118 
119  bool operator==(const Annotation &) const;
120 
121  // Properties
122 private:
123  Coords _coords;
124  MapTile _tile;
125  bool _visual;
126  int _ttl;
127  bool _coverUp;
128 };
129 
136 public:
137  AnnotationMgr();
138 
142  Annotation *add(Coords coords, MapTile tile, bool visual = false, bool isCoverUp = false);
143 
147  Annotation::List allAt(Coords pos);
148 
152  Common::List<Annotation *> ptrsToAllAt(Coords pos);
153 
157  void clear();
158 
163  void passTurn();
164 
168  void remove(Coords pos, MapTile tile);
169  void remove(Annotation &);
170 
174  void remove(Annotation::List);
175 
179  int size() const;
180 
181 private:
182  Annotation::List _annotations;
184 };
185 
186 } // End of namespace Ultima4
187 } // End of namespace Ultima
188 
189 #endif
bool isVisualOnly() const
Definition: annotation.h:68
Definition: coords.h:31
MapTile & getTile()
Definition: annotation.h:61
Definition: detection.h:27
void setTile(const MapTile &t)
Definition: annotation.h:94
void setCoords(const Coords &c)
Definition: annotation.h:87
Definition: map_tile.h:34
const Coords & getCoords() const
Definition: annotation.h:54
void setVisualOnly(bool v)
Definition: annotation.h:101
Definition: annotation.h:42
Definition: list_intern.h:51
void passTurn()
Definition: annotation.h:115
Definition: annotation.h:135
int getTTL() const
Definition: annotation.h:75
void setTTL(int turns)
Definition: annotation.h:108