Adonthell  0.4
character_base Class Reference

Base character class containing attributes and dialog stuff. More...

#include <character_base.h>

Inheritance diagram for character_base:
Collaboration diagram for character_base:

Public Member Functions

 character_base ()
 Default constructor. More...
 
 ~character_base ()
 Destructor. More...
 
string get_name () const
 Returns the name of the character. More...
 
string get_id ()
 Returns an unique identifier of the character. More...
 
void set_name (string newname)
 Sets the name of the character. More...
 
u_int32 get_color () const
 Returns the color representing the character. More...
 
void set_color (int c)
 Sets the color representing the character. More...
 
string get_portrait () const
 Returns the current portrait of the character. More...
 
void set_portrait (string fname)
 Sets the current portrait of the character. More...
 
string get_dialogue () const
 Return the file name of the current character's dialog. More...
 
void set_dialogue (string dialogue)
 Sets the dialogue of the character. More...
 
void get_state (igzstream &in)
 Loads the state (attributes) of the character from an opened file. More...
 
void put_state (ogzstream &out)
 Saves the state (ttributes) of the character into an opened file. More...
 
- Public Member Functions inherited from storage
 storage ()
 Default constructor. More...
 
 ~storage ()
 Destructor. More...
 
void set_val (string key, s_int32 value)
 Sets key to value. More...
 
s_int32 get_val (string key)
 Returns the value of a key. More...
 
pair< string, s_int32next ()
 Returns the next (key, value) pair of the storage. More...
 
s_int32operator[] (string key)
 Returns the value of a key. More...
 
iterator begin ()
 Returns an iterator to the beginning of the storage. More...
 
iterator end ()
 Returns an iterator to the end of the storage. More...
 
u_int32 size () const
 Returns the size (number of elements) of the storage. More...
 

Additional Inherited Members

- Public Types inherited from storage
typedef hash_map< string, s_int32 >::iterator iterator
 Storage iterator, similar to STL iterator. More...
 

Detailed Description

Base character class containing attributes and dialog stuff.

Definition at line 77 of file character_base.h.

Constructor & Destructor Documentation

character_base::character_base ( )

Default constructor.

Definition at line 32 of file character_base.cc.

character_base::~character_base ( )

Destructor.

Definition at line 42 of file character_base.cc.

Member Function Documentation

string character_base::get_name ( ) const
inline

Returns the name of the character.

Returns
the name of the character.

Definition at line 97 of file character_base.h.

string character_base::get_id ( )
inline

Returns an unique identifier of the character.

Returns
  • Player for the player controlled character
  • the character's name otherwise.

Definition at line 106 of file character_base.h.

void character_base::set_name ( string  newname)

Sets the name of the character.

Parameters
newnamename of the character.

Definition at line 46 of file character_base.cc.

u_int32 character_base::get_color ( ) const
inline

Returns the color representing the character.

Returns
the color representing the character.

Definition at line 124 of file character_base.h.

void character_base::set_color ( int  c)
inline

Sets the color representing the character.

Parameters
cnew color representing the character.

Definition at line 131 of file character_base.h.

string character_base::get_portrait ( ) const
inline

Returns the current portrait of the character.

Returns
the current portrait of the character.

Definition at line 138 of file character_base.h.

void character_base::set_portrait ( string  fname)
inline

Sets the current portrait of the character.

Parameters
fnamefilename of the new portrait to use.

Definition at line 145 of file character_base.h.

string character_base::get_dialogue ( ) const
inline

Return the file name of the current character's dialog.

Returns
file name of the dialog currently assigned to this character.

Definition at line 152 of file character_base.h.

void character_base::set_dialogue ( string  dialogue)

Sets the dialogue of the character.

Parameters
dialoguenew character's dialog.

Definition at line 51 of file character_base.cc.

void character_base::get_state ( igzstream in)

Loads the state (attributes) of the character from an opened file.

Parameters
infile from which to read.
Bug:
: We should be able to pass a string to objects instead of a char *, which memory isn't freed at exit.

Definition at line 83 of file character_base.cc.

void character_base::put_state ( ogzstream out)

Saves the state (ttributes) of the character into an opened file.

Parameters
outfile where to save.

Definition at line 56 of file character_base.cc.


The documentation for this class was generated from the following files: