Adonthell
0.4
Main Page
Related Pages
Classes
Files
File List
File Members
map_event.h
Go to the documentation of this file.
1
/*
2
$Id: map_event.h,v 1.2 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.h
17
*
18
* @author Kai Sterker
19
* @brief Declares the different map events.
20
*/
21
22
#ifndef MAP_EVENT_H__
23
#define MAP_EVENT_H__
24
25
#include "
event.h
"
26
#include "
character.h
"
27
28
/**
29
* Baseclass for map enter/leave/action events.
30
* The event will be launched if all the member's data matches.
31
*/
32
class
map_event
:
public
event
33
{
34
public
:
35
/**
36
* Default constructor.
37
*/
38
map_event
();
39
40
/**
41
* Saves the basic %event %data (such as the type or script data)
42
* to a file.
43
*
44
* @param out file where to save the %event.
45
*/
46
void
put_state
(
ogzstream
&)
const
;
47
48
/**
49
* Loads the basic %event %date from a file.
50
*
51
* @param in file to load the %event from.
52
* @return \e true if the %event could be loaded, \e false otherwise
53
*/
54
bool
get_state
(
igzstream
&);
55
56
/**
57
* Submap index (-1 for any).
58
*/
59
s_int32
submap
;
60
61
/**
62
* X position (-1 for any).
63
*/
64
s_int32
x
;
65
66
/**
67
* Y position (-1 for any).
68
*/
69
s_int32
y
;
70
71
/**
72
* Direction where the character is looking (-1 for any).
73
*/
74
s_int8
dir
;
75
76
/**
77
* Useless (for now).
78
*/
79
s_int32
map
;
80
81
/**
82
* Pointer to the mapcharacter that can launch this event (NULL for any).
83
*/
84
mapcharacter
*
c
;
85
86
/**
87
* Compare two map events for equality.
88
*
89
* @param evnt The map event to compare this to.
90
* @return <b>True</b> if the two events equal, <b>false</b> otherwise.
91
*/
92
bool
equals
(
const
event
* evnt);
93
94
/**
95
* Executes the script associated with this map %event. If the
96
* event does not repeat it is removed from the %event handler.
97
*
98
* @param evnt The %event that triggered this map %event.
99
*
100
* @return The number of times the %event needs to be repeated.
101
*/
102
s_int32
execute
(
const
event
* evnt);
103
};
104
105
106
/**
107
* To notify when a character entered a mapsquare.
108
*/
109
class
enter_event
:
public
map_event
110
{
111
public
:
112
/**
113
* Default constructor.
114
*/
115
enter_event
();
116
};
117
118
119
/**
120
* To notify when a mapcharacter left a mapsquare.
121
*/
122
class
leave_event
:
public
map_event
123
{
124
public
:
125
/**
126
* Default constructor.
127
*/
128
leave_event
();
129
};
130
131
132
/**
133
* To notify when a mapcharacter "act" on a square.
134
*/
135
class
action_event
:
public
map_event
136
{
137
public
:
138
/**
139
* Default constructor.
140
*/
141
action_event
();
142
};
143
144
#endif // MAP_EVENT_H__
src
map_event.h
Generated by
1.8.1.1