00001 /* 00002 $Id: map_event_handler.h,v 1.3 2002/08/18 19:53:17 ksterker Exp $ 00003 00004 Copyright (C) 2002 Kai Sterker <kaisterker@linuxgames.com> 00005 Part of the Adonthell Project http://adonthell.linuxgames.com 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License. 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY. 00011 00012 See the COPYING file for more details. 00013 */ 00014 00015 /** 00016 * @file map_event_handler.h 00017 * 00018 * @author Kai Sterker 00019 * @brief Declares the map_event_handler class. 00020 */ 00021 00022 #ifndef MAP_EVENT_HANDLER_H__ 00023 #define MAP_EVENT_HANDLER_H__ 00024 00025 #include <vector> 00026 #include "event_handler_base.h" 00027 00028 using std::vector; 00029 00030 /** 00031 * This class keeps track of map events, i.e. events that are raised 00032 * when a character enters or leaves a tile, or initiates an action. 00033 */ 00034 class map_event_handler : public event_handler_base 00035 { 00036 public: 00037 /** 00038 * Register a map %event with the %event handler. The %event 00039 * needs to be removed before it can be safely deleted. 00040 * 00041 * @param evnt Pointer to the %event to be registered. 00042 */ 00043 void register_event (event *evnt); 00044 00045 /** 00046 * Removes the given %event from the %event handler. Once it is 00047 * no longer needed, it can be freed. 00048 * 00049 * @param evnt Pointer to the %event to be removed. 00050 */ 00051 void remove_event (event *evnt); 00052 00053 /** 00054 * Raise one or more events in case the given 'trigger' matches. 00055 * Unless they need to be repeated, they are removed from the 00056 * %event-vector. 00057 * 00058 * @param evnt A map_event structure. 00059 */ 00060 void raise_event (const event *evnt); 00061 00062 private: 00063 // storage for registered time events. 00064 vector<event*> Events; 00065 }; 00066 00067 #endif // MAP_EVENT_HANDLER_H__