Adonthell  0.4
map_event_handler.h
Go to the documentation of this file.
1 /*
2  $Id: map_event_handler.h,v 1.3 2002/08/18 19:53:17 ksterker Exp $
3 
4  Copyright (C) 2002 Kai Sterker <kaisterker@linuxgames.com>
5  Part of the Adonthell Project http://adonthell.linuxgames.com
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.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 /**
16  * @file map_event_handler.h
17  *
18  * @author Kai Sterker
19  * @brief Declares the map_event_handler class.
20  */
21 
22 #ifndef MAP_EVENT_HANDLER_H__
23 #define MAP_EVENT_HANDLER_H__
24 
25 #include <vector>
26 #include "event_handler_base.h"
27 
28 using std::vector;
29 
30 /**
31  * This class keeps track of map events, i.e. events that are raised
32  * when a character enters or leaves a tile, or initiates an action.
33  */
35 {
36 public:
37  /**
38  * Register a map %event with the %event handler. The %event
39  * needs to be removed before it can be safely deleted.
40  *
41  * @param evnt Pointer to the %event to be registered.
42  */
43  void register_event (event *evnt);
44 
45  /**
46  * Removes the given %event from the %event handler. Once it is
47  * no longer needed, it can be freed.
48  *
49  * @param evnt Pointer to the %event to be removed.
50  */
51  void remove_event (event *evnt);
52 
53  /**
54  * Raise one or more events in case the given 'trigger' matches.
55  * Unless they need to be repeated, they are removed from the
56  * %event-vector.
57  *
58  * @param evnt A map_event structure.
59  */
60  void raise_event (const event *evnt);
61 
62 private:
63  // storage for registered time events.
64  vector<event*> Events;
65 };
66 
67 #endif // MAP_EVENT_HANDLER_H__
This is the base class for actual event handlers.
Base class for events.
Definition: event.h:71
This class keeps track of map events, i.e.
Declares the base class for event handlers.
void register_event(event *evnt)
Register a map event with the event handler.
void raise_event(const event *evnt)
Raise one or more events in case the given 'trigger' matches.
void remove_event(event *evnt)
Removes the given event from the event handler.