personObj Class Reference

#include <person-obj.hpp>

Inheritance diagram for personObj:

Inheritance graph
[legend]
Collaboration diagram for personObj:

Collaboration graph
[legend]
List of all members.

Detailed Description

Defines a base class from which PC and NPC character classes can be derived. Common to all such are physical characteristics which are set here.

Definition at line 48 of file person-obj.hpp.

Public Member Functions

 personObj ()
void setStrength (int s)
int getStrength ()
void setDexterity (int d)
int getDexterity ()
void setEndurance (int c)
int getEndurance ()
int getIntelligence ()
void setIntelligence (int i)
int getEducation ()
void setEducation (int e)
void setSocialStanding (int s)
int getSocialStanding ()
int getAge ()
void setAge (int a)
void incrementAttribute (int attr, int incr)
int getIndexedAttribute (int ix)
void incrementStrength (int ix)
void incrementDexterity (int ix)
void incrementEndurance (int ix)
void incrementIntelligence (int ix)
void incrementEducation (int ix)
void incrementSocialStanding (int ix)
void incrementAge (int ix)
void setService (char *s)
char * getService ()
int wasRejected ()
void setAccepted (int i)
int getAccepted ()
int survived ()
void setAlive (int a)
int getAlive ()
void setTerms (int t)
int getTerms ()
int getCommissioned ()
void setCommissioned (int c)
void setRank (int r)
int getRank ()
void setCash (double c)
double getCash ()
char ** listOfSkills ()
char * toString ()
char * UPPasString ()
void addSkill (int s, int l)
int skillCount ()
char * listOfSkillString ()
skillListgetSkillList ()
materialBenefitListgetBenefitList ()
void addMaterialBenefit (materialBenefit *b)


Constructor & Destructor Documentation

personObj::personObj (  ) 

Non paramitized constructor.

Definition at line 33 of file person-obj.cpp.

00033                     {
00034         int ix;
00035         for(ix=0;ix<6;ix++){
00036                 physical_stats.upp[ix]=d2d6();
00037         }
00038         age = 18;
00039         accepted=0;
00040         alive=1;
00041         terms=0;
00042         rank=0;
00043         commissioned=0;
00044         cash=0;
00045         skills = new skillList();
00046         musterOutBenefits = new materialBenefitList();
00047         
00048 }


Member Function Documentation

void personObj::addMaterialBenefit ( materialBenefit b  ) 

Add a material muster out benefit

Parameters:
b pointer to a materialBenefit derived object

Definition at line 263 of file person-obj.cpp.

References materialBenefitList::addBenefit().

00263                                                     {
00264         musterOutBenefits->addBenefit(b);
00265 }

Here is the call graph for this function:

void personObj::addSkill ( int  s,
int  l 
)

Add a skill to this character.

Parameters:
s -- integer index into the skill desired.
l -- integer value for level of skill to add.

Definition at line 237 of file person-obj.cpp.

References skillList::addSkill().

Referenced by b1MarinePerson::enlist(), and b1ArmyPerson::enlist().

00237                                    {
00238         skills->addSkill(new skillObj(this,s,l));
00239                 
00240 }

Here is the call graph for this function:

Here is the caller graph for this function:

int personObj::getAccepted (  ) 

Get the state of the accepted flag.

Returns:
1 if accepted 0 if not.

Definition at line 199 of file person-obj.cpp.

00199                           {
00200         return accepted;
00201 }

int personObj::getAge (  ) 

Get the age attribute

Returns:
integer value for age

Definition at line 184 of file person-obj.cpp.

Referenced by book1Person::toStdOut().

00184                      { 
00185         return age;
00186 }

Here is the caller graph for this function:

int personObj::getAlive (  ) 

Get the state of this character. 1 if alive, 0 if dead.

Returns:
integer value representing the living state of this character.

Definition at line 221 of file person-obj.cpp.

00221                        {
00222         return alive;
00223 }

materialBenefitList * personObj::getBenefitList (  ) 

Get the material benefits list

Returns:
pointer to the musterOutBenefits member

Definition at line 259 of file person-obj.cpp.

Referenced by book1Person::XMLout().

00259                                               {
00260         return musterOutBenefits;
00261 }

Here is the caller graph for this function:

double personObj::getCash (  ) 

Get the amount of cash the character has.

Returns:
double value for the cash the character has...

Definition at line 251 of file person-obj.cpp.

00251                          {
00252         return cash;
00253 }

int personObj::getCommissioned (  ) 

Get the state of if this character has earned an officer's commission.

Returns:
integer value 1 if character has earned a commisssion 0 if not.

Definition at line 49 of file person-obj.cpp.

Referenced by book1Person::toStdOut().

00049                               {
00050         return commissioned;
00051 }

Here is the caller graph for this function:

int personObj::getDexterity (  ) 

get the dexterity attribute

Returns:
integer value of dexterity

Definition at line 148 of file person-obj.cpp.

00148                            { 
00149         return physical_stats.a.dexterity;
00150 }

int personObj::getEducation (  ) 

Get the education attribute

Returns:
integer value of education

Definition at line 168 of file person-obj.cpp.

Referenced by b1NavyPerson::enlist(), b1MarinePerson::enlist(), and b1ArmyPerson::enlist().

00168                            { 
00169         return physical_stats.a.education; 
00170 }

Here is the caller graph for this function:

int personObj::getEndurance (  ) 

get the endurance attribute

Returns:
integer value of endurance

Definition at line 156 of file person-obj.cpp.

Referenced by b1ArmyPerson::enlist().

00156                            { 
00157         return physical_stats.a.endurance;
00158 }

Here is the caller graph for this function:

int personObj::getIndexedAttribute ( int  ix  ) 

Get an indexed attribute

Parameters:
ix index into the parameter array

Definition at line 70 of file person-obj.cpp.

00070                                         {
00071         return this->physical_stats.upp[ix];
00072 }

int personObj::getIntelligence (  ) 

get the intelligence attribute

Returns:
integer value of intelligence

Definition at line 160 of file person-obj.cpp.

Referenced by b1MerchantPerson::enlist().

00160                               { 
00161         return physical_stats.a.intelligence; 
00162 }

Here is the caller graph for this function:

int personObj::getRank (  ) 

Get the rank of an officer character.

Returns:
integer value of the rank of an officer character.

Definition at line 56 of file person-obj.cpp.

Referenced by book1Person::toStdOut().

00056                       {
00057         return rank;
00058 }

Here is the caller graph for this function:

char * personObj::getService (  ) 

Return the value of the service the character served in.

Returns:
pointer to character string representing the service.

Definition at line 104 of file person-obj.cpp.

Referenced by book1Person::toStdOut().

00104                            {
00105         return service;
00106 }

Here is the caller graph for this function:

skillList * personObj::getSkillList (  ) 

Get the skill list...

Returns:
pointer to the skills member of the object.

Definition at line 247 of file person-obj.cpp.

Referenced by book1Person::XMLout().

00247                                   {
00248         return skills;
00249 }

Here is the caller graph for this function:

int personObj::getSocialStanding (  ) 

get the social_standing attribute

Returns:
integer value for social_standing

Definition at line 180 of file person-obj.cpp.

Referenced by b1NavyPerson::enlist(), and b1MarinePerson::enlist().

00180                                   { 
00181         return physical_stats.a.social_standing; 
00182 }

Here is the caller graph for this function:

int personObj::getStrength (  ) 

get the strength attribute

Returns:
integer value of strength

Definition at line 136 of file person-obj.cpp.

00136                           {
00137         return physical_stats.a.strength; 
00138 }

int personObj::getTerms (  ) 

return the number of terms the character has served.

Returns:
number of terms the character has served.

Definition at line 62 of file person-obj.cpp.

Referenced by book1Person::toStdOut().

00062                        {
00063         return terms;
00064 }

Here is the caller graph for this function:

void personObj::incrementAge ( int  ix  ) 

Increment Age

Parameters:
ix integer amount to increment by

Definition at line 108 of file person-obj.cpp.

00108                                   {
00109         age = age + ix;
00110 }

void personObj::incrementAttribute ( int  attr,
int  incr 
)

Increment an attribute

Parameters:
attr integer index to the attribute to increment
incr integer amount to incrmenet by.

Definition at line 192 of file person-obj.cpp.

Referenced by incrementDexterity(), incrementEducation(), incrementEndurance(), incrementIntelligence(), incrementSocialStanding(), and incrementStrength().

00192                                                    {
00193         physical_stats.upp[attr] = physical_stats.upp[attr] + incr;
00194         if ( physical_stats.upp[attr] < 0 ) 
00195                 physical_stats.upp[attr] = 0;
00196         
00197 }

Here is the caller graph for this function:

void personObj::incrementDexterity ( int  ix  ) 

Increment Dexterity

Parameters:
ix integer amount to increment by

Definition at line 116 of file person-obj.cpp.

References incrementAttribute().

00116                                         {
00117         this->incrementAttribute(DEXTERITY,ix);
00118 }

Here is the call graph for this function:

void personObj::incrementEducation ( int  ix  ) 

Increment Education

Parameters:
ix integer amount to increment by

Definition at line 128 of file person-obj.cpp.

References incrementAttribute().

00128                                         {
00129         this->incrementAttribute(EDUCATION,ix);
00130 }

Here is the call graph for this function:

void personObj::incrementEndurance ( int  ix  ) 

Increment endurance

Parameters:
ix integer amount to increment by

Definition at line 120 of file person-obj.cpp.

References incrementAttribute().

00120                                         {
00121         this->incrementAttribute(ENDURANCE,ix);
00122 }

Here is the call graph for this function:

void personObj::incrementIntelligence ( int  ix  ) 

Increment Intelligence

Parameters:
ix integer amount to increment by

Definition at line 124 of file person-obj.cpp.

References incrementAttribute().

00124                                            {
00125         this->incrementAttribute(INTELLIGENCE,ix);
00126 }

Here is the call graph for this function:

void personObj::incrementSocialStanding ( int  ix  ) 

Increment Social Standing

Parameters:
ix integer amount to increment by

Definition at line 132 of file person-obj.cpp.

References incrementAttribute().

Referenced by b1NavyPerson::enlist().

00132                                              {
00133         this->incrementAttribute(SOCIALSTANDING,ix);
00134 }

Here is the call graph for this function:

Here is the caller graph for this function:

void personObj::incrementStrength ( int  ix  ) 

Increment Strength

Parameters:
ix integer amount to increment by

Definition at line 112 of file person-obj.cpp.

References incrementAttribute().

00112                                        {
00113         this->incrementAttribute(STRENGTH,ix);
00114 }

Here is the call graph for this function:

char ** personObj::listOfSkills (  ) 

A list of the character's skills

Returns:
an array of pointers to character strings consisting of the skill and its level.
Todo:
consider moving this to the base class.

Definition at line 232 of file person-obj.cpp.

References skillList::listOfSkills().

Referenced by book1Person::toStdOut().

00232                               {
00233         return skills->listOfSkills();
00234 }

Here is the call graph for this function:

Here is the caller graph for this function:

char * personObj::listOfSkillString (  ) 

Get the list of skills as a single pointer to character string.

Returns:
pointer to character string.

Definition at line 243 of file person-obj.cpp.

References skillList::listOfSkillString().

Referenced by book1Person::toStdOut().

00243                                   {
00244         return skills->listOfSkillString();
00245 }

Here is the call graph for this function:

Here is the caller graph for this function:

void personObj::setAccepted ( int  i  ) 

Set the flag that the character was accepted.

Parameters:
i integer value (should be 1 or 0)

Definition at line 202 of file person-obj.cpp.

Referenced by b1ScoutPerson::enlist(), b1OtherPerson::enlist(), b1NavyPerson::enlist(), b1MerchantPerson::enlist(), b1MarinePerson::enlist(), and b1ArmyPerson::enlist().

00202                                  {
00203         accepted=(a!=0 ? 1 : 0 ) ;
00204 }

Here is the caller graph for this function:

void personObj::setAge ( int  a  ) 

Set the age attribute

Parameters:
a integer value for age

Definition at line 188 of file person-obj.cpp.

Referenced by b1ScoutPerson::enlist(), b1OtherPerson::enlist(), b1NavyPerson::enlist(), b1MerchantPerson::enlist(), b1MarinePerson::enlist(), and b1ArmyPerson::enlist().

00188                            { 
00189         age=a; 
00190 }

Here is the caller graph for this function:

void personObj::setAlive ( int  a  ) 

Set the state of if this character is alive or dead.

Parameters:
a -- integer value if 1 character is alive 0 if dead.

Definition at line 224 of file person-obj.cpp.

Referenced by b1ScoutPerson::enlist(), b1OtherPerson::enlist(), b1NavyPerson::enlist(), b1MerchantPerson::enlist(), b1MarinePerson::enlist(), and b1ArmyPerson::enlist().

00224                              {
00225         alive=(a == 0 ? 0 : 1 ) ;
00226 }

Here is the caller graph for this function:

void personObj::setCash ( double  c  ) 

Set the cash for this character

Parameters:
c (double) value for amount to set cash to.

Definition at line 255 of file person-obj.cpp.

00255                                {
00256         cash=c;
00257 }

void personObj::setCommissioned ( int  c  ) 

Set the state if the character has earned an officer's commission.

Parameters:
c -- integer value 1 if character is an officer 0 if not.

Definition at line 53 of file person-obj.cpp.

Referenced by b1NavyPerson::enlist(), b1MerchantPerson::enlist(), b1MarinePerson::enlist(), and b1ArmyPerson::enlist().

00053                                     {
00054         commissioned=(c==0?0:1);
00055 }

Here is the caller graph for this function:

void personObj::setDexterity ( int  d  ) 

set the dexterity attribute

Parameters:
d integer value of dexterity

Definition at line 144 of file person-obj.cpp.

00144                                   { 
00145         physical_stats.a.dexterity=d;
00146 }

void personObj::setEducation ( int  e  ) 

Set the education attribute

Parameters:
e integer value for education

Definition at line 172 of file person-obj.cpp.

00172                                  { 
00173         physical_stats.a.education=e; 
00174 }

void personObj::setEndurance ( int  c  ) 

set the endurance attribute

Parameters:
c integer value for endurance

Definition at line 152 of file person-obj.cpp.

00152                                  { 
00153         physical_stats.a.endurance=c;
00154 }

void personObj::setIntelligence ( int  i  ) 

set the intelligence attribute

Parameters:
i integer value for intelligence

Definition at line 164 of file person-obj.cpp.

00164                                     { 
00165         physical_stats.a.intelligence=i; 
00166 }

void personObj::setRank ( int  r  ) 

Set the rank of a character if they are a commissioned officer.

Parameters:
r integer value of the rank
Todo:
check to see if commissioned or not and disable if not commissioned.

Definition at line 59 of file person-obj.cpp.

Referenced by b1NavyPerson::enlist(), b1MerchantPerson::enlist(), b1MarinePerson::enlist(), and b1ArmyPerson::enlist().

00059                             {
00060         rank = r;
00061 }

Here is the caller graph for this function:

void personObj::setService ( char *  s  ) 

Set the string value of the service the character is serving in.

Parameters:
s pointer to character string representing the service.

Definition at line 101 of file person-obj.cpp.

Referenced by b1ArmyPerson::b1ArmyPerson(), b1MarinePerson::b1MarinePerson(), b1MerchantPerson::b1MerchantPerson(), b1OtherPerson::b1OtherPerson(), b1ScoutPerson::b1ScoutPerson(), book4ArmyPerson::book4ArmyPerson(), book4Marine::book4Marine(), book5NavyPerson::book5NavyPerson(), book6ScoutPerson::book6ScoutPerson(), book7MerchantPerson::book7MerchantPerson(), b1NavyPerson::enlist(), s4BarbarianPerson::s4BarbarianPerson(), s4BelterPerson::s4BelterPerson(), s4BureaucratPerson::s4BureaucratPerson(), s4DoctorPerson::s4DoctorPerson(), s4FlyerPerson::s4FlyerPerson(), s4HunterPerson::s4HunterPerson(), s4NoblePerson::s4NoblePerson(), s4PiratePerson::s4PiratePerson(), s4RoguePerson::s4RoguePerson(), s4SailorPerson::s4SailorPerson(), and s4ScientistPerson::s4ScientistPerson().

00101                                  {
00102         service=s;
00103 }

Here is the caller graph for this function:

void personObj::setSocialStanding ( int  s  ) 

set the social_standing attribute

Parameters:
s integer value for social_standing

Definition at line 176 of file person-obj.cpp.

00176                                        { 
00177         physical_stats.a.social_standing=s;
00178 }

void personObj::setStrength ( int  s  ) 

Set the strength attribute

Parameters:
s integer value of strength

Definition at line 140 of file person-obj.cpp.

00140                                 { 
00141         physical_stats.a.strength=s; 
00142 }

void personObj::setTerms ( int  t  ) 

Set the number of terms the character has served.

Parameters:
t integer value representing the number of terms the character has served.

Definition at line 66 of file person-obj.cpp.

Referenced by b1ScoutPerson::enlist(), b1OtherPerson::enlist(), b1NavyPerson::enlist(), b1MerchantPerson::enlist(), b1MarinePerson::enlist(), and b1ArmyPerson::enlist().

00066                              {
00067         terms=t;
00068 }

Here is the caller graph for this function:

int personObj::skillCount (  ) 

how many skills does this character possess?

Definition at line 228 of file person-obj.cpp.

References skillList::skillCount().

Referenced by book1Person::toStdOut().

00228                          {
00229         return skills->skillCount();
00230 }

Here is the call graph for this function:

Here is the caller graph for this function:

int personObj::survived (  ) 

Character made survival rolls.

Returns:
1 if made all survival rolls 0 if not.

Definition at line 206 of file person-obj.cpp.

00206                        {
00207         // I could have just returned the value of "alive" but decided 
00208         // this was more readable.  So shoot me....
00209         //
00210         
00211         if ( alive == 1 ) return 1;
00212         else return 0;
00213 }

char * personObj::toString (  ) 

Dump the person as a string.

Returns:
pointer to character string representing this person

Definition at line 74 of file person-obj.cpp.

00074                          {
00075         char *buffer;
00076         int ix;
00077         buffer=(char*)malloc(50); // more than what we need, but oh-well...
00078         buffer[0]='\0';
00079         
00080         sprintf(buffer,"%s: ","UPP");
00081         for(ix=0;ix<6;ix++){
00082                 strcat(buffer,itohex(physical_stats.upp[ix]));
00083         }
00084         sprintf(buffer,"%s Age: %d",buffer,age);
00085         return buffer;
00086 }

char * personObj::UPPasString (  ) 

Dump just the UPP as a string.

Returns:
pointer to character string representing the UPP

Definition at line 88 of file person-obj.cpp.

Referenced by book1Person::toStdOut().

00088                             {
00089                 char *buffer;
00090         int ix;
00091         buffer=(char*)malloc(50); // more than what we need, but oh-well...
00092         buffer[0]='\0';
00093         
00094         sprintf(buffer,"%s: ","UPP");
00095         for(ix=0;ix<6;ix++){
00096                 strcat(buffer,itohex(physical_stats.upp[ix]));
00097         }
00098         return buffer;
00099 }

Here is the caller graph for this function:

int personObj::wasRejected (  ) 

Boolean state if the character was rejected for service.

Returns:
1 if rejected and 0 if not.

Definition at line 215 of file person-obj.cpp.

00215                           {
00216         if (accepted == 1) return 0;
00217         else return 1;
00218         
00219 }


The documentation for this class was generated from the following files:
Generated on Fri Mar 7 16:42:28 2008 for frpuniverse by  doxygen 1.4.7