hack4u::SaveSlot Class Reference

#include <SaveSlot.hh>

List of all members.


Detailed Description

A class representing a single game save slot.

Definition at line 38 of file SaveSlot.hh.


Public Member Functions

 SaveSlot (const char *data)
 Constructor for a SaveSlot.
 ~SaveSlot ()
 Destructor for a SaveSlot.
std::pair< int, int > getBalloonLocation () const
 Gets the location of the Balloon.
void setBalloonLocation (std::pair< int, int > location)
 Sets the baloon's location.
wxInt16 getCurrentHP (enum Character character) const
 Gets the current HP of a character.
void setCurrentHP (enum Character character, wxInt16 value)
 Sets the current HP of a character.
int getCurrentMP (enum Character character) const
 Gets the current MP of a character.
void setCurrentMP (enum Character character, unsigned char value)
 Sets the current MP of a character.
int getDexterity (enum Character character) const
 Gets the dexterity of a character.
void setDexterity (enum Character character, unsigned char value)
 Sets the dexterity of a character.
int getEquipment (enum Character character, int slot) const
 Gets the item held by a particular player in a particular slot.
void setEquipment (enum Character character, int slot, unsigned char value)
 Sets the item held by a particular player in a particular slot.
wxInt16 getExperience (enum Character character) const
 Gets the experience of a character.
void setExperience (enum Character character, wxInt16 value)
 Sets the experience of a character.
wxInt16 getGold () const
 Gets the amount of gold held by the party.
void setGold (wxInt16 gold)
 Sets the amount of gold held by the party.
int getHerb (enum Herb herb) const
 Gets the current amount of a particular herb the party has.
void setHerb (enum Herb herb, unsigned char value)
 Sets the amount of a particular herb the party has.
wxString getHerosName () const
 Gets the Hero's Name.
void setHerosName (const wxString &name)
 Sets the Hero's Name.
int getIntelligence (enum Character character) const
 Gets the intelligence of a character.
void setIntelligence (enum Character character, unsigned char value)
 Sets the intelligence of a character.
bool hasJoined (enum Character character) const
 Checks if a character has joined the party or not.
void setJoined (enum Character character, bool value)
 Sets whether a character has joined the party or not.
int getLevel (enum Character character) const
 Gets the level of a character.
void setLevel (enum Character character, unsigned char value)
 Sets the level of a character.
bool hasMagic (enum Magic magic) const
 Queries whether the party has a particular magic or not.
void setMagic (enum Magic magic, bool give=true)
 Sets whether the party has a particular magic of not.
wxInt16 getMaxHP (enum Character character) const
 Gets the max HP of a character.
void setMaxHP (enum Character character, wxInt16 value)
 Sets the max HP of a character.
int getMaxMP (enum Character character) const
 Gets the max MP of a character.
void setMaxMP (enum Character character, unsigned char value)
 Sets the max MP of a charcter.
int getMember (int position) const
 Gets the party member at a given position.
void setMember (int position, int character)
 Sets the party member at a given position.
bool isModified () const
 Queries if this SaveSlot has been modified.
int getPhase (enum Moon moon) const
 Gets the current phase of one of the moons.
void setPhase (enum City trammel, int felucca)
 Sets the phases of the moons.
bool hasPirateShip (enum PirateShip ship) const
 Checks if the party has captured a particular ship.
void setPirateShip (enum PirateShip ship, bool give)
 Sets whether the party has a particular pirate ship or not.
std::pair< int, int > getPirateShipLocation (enum PirateShip ship) const
 Gets the location of one of the captured pirate ships.
void setPirateShipLocation (enum PirateShip ship, std::pair< int, int > location)
 Sets the location of a captured pirate ship.
bool hasRune (enum Virtue rune) const
 Queries whether the party has a particular rune or not.
void setRune (enum Virtue rune, bool give=true)
 Sets whether the party has a particular rune of not.
enum StartLocation getStartLocation () const
 Gets the start location.
void setStartLocation (enum StartLocation location)
 Sets the start location.
bool hasStone (enum Virtue stone) const
 Queries if the party has a particular stone in their inventory.
void setStone (enum Virtue stone, bool give=true)
 Sets whether the party has a particular stone or not.
int getStrength (enum Character character) const
 Gets the strength of a character.
void setStrength (enum Character character, unsigned char value)
 Sets the strength of a charater.
int getTool (enum Tool tool) const
 Gets the amount of a tool the party has.
void setTool (enum Tool tool, unsigned char value=1)
 Sets the amount of a tool the party has.
int getVirtue (enum Virtue virtue) const
 Gets the value for one of the eight virtues.
void setVirtue (enum Virtue virtue, unsigned char value)
 Sets the value for one of the eight virtues.
std::pair< int, int > getWhirlpoolLocation () const
 Gets the location of the whirlpool.
void setWhirlpoolLocation (std::pair< int, int > location)
 Sets the location of the whirlpool.
unsigned char checksum () const
 Generates the checksum for the current data.

Private Member Functions

void setModified (bool modified=true)
 Sets whether this slot is modified or not.

Static Private Member Functions

static char fromNES (unsigned char letter)
 Translates an Ultima alphabet character to ASCII.
static unsigned char toNES (char letter)
 Translates an ASCII character to the Ultima alphabet.

Private Attributes

unsigned char * nvram
bool modified

Static Private Attributes

static const int CHECKSUM_XORS []
 Array of checksum xors used by the sanity algorithm.

Friends

void SRAMFile::save (const wxString &)

Constructor & Destructor Documentation

SaveSlot::SaveSlot ( const char *  data  ) 

Constructor for a SaveSlot.

Parameters:
data The SRAM data

Definition at line 63 of file SaveSlot.cc.

SaveSlot::~SaveSlot (  ) 

Destructor for a SaveSlot.

Definition at line 70 of file SaveSlot.cc.


Member Function Documentation

void SaveSlot::setModified ( bool  modified = true  )  [private]

Sets whether this slot is modified or not.

Parameters:
modified true if modified; false otherwise.

Definition at line 298 of file SaveSlot.cc.

char SaveSlot::fromNES ( unsigned char  letter  )  [static, private]

Translates an Ultima alphabet character to ASCII.

Parameters:
letter The letter to translate.
Returns:
The translated character.

Definition at line 461 of file SaveSlot.cc.

unsigned char SaveSlot::toNES ( char  letter  )  [static, private]

Translates an ASCII character to the Ultima alphabet.

Parameters:
letter The letter to translate.
Returns:
The translated character.

Definition at line 476 of file SaveSlot.cc.

std::pair< int, int > SaveSlot::getBalloonLocation (  )  const

Gets the location of the Balloon.

Returns:
The Balloon's location (latitude, longitude).

Definition at line 74 of file SaveSlot.cc.

void SaveSlot::setBalloonLocation ( std::pair< int, int >  location  ) 

Sets the baloon's location.

Parameters:
location The new location (latitude, longitude).

Definition at line 79 of file SaveSlot.cc.

wxInt16 SaveSlot::getCurrentHP ( enum Character  character  )  const

Gets the current HP of a character.

Parameters:
character The character.
Returns:
The current HP.

Definition at line 86 of file SaveSlot.cc.

void SaveSlot::setCurrentHP ( enum Character  character,
wxInt16  value 
)

Sets the current HP of a character.

Parameters:
character The character.
value The new current HP.

Definition at line 93 of file SaveSlot.cc.

int SaveSlot::getCurrentMP ( enum Character  character  )  const

Gets the current MP of a character.

Parameters:
character The character.
Returns:
The current MP.

Definition at line 101 of file SaveSlot.cc.

void SaveSlot::setCurrentMP ( enum Character  character,
unsigned char  value 
)

Sets the current MP of a character.

Parameters:
character The character.
value The new current MP.

Definition at line 105 of file SaveSlot.cc.

int SaveSlot::getDexterity ( enum Character  character  )  const

Gets the dexterity of a character.

Parameters:
character The character.
Returns:
The dexterity.

Definition at line 110 of file SaveSlot.cc.

void SaveSlot::setDexterity ( enum Character  character,
unsigned char  value 
)

Sets the dexterity of a character.

Parameters:
character The character.
value The new dexterity.

Definition at line 114 of file SaveSlot.cc.

int SaveSlot::getEquipment ( enum Character  character,
int  slot 
) const

Gets the item held by a particular player in a particular slot.

Parameters:
character The character whose equipment to get.
slot The inventory slot (0-5).
Returns:
The equipment item.

Definition at line 119 of file SaveSlot.cc.

void SaveSlot::setEquipment ( enum Character  character,
int  slot,
unsigned char  value 
)

Sets the item held by a particular player in a particular slot.

Parameters:
character The character whose equipment to set.
slot The inventory slot (0-5).
value The new item value.

Definition at line 123 of file SaveSlot.cc.

wxInt16 SaveSlot::getExperience ( enum Character  character  )  const

Gets the experience of a character.

Parameters:
character The character.
Returns:
The experience.

Definition at line 129 of file SaveSlot.cc.

void SaveSlot::setExperience ( enum Character  character,
wxInt16  value 
)

Sets the experience of a character.

Parameters:
character The character.
value The new experience.

Definition at line 136 of file SaveSlot.cc.

wxInt16 SaveSlot::getGold (  )  const

Gets the amount of gold held by the party.

Returns:
The amount of gold.

Definition at line 144 of file SaveSlot.cc.

void SaveSlot::setGold ( wxInt16  gold  ) 

Sets the amount of gold held by the party.

Parameters:
gold The new amount of gold.

Definition at line 150 of file SaveSlot.cc.

int SaveSlot::getHerb ( enum Herb  herb  )  const

Gets the current amount of a particular herb the party has.

Parameters:
herb The herb whose value to get.
Returns:
The amount of the particular herb the party has.

Definition at line 157 of file SaveSlot.cc.

void SaveSlot::setHerb ( enum Herb  herb,
unsigned char  value 
)

Sets the amount of a particular herb the party has.

Parameters:
herb The herb whose value to set.
value The new value.

Definition at line 161 of file SaveSlot.cc.

wxString SaveSlot::getHerosName (  )  const

Gets the Hero's Name.

Returns:
wxString with the name of the Hero translated to a proper PC alphabet.

Definition at line 166 of file SaveSlot.cc.

void SaveSlot::setHerosName ( const wxString &  name  ) 

Sets the Hero's Name.

Parameters:
name The new name of the hero. Valid values must not exceed 5 characters. Excess lengths will be ignored.

Definition at line 181 of file SaveSlot.cc.

int SaveSlot::getIntelligence ( enum Character  character  )  const

Gets the intelligence of a character.

Parameters:
character The character.
Returns:
The intelligence.

Definition at line 196 of file SaveSlot.cc.

void SaveSlot::setIntelligence ( enum Character  character,
unsigned char  value 
)

Sets the intelligence of a character.

Parameters:
character The character.
value The new intelligence.

Definition at line 200 of file SaveSlot.cc.

bool SaveSlot::hasJoined ( enum Character  character  )  const

Checks if a character has joined the party or not.

Parameters:
character The character.
Returns:
true if the character has joined; false otherwise.

Definition at line 205 of file SaveSlot.cc.

void SaveSlot::setJoined ( enum Character  character,
bool  value 
)

Sets whether a character has joined the party or not.

Parameters:
character The character.
value true if joined; false otherwise.

Definition at line 209 of file SaveSlot.cc.

int SaveSlot::getLevel ( enum Character  character  )  const

Gets the level of a character.

Parameters:
character The character.
Returns:
The character's level.

Definition at line 221 of file SaveSlot.cc.

void SaveSlot::setLevel ( enum Character  character,
unsigned char  value 
)

Sets the level of a character.

Parameters:
character The character.
value The new level.

Definition at line 225 of file SaveSlot.cc.

bool SaveSlot::hasMagic ( enum Magic  magic  )  const

Queries whether the party has a particular magic or not.

Parameters:
magic The magic to check for.

Definition at line 230 of file SaveSlot.cc.

void SaveSlot::setMagic ( enum Magic  magic,
bool  give = true 
)

Sets whether the party has a particular magic of not.

Parameters:
magic The magic. Valid values are any of the members in the Magic enumeration other than INVALIDx.
give true to give the magic; false to take it away.

Definition at line 242 of file SaveSlot.cc.

wxInt16 SaveSlot::getMaxHP ( enum Character  character  )  const

Gets the max HP of a character.

Parameters:
character The character.
Returns:
The Max HP.

Definition at line 265 of file SaveSlot.cc.

void SaveSlot::setMaxHP ( enum Character  character,
wxInt16  value 
)

Sets the max HP of a character.

Parameters:
character The character.
value The new max HP.

Definition at line 272 of file SaveSlot.cc.

int SaveSlot::getMaxMP ( enum Character  character  )  const

Gets the max MP of a character.

Parameters:
character The character.
Returns:
The max MP.

Definition at line 280 of file SaveSlot.cc.

void SaveSlot::setMaxMP ( enum Character  character,
unsigned char  value 
)

Sets the max MP of a charcter.

Parameters:
character The character.
value The new max MP.

Definition at line 284 of file SaveSlot.cc.

int SaveSlot::getMember ( int  position  )  const

Gets the party member at a given position.

Parameters:
position The party position number (0-3).
Returns:
The character at that position. Return values range between 0 and 1 + one of the character values in the Characters enumeration. 1 = Mage, 8 = Shepherd, 0 = No one.

Definition at line 289 of file SaveSlot.cc.

void SaveSlot::setMember ( int  position,
int  character 
)

Sets the party member at a given position.

Parameters:
position The party position number (0-3).
character What character class should be here, or 0 for no one. Use the Characters enumeration + 1 for proper character values (e.g. MAGE + 1).

Definition at line 293 of file SaveSlot.cc.

bool hack4u::SaveSlot::isModified (  )  const [inline]

Queries if this SaveSlot has been modified.

Returns:
true if modified; false otherwise.

Definition at line 543 of file SaveSlot.hh.

int SaveSlot::getPhase ( enum Moon  moon  )  const

Gets the current phase of one of the moons.

Valid values are either TRAMMEL or FELUCCA.

Parameters:
moon The moon whose phase to return.
Returns:
The phase of the moon. Note that felucca's phase depends upon trammel's phase and can be only 0, 1, or 2 representing one of the three destination cities. Trammel's phase will always be one of the eight cities of virtue.

Definition at line 306 of file SaveSlot.cc.

void SaveSlot::setPhase ( enum City  trammel,
int  felucca 
)

Sets the phases of the moons.

Parameters:
trammel The phase for trammel. Must be one of the eight cities of virtue.
felucca The phase for felucca. Must be 0, 1, or 2 representing one of the three destination cities from Trammel.

Definition at line 316 of file SaveSlot.cc.

bool SaveSlot::hasPirateShip ( enum PirateShip  ship  )  const

Checks if the party has captured a particular ship.

Parameters:
ship The ship to check for.
Returns:
true if the ship has been taken; false otherwise.

Definition at line 323 of file SaveSlot.cc.

void SaveSlot::setPirateShip ( enum PirateShip  ship,
bool  give 
)

Sets whether the party has a particular pirate ship or not.

Parameters:
ship The pirate ship.
give true to give the ship; false otherwise.

Definition at line 327 of file SaveSlot.cc.

std::pair< int, int > SaveSlot::getPirateShipLocation ( enum PirateShip  ship  )  const

Gets the location of one of the captured pirate ships.

Parameters:
ship The ship.
Returns:
The location of the ship (latitude, longitude).

Definition at line 340 of file SaveSlot.cc.

void SaveSlot::setPirateShipLocation ( enum PirateShip  ship,
std::pair< int, int >  location 
)

Sets the location of a captured pirate ship.

Parameters:
ship The pirate ship.
location The location (latitude, longitude).

Definition at line 346 of file SaveSlot.cc.

bool SaveSlot::hasRune ( enum Virtue  rune  )  const

Queries whether the party has a particular rune or not.

Parameters:
rune The rune.
Returns:
true if they have the rune; false otherwise.

Definition at line 354 of file SaveSlot.cc.

void SaveSlot::setRune ( enum Virtue  rune,
bool  give = true 
)

Sets whether the party has a particular rune of not.

Parameters:
rune The rune.
give true to give the rune; false to take it away.

Definition at line 358 of file SaveSlot.cc.

enum StartLocation SaveSlot::getStartLocation (  )  const

Gets the start location.

Returns:
The start location.

Definition at line 372 of file SaveSlot.cc.

void SaveSlot::setStartLocation ( enum StartLocation  location  ) 

Sets the start location.

Parameters:
location The start location.

Definition at line 376 of file SaveSlot.cc.

bool SaveSlot::hasStone ( enum Virtue  stone  )  const

Queries if the party has a particular stone in their inventory.

Parameters:
stone The stone to check for.
Returns:
true if they have the stone; false otherwise.

Definition at line 381 of file SaveSlot.cc.

void SaveSlot::setStone ( enum Virtue  stone,
bool  give = true 
)

Sets whether the party has a particular stone or not.

Parameters:
stone The stone.
give true to give the stone; false to take it away.

Definition at line 385 of file SaveSlot.cc.

int SaveSlot::getStrength ( enum Character  character  )  const

Gets the strength of a character.

Parameters:
character The character.
Returns:
The strength.

Definition at line 399 of file SaveSlot.cc.

void SaveSlot::setStrength ( enum Character  character,
unsigned char  value 
)

Sets the strength of a charater.

Parameters:
character The character.
value The new strength.

Definition at line 403 of file SaveSlot.cc.

int SaveSlot::getTool ( enum Tool  tool  )  const

Gets the amount of a tool the party has.

Parameters:
tool The tool to get the amount of.
Returns:
The amount of the particular tool.

Definition at line 408 of file SaveSlot.cc.

void SaveSlot::setTool ( enum Tool  tool,
unsigned char  value = 1 
)

Sets the amount of a tool the party has.

Parameters:
tool The tool to set the amount of.
value The new amount.

Definition at line 412 of file SaveSlot.cc.

int SaveSlot::getVirtue ( enum Virtue  virtue  )  const

Gets the value for one of the eight virtues.

Parameters:
virtue The virtue whose value to retrieve.
Returns:
The value for the particular virtue.

Definition at line 444 of file SaveSlot.cc.

void SaveSlot::setVirtue ( enum Virtue  virtue,
unsigned char  value 
)

Sets the value for one of the eight virtues.

Parameters:
virtue The virtue to set.
value The new value for the virtue.

Definition at line 448 of file SaveSlot.cc.

std::pair< int, int > SaveSlot::getWhirlpoolLocation (  )  const

Gets the location of the whirlpool.

Returns:
The location.

Definition at line 491 of file SaveSlot.cc.

void SaveSlot::setWhirlpoolLocation ( std::pair< int, int >  location  ) 

Sets the location of the whirlpool.

Parameters:
location The location.

Definition at line 496 of file SaveSlot.cc.

unsigned char SaveSlot::checksum (  )  const

Generates the checksum for the current data.

Returns:
The checksum.

Definition at line 503 of file SaveSlot.cc.


Friends And Related Function Documentation

void SRAMFile::save ( const wxString &   )  [friend]


Member Data Documentation

unsigned char* hack4u::SaveSlot::nvram [private]

Definition at line 42 of file SaveSlot.hh.

bool hack4u::SaveSlot::modified [private]

Definition at line 43 of file SaveSlot.hh.

const int SaveSlot::CHECKSUM_XORS [static, private]

Initial value:

 {
    0x55, 0xAA, 0x33, 0xCC,
    0xA5, 0x5A, 0xBB, 0x99
}
Array of checksum xors used by the sanity algorithm.

Definition at line 46 of file SaveSlot.hh.


Generated on Mon Dec 29 01:19:02 2008 for hack4u by  doxygen 1.5.4