3 * Summary: Level markers (annotations).
4 * Created by: dshaligram on Sat Jul 21 12:17:29 2007 UTC
18 //////////////////////////////////////////////////////////////////////////
24 void remove_markers_and_listeners_at(coord_def p
);
26 bool marker_vetoes_operation(const char *op
);
27 bool feature_marker_at(const coord_def
&pos
, dungeon_feature_type feat
);
28 coord_def
find_marker_position_by_prop(const std::string
&prop
,
29 const std::string
&expected
= "");
30 std::vector
<coord_def
> find_marker_positions_by_prop(
31 const std::string
&prop
,
32 const std::string
&expected
= "",
33 unsigned maxresults
= 0);
34 std::vector
<map_marker
*> find_markers_by_prop(
35 const std::string
&prop
,
36 const std::string
&expected
= "",
37 unsigned maxresults
= 0);
42 map_marker(map_marker_type type
, const coord_def
&pos
);
43 virtual ~map_marker();
45 map_marker_type
get_type() const { return type
; }
47 virtual map_marker
*clone() const = 0;
48 virtual void activate(bool verbose
= true);
49 virtual void write(writer
&) const;
50 virtual void read(reader
&);
51 virtual std::string
debug_describe() const = 0;
52 virtual std::string
property(const std::string
&pname
) const;
54 static map_marker
*read_marker(reader
&);
55 static map_marker
*parse_marker(const std::string
&text
,
56 const std::string
&ctx
= "")
65 typedef map_marker
*(*marker_reader
)(reader
&, map_marker_type
);
66 typedef map_marker
*(*marker_parser
)(const std::string
&,
68 static marker_reader readers
[NUM_MAP_MARKER_TYPES
];
69 static marker_parser parsers
[NUM_MAP_MARKER_TYPES
];
72 class map_feature_marker
: public map_marker
75 map_feature_marker(const coord_def
&pos
= coord_def(0, 0),
76 dungeon_feature_type feat
= DNGN_UNSEEN
);
77 map_feature_marker(const map_feature_marker
&other
);
78 void write(writer
&) const;
80 std::string
debug_describe() const;
81 map_marker
*clone() const;
82 static map_marker
*read(reader
&, map_marker_type
);
83 static map_marker
*parse(const std::string
&s
, const std::string
&)
87 dungeon_feature_type feat
;
90 class map_corruption_marker
: public map_marker
93 map_corruption_marker(const coord_def
&pos
= coord_def(0, 0),
96 void write(writer
&) const;
98 map_marker
*clone() const;
99 std::string
debug_describe() const;
101 static map_marker
*read(reader
&, map_marker_type
);
107 class map_tomb_marker
: public map_marker
110 map_tomb_marker(const coord_def
& pos
= coord_def(0, 0),
111 int dur
= 0, int src
= 0, int targ
= 0);
113 void write(writer
&) const;
115 map_marker
*clone() const;
116 std::string
debug_describe() const;
118 static map_marker
*read(reader
&, map_marker_type
);
121 int duration
, source
, target
;
124 class map_malign_gateway_marker
: public map_marker
127 map_malign_gateway_marker (const coord_def
& pos
= coord_def(0, 0),
128 int dur
= 0, bool ip
= false, std::string caster
= "",
129 beh_type bh
= BEH_HOSTILE
, god_type gd
= GOD_NO_GOD
,
132 void write (writer
&) const;
133 void read (reader
&);
134 map_marker
*clone() const;
135 std::string
debug_describe() const;
137 static map_marker
*read(reader
&, map_marker_type
);
142 bool monster_summoned
;
143 std::string summoner_string
;
149 // A marker powered by Lua.
150 class map_lua_marker
: public map_marker
, public dgn_event_listener
154 map_lua_marker(const lua_datum
&function
);
155 map_lua_marker(const std::string
&s
, const std::string
&ctx
,
156 bool mapdef_marker
= true);
159 void activate(bool verbose
);
161 void write(writer
&) const;
163 map_marker
*clone() const;
164 std::string
debug_describe() const;
165 std::string
property(const std::string
&pname
) const;
167 bool notify_dgn_event(const dgn_event
&e
);
169 static map_marker
*read(reader
&, map_marker_type
);
170 static map_marker
*parse(const std::string
&s
, const std::string
&)
173 std::string
debug_to_string() const;
176 std::auto_ptr
<lua_datum
> marker_table
;
179 void check_register_table();
180 bool get_table() const;
181 void push_fn_args(const char *fn
) const;
182 bool callfn(const char *fn
, bool warn_err
= false, int args
= -1) const;
183 std::string
call_str_fn(const char *fn
) const;
186 class map_wiz_props_marker
: public map_marker
189 map_wiz_props_marker(const coord_def
&pos
= coord_def(0, 0));
190 map_wiz_props_marker(const map_wiz_props_marker
&other
);
191 void write(writer
&) const;
193 std::string
debug_describe() const;
194 std::string
property(const std::string
&pname
) const;
195 std::string
set_property(const std::string
&key
, const std::string
&val
);
196 map_marker
*clone() const;
197 static map_marker
*read(reader
&, map_marker_type
);
198 static map_marker
*parse(const std::string
&s
, const std::string
&)
202 std::map
<std::string
, std::string
> properties
;