#include <SaveSlot.hh>
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 &) |
SaveSlot::SaveSlot | ( | const char * | data | ) |
Constructor for a SaveSlot.
data | The SRAM data |
Definition at line 63 of file SaveSlot.cc.
SaveSlot::~SaveSlot | ( | ) |
void SaveSlot::setModified | ( | bool | modified = true |
) | [private] |
Sets whether this slot is modified or not.
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.
letter | The letter to translate. |
Definition at line 461 of file SaveSlot.cc.
unsigned char SaveSlot::toNES | ( | char | letter | ) | [static, private] |
Translates an ASCII character to the Ultima alphabet.
letter | The letter to translate. |
Definition at line 476 of file SaveSlot.cc.
std::pair< int, int > SaveSlot::getBalloonLocation | ( | ) | const |
Gets the location of the Balloon.
Definition at line 74 of file SaveSlot.cc.
void SaveSlot::setBalloonLocation | ( | std::pair< int, int > | location | ) |
Sets the baloon's location.
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.
character | The character. |
Definition at line 86 of file SaveSlot.cc.
void SaveSlot::setCurrentHP | ( | enum Character | character, | |
wxInt16 | value | |||
) |
Sets the current HP of a character.
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.
character | The character. |
Definition at line 101 of file SaveSlot.cc.
void SaveSlot::setCurrentMP | ( | enum Character | character, | |
unsigned char | value | |||
) |
Sets the current MP of a character.
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.
character | The character. |
Definition at line 110 of file SaveSlot.cc.
void SaveSlot::setDexterity | ( | enum Character | character, | |
unsigned char | value | |||
) |
Sets the dexterity of a character.
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.
character | The character whose equipment to get. | |
slot | The inventory slot (0-5). |
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.
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.
character | The character. |
Definition at line 129 of file SaveSlot.cc.
void SaveSlot::setExperience | ( | enum Character | character, | |
wxInt16 | value | |||
) |
Sets the experience of a character.
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.
Definition at line 144 of file SaveSlot.cc.
void SaveSlot::setGold | ( | wxInt16 | gold | ) |
Sets the amount of gold held by the party.
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.
herb | The herb whose value to get. |
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.
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.
Definition at line 166 of file SaveSlot.cc.
void SaveSlot::setHerosName | ( | const wxString & | name | ) |
Sets the Hero's Name.
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.
character | The character. |
Definition at line 196 of file SaveSlot.cc.
void SaveSlot::setIntelligence | ( | enum Character | character, | |
unsigned char | value | |||
) |
Sets the intelligence of a character.
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.
character | The character. |
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.
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.
character | The character. |
Definition at line 221 of file SaveSlot.cc.
void SaveSlot::setLevel | ( | enum Character | character, | |
unsigned char | value | |||
) |
Sets the level of a character.
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.
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.
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.
character | The character. |
Definition at line 265 of file SaveSlot.cc.
void SaveSlot::setMaxHP | ( | enum Character | character, | |
wxInt16 | value | |||
) |
Sets the max HP of a character.
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.
character | The character. |
Definition at line 280 of file SaveSlot.cc.
void SaveSlot::setMaxMP | ( | enum Character | character, | |
unsigned char | value | |||
) |
Sets the max MP of a charcter.
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.
position | The party position number (0-3). |
Definition at line 289 of file SaveSlot.cc.
void SaveSlot::setMember | ( | int | position, | |
int | character | |||
) |
Sets the party member at a given position.
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.
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.
moon | The moon whose phase to return. |
Definition at line 306 of file SaveSlot.cc.
void SaveSlot::setPhase | ( | enum City | trammel, | |
int | felucca | |||
) |
Sets the phases of the moons.
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.
ship | The ship to check for. |
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.
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.
ship | The ship. |
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.
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.
rune | The rune. |
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.
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 |
void SaveSlot::setStartLocation | ( | enum StartLocation | location | ) |
Sets the start location.
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.
stone | The stone to check for. |
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.
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.
character | The character. |
Definition at line 399 of file SaveSlot.cc.
void SaveSlot::setStrength | ( | enum Character | character, | |
unsigned char | value | |||
) |
Sets the strength of a charater.
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.
tool | The tool to get the amount of. |
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.
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.
virtue | The virtue whose value to retrieve. |
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.
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.
Definition at line 491 of file SaveSlot.cc.
void SaveSlot::setWhirlpoolLocation | ( | std::pair< int, int > | location | ) |
Sets the location of the whirlpool.
location | The location. |
Definition at line 496 of file SaveSlot.cc.
unsigned char SaveSlot::checksum | ( | ) | const |
Generates the checksum for the current data.
Definition at line 503 of file SaveSlot.cc.
void SRAMFile::save | ( | const wxString & | ) | [friend] |
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 }
Definition at line 46 of file SaveSlot.hh.