• Main Page
  • Related Pages
  • Classes
  • Files
  • File List
  • File Members

character_base.h

Go to the documentation of this file.
00001 /*
00002    $Id: character_base.h,v 1.13 2003/05/05 18:52:48 ksterker Exp $
00003    
00004    Copyright (C) 2000/2001 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 /**
00017  * @file   character_base.h
00018  * @author Kai Sterker <kaisterker@linuxgames.com>
00019  * 
00020  * @brief  Declares the character_base class.
00021  * 
00022  * 
00023  */
00024 
00025 
00026 
00027 #ifndef CHARACTER_BASE_H_
00028 #define CHARACTER_BASE_H_
00029 
00030 
00031 /**
00032  * Where dialogs are located in the data tree.
00033  * 
00034  */
00035 #define DIALOG_DIR "dialogues/"
00036 
00037 #include "storage.h"
00038 #include "fileops.h"
00039 
00040 /**
00041  * Race enumeration.
00042  * 
00043  */ 
00044 enum
00045 {
00046     DWARF = 0,
00047     ELF = 1,
00048     HALFELF = 2,
00049     HUMAN = 3
00050 };
00051 
00052 /**
00053  * Gender enumeration.
00054  * 
00055  */
00056 enum
00057 {
00058     FEMALE = 0,
00059     MALE = 1
00060 };
00061 
00062 /**
00063  * Type enumeration.
00064  *
00065  */
00066 enum
00067 {
00068     NPC = 0,
00069     PLAYER = 1,
00070     PARTY = 2
00071 };
00072 
00073 /**
00074  * Base character class containing attributes and dialog stuff.
00075  * 
00076  */ 
00077 class character_base : public storage
00078 {
00079  public:
00080     /**
00081      * Default constructor.
00082      * 
00083      */ 
00084     character_base ();
00085 
00086     /**
00087      * Destructor.
00088      * 
00089      */ 
00090     ~character_base ();
00091 
00092     /** 
00093      * Returns the name of the %character.
00094      * 
00095      * @return the name of the %character.
00096      */
00097     string get_name () const { return name; }
00098 
00099     /**
00100      * Returns an unique identifier of the %character. 
00101      *
00102      * @return
00103      *      @li <b>Player</b> for the player controlled %character
00104      *      @li the %character's name otherwise.
00105      */
00106     string get_id ()
00107     {
00108         if (get_val ("type") == PLAYER) return "Player";
00109         else return name;
00110     }
00111     
00112     /** 
00113      * Sets the name of the %character.
00114      * 
00115      * @param newname name of the %character.
00116      */
00117     void set_name (string newname);
00118 
00119     /**
00120      * Returns the color representing the %character.
00121      *
00122      * @return the color representing the %character.
00123      */
00124     u_int32 get_color() const { return color; } 
00125 
00126     /** 
00127      * Sets the color representing the %character.
00128      * 
00129      * @param c new color representing the %character.
00130      */
00131     void set_color (int c) { color = c; } 
00132     
00133     /** 
00134      * Returns the current portrait of the %character.
00135      * 
00136      * @return the current portrait of the %character.
00137      */
00138     string get_portrait() const { return portrait; } 
00139     
00140     /** 
00141      * Sets the current portrait of the %character.
00142      * 
00143      * @param fname filename of the new portrait to use.
00144      */ 
00145     void set_portrait (string fname) { portrait = fname; } 
00146     
00147     /** 
00148      * Return the file name of the current %character's dialog.
00149      * 
00150      * @return file name of the dialog currently assigned to this %character.
00151      */
00152     string get_dialogue () const { return dialogue; }
00153 
00154     /** 
00155      * Sets the dialogue of the %character.
00156      * 
00157      * @param dialogue new %character's dialog.
00158      */
00159     void set_dialogue (string dialogue);
00160 
00161     /** 
00162      * Loads the state (attributes) of the %character from an opened file.
00163      * 
00164      * @param in file from which to read.
00165      */
00166     
00167     void get_state (igzstream& in);
00168 
00169     /** 
00170      * Saves the state (ttributes) of the %character into an opened file.
00171      * 
00172      * @param out file where to save.
00173      */
00174     void put_state (ogzstream& out);
00175          
00176 private:
00177     string name;
00178     string dialogue;
00179     string portrait; 
00180     u_int32 color;
00181 };
00182 
00183 #endif

Generated on Tue Jul 27 2010 for Adonthell by  doxygen 1.7.1