Adonthell
0.4
Main Page
Related Pages
Classes
Files
File List
File Members
character_base.h
Go to the documentation of this file.
1
/*
2
$Id: character_base.h,v 1.13 2003/05/05 18:52:48 ksterker Exp $
3
4
Copyright (C) 2000/2001 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
/**
17
* @file character_base.h
18
* @author Kai Sterker <kaisterker@linuxgames.com>
19
*
20
* @brief Declares the character_base class.
21
*
22
*
23
*/
24
25
26
27
#ifndef CHARACTER_BASE_H_
28
#define CHARACTER_BASE_H_
29
30
31
/**
32
* Where dialogs are located in the data tree.
33
*
34
*/
35
#define DIALOG_DIR "dialogues/"
36
37
#include "
storage.h
"
38
#include "
fileops.h
"
39
40
/**
41
* Race enumeration.
42
*
43
*/
44
enum
45
{
46
DWARF = 0,
47
ELF = 1,
48
HALFELF = 2,
49
HUMAN = 3
50
};
51
52
/**
53
* Gender enumeration.
54
*
55
*/
56
enum
57
{
58
FEMALE = 0,
59
MALE = 1
60
};
61
62
/**
63
* Type enumeration.
64
*
65
*/
66
enum
67
{
68
NPC = 0,
69
PLAYER = 1,
70
PARTY = 2
71
};
72
73
/**
74
* Base character class containing attributes and dialog stuff.
75
*
76
*/
77
class
character_base
:
public
storage
78
{
79
public
:
80
/**
81
* Default constructor.
82
*
83
*/
84
character_base
();
85
86
/**
87
* Destructor.
88
*
89
*/
90
~character_base
();
91
92
/**
93
* Returns the name of the %character.
94
*
95
* @return the name of the %character.
96
*/
97
string
get_name
()
const
{
return
name; }
98
99
/**
100
* Returns an unique identifier of the %character.
101
*
102
* @return
103
* @li <b>Player</b> for the player controlled %character
104
* @li the %character's name otherwise.
105
*/
106
string
get_id
()
107
{
108
if
(
get_val
(
"type"
) == PLAYER)
return
"Player"
;
109
else
return
name;
110
}
111
112
/**
113
* Sets the name of the %character.
114
*
115
* @param newname name of the %character.
116
*/
117
void
set_name
(
string
newname);
118
119
/**
120
* Returns the color representing the %character.
121
*
122
* @return the color representing the %character.
123
*/
124
u_int32
get_color
()
const
{
return
color; }
125
126
/**
127
* Sets the color representing the %character.
128
*
129
* @param c new color representing the %character.
130
*/
131
void
set_color
(
int
c) { color = c; }
132
133
/**
134
* Returns the current portrait of the %character.
135
*
136
* @return the current portrait of the %character.
137
*/
138
string
get_portrait
()
const
{
return
portrait; }
139
140
/**
141
* Sets the current portrait of the %character.
142
*
143
* @param fname filename of the new portrait to use.
144
*/
145
void
set_portrait
(
string
fname) { portrait = fname; }
146
147
/**
148
* Return the file name of the current %character's dialog.
149
*
150
* @return file name of the dialog currently assigned to this %character.
151
*/
152
string
get_dialogue
()
const
{
return
dialogue; }
153
154
/**
155
* Sets the dialogue of the %character.
156
*
157
* @param dialogue new %character's dialog.
158
*/
159
void
set_dialogue
(
string
dialogue);
160
161
/**
162
* Loads the state (attributes) of the %character from an opened file.
163
*
164
* @param in file from which to read.
165
*/
166
167
void
get_state
(
igzstream
& in);
168
169
/**
170
* Saves the state (ttributes) of the %character into an opened file.
171
*
172
* @param out file where to save.
173
*/
174
void
put_state
(
ogzstream
& out);
175
176
private
:
177
string
name;
178
string
dialogue;
179
string
portrait;
180
u_int32
color;
181
};
182
183
#endif
src
character_base.h
Generated by
1.8.1.2