hoa_global::GameGlobal Class Reference

Retains all the state information about the player's active game. More...

#include <global.h>

Inheritance diagram for hoa_global::GameGlobal:

Inheritance graph
[legend]
Collaboration diagram for hoa_global::GameGlobal:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void AddDrunes (uint32 amount)
 
Note:
The overflow condition is not checked here: we just assume it will never occur

uint32 AverageActivePartyExperienceLevel () const
 Calculates the average experience level of members in the active party.
void ClearAllData ()
 Deletes all data stored within the GameGlobal class object This function is meant to be called when the user quits the current game instance and returns to the boot screen. It will delete all characters, inventory, and other data relevant to the current game.
bool LoadGame (const std::string &filename)
 Loads all global data from a saved game file.
bool SaveGame (std::string &filename)
 Saves all global data to a saved game file.
void SetLocation (const hoa_utils::ustring &location_name, const std::string &location_graphic_filename)
 Sets the name and graphic for the current location.
bool SingletonInitialize ()
 A method for the inheriting class to implement, which initializes the class.
void SubtractDrunes (uint32 amount)
 
Note:
The amount is only subtracted if the current funds is equal to or exceeds the amount to subtract

 ~GameGlobal ()
Character Functions
void AddCharacter (GlobalCharacter *ch)
 Adds a new pre-initialized character to the party.
void AddCharacter (uint32 id)
 Adds a new character to the party with its initial settings.
GlobalCharacterGetCharacter (uint32 id)
 Returns a pointer to a character currently in the party.
bool IsCharacterInParty (uint32 id)
 Checks whether or not a character is in the party.
void RemoveCharacter (uint32 id)
 Removes a character from the party.
Event Group Methods
void AddNewEventGroup (const std::string &group_name)
 Adds a new event group for the class to manage.
bool DoesEventExist (const std::string &group_name, const std::string &event_name) const
 Determines if an event of a given name exists within a given group.
bool DoesEventGroupExist (const std::string &group_name) const
 Queries whether or not an event group of a given name exists.
GlobalEventGroupGetEventGroup (const std::string &group_name) const
 Returns a pointer to an event group of the specified name.
int32 GetEventValue (const std::string &group_name, const std::string &event_name) const
 Returns the value of an event inside of a specified group.
uint32 GetNumberEventGroups () const
 Returns the number of event groups stored in the class.
uint32 GetNumberEvents (const std::string &group_name) const
 Returns the number of events for a specified group name.
Inventory Methods
void AddToInventory (GlobalObject *object)
 Adds a new object to the inventory.
void AddToInventory (uint32 obj_id, uint32 obj_count=1)
 Adds a new object to the inventory.
void DecrementObjectCount (uint32 obj_id, uint32 obj_count=1)
 Decrements the number (count) of an object in the inventory.
void IncrementObjectCount (uint32 obj_id, uint32 obj_count=1)
 Increments the number (count) of an object in the inventory.
bool IsObjectInInventory (uint32 id)
 Checks whether or a given object is currently stored in the inventory.
void RemoveFromInventory (uint32 obj_id)
 Removes an object from the inventory.
GlobalObjectRetrieveFromInventory (uint32 obj_id, bool all_counts=false)
 Retries a single copy of an object from the inventory.
Class Member Access Functions
GlobalPartyGetActiveParty ()
std::vector< GlobalCharacter * > * GetCharacterOrder ()
uint32 GetDrunes () const
std::map< uint32, GlobalObject * > * GetInventory ()
std::vector< GlobalArmor * > * GetInventoryArmArmor ()
std::vector< GlobalArmor * > * GetInventoryHeadArmor ()
std::vector< GlobalItem * > * GetInventoryItems ()
std::vector< GlobalKeyItem * > * GetInventoryKeyItems ()
std::vector< GlobalArmor * > * GetInventoryLegArmor ()
std::vector< GlobalShard * > * GetInventoryShards ()
std::vector< GlobalArmor * > * GetInventoryTorsoArmor ()
std::vector< GlobalWeapon * > * GetInventoryWeapons ()
hoa_video::StillImageGetLocationGraphic ()
hoa_utils::ustringGetLocationName ()
void SetDrunes (uint32 amount)

Private Member Functions

void _LoadCharacter (hoa_script::ReadScriptDescriptor &file, uint32 id)
 A helper function to GameGlobal::LoadGame() that loads a saved game character and adds it to the party.
void _LoadEvents (hoa_script::ReadScriptDescriptor &file, const std::string &group_name)
 A helper function to GameGlobal::LoadGame() that loads a group of game events from a saved game file.
void _LoadInventory (hoa_script::ReadScriptDescriptor &file, std::string category_name)
 A helper function to GameGlobal::LoadGame() that restores the contents of the inventory from a saved game file.
template<class T>
bool _RemoveFromInventory (uint32 obj_id, std::vector< T * > &inv)
 A helper template function that finds and removes an object from the inventory.
template<class T>
T * _RetrieveFromInventory (uint32 obj_id, std::vector< T * > &inv, bool all_counts)
 A helper template function that finds and returns a copy of an object from the inventory.
void _SaveCharacter (hoa_script::WriteScriptDescriptor &file, GlobalCharacter *character, bool last)
 A helper function to GameGlobal::SaveGame() that writes character data to the saved game file.
void _SaveEvents (hoa_script::WriteScriptDescriptor &file, GlobalEventGroup *event_group)
 A helper function to GameGlobal::SaveGame() that writes a group of event data to the saved game file.
template<class T>
void _SaveInventory (hoa_script::WriteScriptDescriptor &file, std::string name, std::vector< T * > &inv)
 A helper function to GameGlobal::SaveGame() that stores the contents of a type of inventory to the saved game file.
 GameGlobal ()

Private Attributes

GlobalParty _active_party
 The active party of characters The active party contains the group of characters that will fight when a battle begins. This party can be up to four characters, and should always contain at least one character.
std::vector< GlobalCharacter * > _character_order
 A vector whose purpose is to maintain the order of characters The first four characters in this vector are in the active party; the rest are in reserve.
std::map< uint32, GlobalCharacter * > _characters
 A map containing all characters that the player has discovered This map contains all characters that the player has met with, regardless of whether or not they are in the active party. The map key is the character's unique ID number.
uint32 _drunes
 The amount of financial resources (drunes) that the party currently has.
std::map< std::string, GlobalEventGroup * > _event_groups
 The container which stores all of the groups of events that have occured in the game The name of the GlobalEventGroup serves as its key in this map data structure.
std::map< uint32, GlobalObject * > _inventory
 Retains a list of all of the objects currently stored in the player's inventory This map is used to quickly check if an item is in the inventory or not. The key to the map is the object's identification number. When an object is added to the inventory, if it already exists then the object counter is simply increased instead of adding an entire new class object. When the object count becomes zero, the object is removed from the inventory. Duplicates of all objects are retained in the various inventory containers below.
hoa_video::StillImage _location_graphic
 The graphical image which represents the current location.
hoa_utils::ustring _location_name
 The name of the map that the current party is on.
hoa_script::ReadScriptDescriptor _arm_armor_script
hoa_script::ReadScriptDescriptor _attack_skills_script
hoa_script::ReadScriptDescriptor _defend_skills_script
hoa_script::ReadScriptDescriptor _head_armor_script
hoa_script::ReadScriptDescriptor _items_script
 Script files that retain data for various global constructs.
hoa_script::ReadScriptDescriptor _leg_armor_script
hoa_script::ReadScriptDescriptor _support_skills_script
hoa_script::ReadScriptDescriptor _torso_armor_script
hoa_script::ReadScriptDescriptor _weapons_script
std::vector< GlobalArmor * > _inventory_arm_armor
std::vector< GlobalArmor * > _inventory_head_armor
std::vector< GlobalItem * > _inventory_items
 Inventory containers These vectors contain the inventory of the entire party. The vectors are sorted according to the user's personal preferences. When a new object is added to the inventory, by default it will be placed at the end of the vector.
std::vector< GlobalKeyItem * > _inventory_key_items
std::vector< GlobalArmor * > _inventory_leg_armor
std::vector< GlobalShard * > _inventory_shards
std::vector< GlobalArmor * > _inventory_torso_armor
std::vector< GlobalWeapon * > _inventory_weapons

Friends

class GlobalArmor
class GlobalItem
class GlobalSkill
class GlobalWeapon
class hoa_utils::Singleton< GameGlobal >

Detailed Description

Retains all the state information about the player's active game.

****************************************************************************

This class is a resource manager for the current state of the game that is being played. It retains all of the characters in the player's party, the party's inventory, etc. This class assists the various game modes by allowing them to share data with each other on a "global" basis.

Note:
This class is a singleton, even though it is technically not an engine manager class. There can only be one game instance that the player is playing at any given time.

Definition at line 147 of file global.h.


Constructor & Destructor Documentation

hoa_global::GameGlobal::~GameGlobal (  ) 

Definition at line 93 of file global.cpp.

References _arm_armor_script, _attack_skills_script, _head_armor_script, _items_script, _leg_armor_script, _torso_armor_script, _weapons_script, ClearAllData(), hoa_script::ReadScriptDescriptor::CloseFile(), hoa_script::ReadScriptDescriptor::CloseTable(), and hoa_global::GLOBAL_DEBUG.

Here is the call graph for this function:

hoa_global::GameGlobal::GameGlobal (  )  [private]

Definition at line 86 of file global.cpp.

References hoa_global::GLOBAL_DEBUG.


Member Function Documentation

void hoa_global::GameGlobal::_LoadCharacter ( hoa_script::ReadScriptDescriptor file,
uint32  id 
) [private]

A helper function to GameGlobal::LoadGame() that loads a saved game character and adds it to the party.

Parameters:
file A reference to the open and valid file from where to read the character from
id The character's integer ID, used to find and restore the character data

Definition at line 880 of file global.cpp.

References AddCharacter(), hoa_global::GlobalCharacter::AddSkill(), hoa_script::ReadScriptDescriptor::CloseTable(), hoa_global::GlobalCharacter::EquipArmArmor(), hoa_global::GlobalCharacter::EquipHeadArmor(), hoa_global::GlobalCharacter::EquipLegArmor(), hoa_global::GlobalCharacter::EquipTorsoArmor(), hoa_global::GlobalActor::EquipWeapon(), GlobalArmor, GlobalWeapon, hoa_script::ScriptDescriptor::IsFileOpen(), hoa_script::ReadScriptDescriptor::OpenTable(), hoa_script::ReadScriptDescriptor::ReadUInt(), hoa_script::ReadScriptDescriptor::ReadUIntVector(), hoa_global::GlobalActor::SetAgility(), hoa_global::GlobalActor::SetEvade(), hoa_global::GlobalActor::SetExperienceLevel(), hoa_global::GlobalActor::SetExperiencePoints(), hoa_global::GlobalActor::SetFortitude(), hoa_global::GlobalActor::SetHitPoints(), hoa_global::GlobalActor::SetMaxHitPoints(), hoa_global::GlobalActor::SetMaxSkillPoints(), hoa_global::GlobalActor::SetProtection(), hoa_global::GlobalActor::SetSkillPoints(), hoa_global::GlobalActor::SetStrength(), and hoa_global::GlobalActor::SetVigor().

Here is the call graph for this function:

void hoa_global::GameGlobal::_LoadEvents ( hoa_script::ReadScriptDescriptor file,
const std::string &  group_name 
) [private]

A helper function to GameGlobal::LoadGame() that loads a group of game events from a saved game file.

Parameters:
file A reference to the open and valid file from where to read the event data from
group_name The name of the event group to load

Definition at line 972 of file global.cpp.

References hoa_global::GlobalEventGroup::AddNewEvent(), AddNewEventGroup(), hoa_script::ReadScriptDescriptor::CloseTable(), GetEventGroup(), hoa_script::ScriptDescriptor::IsFileOpen(), hoa_script::ReadScriptDescriptor::OpenTable(), hoa_script::ReadScriptDescriptor::ReadInt(), and hoa_script::ReadScriptDescriptor::ReadTableKeys().

Here is the call graph for this function:

void hoa_global::GameGlobal::_LoadInventory ( hoa_script::ReadScriptDescriptor file,
std::string  category_name 
) [private]

A helper function to GameGlobal::LoadGame() that restores the contents of the inventory from a saved game file.

Parameters:
file A reference to the open and valid file from where to read the inventory list
category_name The name of the table in the file that should contain the inventory for a specific category

Definition at line 860 of file global.cpp.

References AddToInventory(), hoa_script::ReadScriptDescriptor::CloseTable(), hoa_script::ScriptDescriptor::IsFileOpen(), hoa_script::ReadScriptDescriptor::OpenTable(), hoa_script::ReadScriptDescriptor::ReadTableKeys(), and hoa_script::ReadScriptDescriptor::ReadUInt().

Here is the call graph for this function:

template<class T>
bool hoa_global::GameGlobal::_RemoveFromInventory ( uint32  obj_id,
std::vector< T * > &  inv 
) [private]

A helper template function that finds and removes an object from the inventory.

Parameters:
obj_id The ID of the object to remove from the inventory
inv The vector container of the appropriate inventory type
Returns:
True if the object was successfully removed, or false if it was not

Definition at line 559 of file global.h.

References _inventory.

Referenced by RemoveFromInventory().

template<class T>
T * hoa_global::GameGlobal::_RetrieveFromInventory ( uint32  obj_id,
std::vector< T * > &  inv,
bool  all_counts 
) [private]

A helper template function that finds and returns a copy of an object from the inventory.

Parameters:
obj_id The ID of the object to remove from the inventory
inv The vector container of the appropriate inventory type
all_counts If false the object's count is decremented by one from the inventory, otherwise all counts are removed completely
Returns:
A pointer to the newly created copy of the object, or NULL if the object could not be found

Definition at line 574 of file global.h.

References _inventory.

Referenced by RetrieveFromInventory().

void hoa_global::GameGlobal::_SaveCharacter ( hoa_script::WriteScriptDescriptor file,
GlobalCharacter character,
bool  last 
) [private]

A helper function to GameGlobal::SaveGame() that writes character data to the saved game file.

Parameters:
file A reference to the open and valid file where to write the character data
objects A ponter to the character whose data should be saved
last Set to true if this is the final character that needs to be saved This method will need to be called once for each character in the player's party

Definition at line 718 of file global.cpp.

References hoa_global::GlobalActor::GetAgility(), hoa_global::GlobalCharacter::GetArmArmorEquipped(), hoa_global::GlobalCharacter::GetAttackSkills(), hoa_global::GlobalCharacter::GetDefenseSkills(), hoa_global::GlobalActor::GetEvade(), hoa_global::GlobalCharacter::GetExperienceForNextLevel(), hoa_global::GlobalActor::GetExperienceLevel(), hoa_global::GlobalActor::GetExperiencePoints(), hoa_global::GlobalActor::GetFortitude(), hoa_global::GlobalCharacter::GetHeadArmorEquipped(), hoa_global::GlobalActor::GetHitPoints(), hoa_global::GlobalObject::GetID(), hoa_global::GlobalActor::GetID(), hoa_global::GlobalCharacter::GetLegArmorEquipped(), hoa_global::GlobalActor::GetMaxHitPoints(), hoa_global::GlobalActor::GetMaxSkillPoints(), hoa_global::GlobalActor::GetProtection(), hoa_global::GlobalActor::GetSkillPoints(), hoa_global::GlobalActor::GetStrength(), hoa_global::GlobalCharacter::GetSupportSkills(), hoa_global::GlobalCharacter::GetTorsoArmorEquipped(), hoa_global::GlobalActor::GetVigor(), hoa_global::GlobalActor::GetWeaponEquipped(), hoa_script::WriteScriptDescriptor::InsertNewLine(), hoa_script::ScriptDescriptor::IsFileOpen(), hoa_utils::NumberToString(), and hoa_script::WriteScriptDescriptor::WriteLine().

Here is the call graph for this function:

void hoa_global::GameGlobal::_SaveEvents ( hoa_script::WriteScriptDescriptor file,
GlobalEventGroup event_group 
) [private]

A helper function to GameGlobal::SaveGame() that writes a group of event data to the saved game file.

Parameters:
file A reference to the open and valid file where to write the event data
event_group A pointer to the group of events to store This method will need to be called once for each GlobalEventGroup contained by this class.

Definition at line 833 of file global.cpp.

References hoa_global::GlobalEventGroup::_events, hoa_global::GlobalEventGroup::GetGroupName(), hoa_script::ScriptDescriptor::IsFileOpen(), hoa_utils::NumberToString(), and hoa_script::WriteScriptDescriptor::WriteLine().

Here is the call graph for this function:

template<class T>
void hoa_global::GameGlobal::_SaveInventory ( hoa_script::WriteScriptDescriptor file,
std::string  name,
std::vector< T * > &  inv 
) [private]

A helper function to GameGlobal::SaveGame() that stores the contents of a type of inventory to the saved game file.

Parameters:
file A reference to the open and valid file where to write the inventory list
name The name under which this set of inventory data should be categorized (ie "items", "weapons", etc)
inv A reference to the inventory vector to store
Note:
The class type T must be a derived class of GlobalObject

Definition at line 597 of file global.h.

References hoa_global::GLOBAL_DEBUG, hoa_script::WriteScriptDescriptor::InsertNewLine(), hoa_script::ScriptDescriptor::IsFileOpen(), hoa_utils::NumberToString(), and hoa_script::WriteScriptDescriptor::WriteLine().

Here is the call graph for this function:

void hoa_global::GameGlobal::AddCharacter ( GlobalCharacter ch  ) 

Adds a new pre-initialized character to the party.

Parameters:
ch A pointer to the initialized GlobalCharacter object to add
The GlobalCharacter argument must be created -and- properly initalized (stats members all set, equipment added, skills added) prior to making this call. Adding an uninitialized character will likely result in a segmentation fault or other run-time error somewhere down the road.

Note:
If the number of characters is less than four when this function is called, the new character will automatically be added to the active party.

Definition at line 214 of file global.cpp.

References _active_party, _character_order, _characters, hoa_global::GlobalParty::AddActor(), hoa_global::GlobalActor::GetID(), and hoa_global::GLOBAL_DEBUG.

Here is the call graph for this function:

void hoa_global::GameGlobal::AddCharacter ( uint32  id  ) 

Adds a new character to the party with its initial settings.

Parameters:
id The ID number of the character to add to the party.
Only use this function for when you wish the character to be constructed using its initial stats, equipment, and skills. Otherwise, you should construct the GlobalCharacter externally and invoke the other AddCharacter function with a pointer to it.

Note:
If the number of characters is less than four when this function is called, the new character will automatically be added to the active party.

Definition at line 195 of file global.cpp.

References _active_party, _character_order, _characters, hoa_global::GlobalParty::AddActor(), and hoa_global::GLOBAL_DEBUG.

Referenced by _LoadCharacter(), hoa_boot::BootMode::_OnBattleDebug(), hoa_boot::BootMode::_OnMenuDebug(), and hoa_boot::BootMode::_OnNewGame().

Here is the call graph for this function:

void hoa_global::GameGlobal::AddDrunes ( uint32  amount  )  [inline]

Note:
The overflow condition is not checked here: we just assume it will never occur

Definition at line 344 of file global.h.

References _drunes.

Referenced by hoa_boot::BootMode::_OnShopDebug(), hoa_battle::BattleMode::PlayerVictory(), and hoa_shop::private_shop::ConfirmWindow::Update().

void hoa_global::GameGlobal::AddNewEventGroup ( const std::string &  group_name  ) 

Adds a new event group for the class to manage.

Parameters:
group_name The name of the new event group to add
Note:
If an event group by the given name already exists, the function will abort and not add the new event group. Otherwise, this class will automatically construct a new event group of the given name and place it in its map of event groups.

Definition at line 524 of file global.cpp.

References _event_groups, DoesEventGroupExist(), and hoa_global::GLOBAL_DEBUG.

Referenced by _LoadEvents().

Here is the call graph for this function:

void hoa_global::GameGlobal::AddToInventory ( GlobalObject object  ) 

Adds a new object to the inventory.

Parameters:
object A pointer to the pre-created GlobalObject-type class to add
Once you call this function, GameGlobal assumes it is now responsible for memory management of this object. Therefore, you should never attempt to reference the argument pointer after it is passed to this function, because it may very well now point to an invalid location in memory. You should also never use this function to pass a pointer to an object that was not created with the new operator, because it is guaranteed that sooner or later GameGlobal will invoke delete on this object.

Definition at line 324 of file global.cpp.

References _inventory, _inventory_arm_armor, _inventory_head_armor, _inventory_items, _inventory_leg_armor, _inventory_torso_armor, _inventory_weapons, hoa_global::GlobalObject::GetCount(), hoa_global::GlobalObject::GetID(), hoa_global::GLOBAL_DEBUG, hoa_global::private_global::MAX_ARM_ARMOR_ID, hoa_global::private_global::MAX_HEAD_ARMOR_ID, hoa_global::private_global::MAX_ITEM_ID, hoa_global::private_global::MAX_KEY_ITEM_ID, hoa_global::private_global::MAX_LEG_ARMOR_ID, hoa_global::private_global::MAX_SHARD_ID, hoa_global::private_global::MAX_TORSO_ARMOR_ID, and hoa_global::private_global::MAX_WEAPON_ID.

Here is the call graph for this function:

void hoa_global::GameGlobal::AddToInventory ( uint32  obj_id,
uint32  obj_count = 1 
)

Adds a new object to the inventory.

Parameters:
obj_id The identifier value of the object to add
obj_count The number of instances of the object to add (default == 1) If the item already exists in the inventory, then instead the GlobalObject::_count member is used to increment the count of the stored item.

Definition at line 275 of file global.cpp.

References _inventory, _inventory_arm_armor, _inventory_head_armor, _inventory_items, _inventory_leg_armor, _inventory_torso_armor, _inventory_weapons, GlobalArmor, GlobalItem, GlobalWeapon, hoa_global::private_global::MAX_ARM_ARMOR_ID, hoa_global::private_global::MAX_HEAD_ARMOR_ID, hoa_global::private_global::MAX_ITEM_ID, hoa_global::private_global::MAX_KEY_ITEM_ID, hoa_global::private_global::MAX_LEG_ARMOR_ID, hoa_global::private_global::MAX_SHARD_ID, hoa_global::private_global::MAX_TORSO_ARMOR_ID, and hoa_global::private_global::MAX_WEAPON_ID.

Referenced by _LoadInventory(), hoa_boot::BootMode::_OnNewGame(), and hoa_shop::private_shop::ConfirmWindow::Update().

uint32 hoa_global::GameGlobal::AverageActivePartyExperienceLevel (  )  const [inline]

Calculates the average experience level of members in the active party.

Returns:
The average (integer) experience level of all members in the active party This is used for determining the level of growth for enemies in battle.

Definition at line 355 of file global.h.

References _active_party, and hoa_global::GlobalParty::AverageExperienceLevel().

Referenced by hoa_battle::BattleMode::AddEnemy().

Here is the call graph for this function:

void hoa_global::GameGlobal::ClearAllData (  ) 

Deletes all data stored within the GameGlobal class object This function is meant to be called when the user quits the current game instance and returns to the boot screen. It will delete all characters, inventory, and other data relevant to the current game.

Definition at line 161 of file global.cpp.

References _active_party, _character_order, _characters, _event_groups, _inventory, _inventory_arm_armor, _inventory_head_armor, _inventory_items, _inventory_key_items, _inventory_leg_armor, _inventory_shards, _inventory_torso_armor, _inventory_weapons, and hoa_global::GlobalParty::RemoveAllActors().

Referenced by hoa_boot::BootMode::Reset(), and ~GameGlobal().

Here is the call graph for this function:

void hoa_global::GameGlobal::DecrementObjectCount ( uint32  obj_id,
uint32  obj_count = 1 
)

Decrements the number (count) of an object in the inventory.

Parameters:
item_id The integer identifier of the item that will have its count decremented
count The amount to decrease the object's count by (default value == 1)
If the item does not exist in the inventory, this function will do nothing. If the count parameter is set to zero, no change will take place. If the count parameter is greater than or equal to the current count of the object, the object will be completely removed from the inventory.

Note:
The callee can not assume that the function call succeeded, but rather has to check this themselves.

Definition at line 488 of file global.cpp.

References _inventory, hoa_global::GLOBAL_DEBUG, and RemoveFromInventory().

Referenced by hoa_shop::private_shop::ConfirmWindow::Update().

Here is the call graph for this function:

bool hoa_global::GameGlobal::DoesEventExist ( const std::string &  group_name,
const std::string &  event_name 
) const

Determines if an event of a given name exists within a given group.

Parameters:
group_name The name of the event group where the event to check is contained
event_name The name of the event to check for
Returns:
True if the event was found, or false if the event name or group name was not found

bool hoa_global::GameGlobal::DoesEventGroupExist ( const std::string &  group_name  )  const [inline]

Queries whether or not an event group of a given name exists.

Parameters:
group_name The name of the event group to check for
Returns:
True if the event group name was found, false if it was not

Definition at line 294 of file global.h.

References _event_groups.

Referenced by AddNewEventGroup().

GlobalParty* hoa_global::GameGlobal::GetActiveParty (  )  [inline]

Definition at line 393 of file global.h.

References _active_party.

Referenced by hoa_menu::MenuMode::_DrawBottomMenu(), hoa_menu::private_menu::EquipWindow::_InitCharSelect(), hoa_menu::private_menu::SkillsWindow::_InitCharSelect(), hoa_menu::private_menu::StatusWindow::_InitCharSelect(), hoa_menu::private_menu::InventoryWindow::_InitCharSelect(), hoa_battle::BattleMode::_Initialize(), hoa_menu::private_menu::EquipWindow::_UpdateEquipList(), hoa_menu::private_menu::SkillsWindow::_UpdateSkillList(), hoa_battle::BattleMode::_UpdateTargetSelection(), hoa_menu::private_menu::SkillsWindow::Draw(), hoa_menu::private_menu::EquipWindow::EquipWindow(), hoa_menu::private_menu::StatusWindow::StatusWindow(), hoa_menu::private_menu::SkillsWindow::Update(), hoa_menu::private_menu::StatusWindow::Update(), hoa_menu::private_menu::InventoryWindow::Update(), and hoa_menu::private_menu::StatusWindow::~StatusWindow().

GlobalCharacter * hoa_global::GameGlobal::GetCharacter ( uint32  id  ) 

Returns a pointer to a character currently in the party.

Parameters:
id The ID number of the character to retrieve.
Returns:
A pointer to the character, or NULL if the character was not found.

Definition at line 259 of file global.cpp.

References _characters, and hoa_global::GLOBAL_DEBUG.

Referenced by hoa_menu::private_menu::CharacterWindow::Draw().

std::vector<GlobalCharacter*>* hoa_global::GameGlobal::GetCharacterOrder (  )  [inline]

Definition at line 390 of file global.h.

References _character_order.

uint32 hoa_global::GameGlobal::GetDrunes (  )  const [inline]

Definition at line 381 of file global.h.

References _drunes.

Referenced by hoa_menu::MenuMode::_DrawBottomMenu(), hoa_shop::ShopMode::GetTotalRemaining(), and hoa_shop::private_shop::ShopActionWindow::UpdateFinanceText().

GlobalEventGroup * hoa_global::GameGlobal::GetEventGroup ( const std::string &  group_name  )  const

Returns a pointer to an event group of the specified name.

Parameters:
group_name The name of the event group to retreive
Returns:
A pointer to the GlobalEventGroup that represents the event group, or NULL if no event group of the specifed name was found
You can use this method to invoke the public methods of the GlobalEventGroup class. For example, if we wanted to add a new event "cave_collapse" with a value of 1 to the group event "cave_map", we would do the following: GlobalManager->GetEventGroup("cave_map")->AddNewEvent("cave_collapse", 1); Be careful, however, because since this function returns NULL if the event group was not found, the example code above would produce a segmentation fault if no event group by the name "cave_map" existed.

Definition at line 538 of file global.cpp.

References _event_groups, and hoa_global::GLOBAL_DEBUG.

Referenced by _LoadEvents().

int32 hoa_global::GameGlobal::GetEventValue ( const std::string &  group_name,
const std::string &  event_name 
) const

Returns the value of an event inside of a specified group.

Parameters:
group_name The name of the event group where the event is contained
event_name The name of the event whose value should be retrieved
Returns:
The value of the requested event, or GLOBAL_BAD_EVENT if the event was not found

Definition at line 550 of file global.cpp.

References _event_groups, and hoa_global::GLOBAL_BAD_EVENT.

std::map<uint32, GlobalObject*>* hoa_global::GameGlobal::GetInventory (  )  [inline]

Definition at line 396 of file global.h.

References _inventory.

Referenced by hoa_menu::MenuMode::_HandleInventoryMenu(), hoa_menu::private_menu::InventoryWindow::_UpdateItemText(), hoa_shop::ShopMode::Reset(), hoa_shop::private_shop::ConfirmWindow::Update(), hoa_shop::private_shop::ShopActionWindow::Update(), hoa_menu::private_menu::InventoryWindow::Update(), and hoa_shop::private_shop::ObjectSellListWindow::UpdateSellList().

std::vector<GlobalArmor*>* hoa_global::GameGlobal::GetInventoryArmArmor (  )  [inline]

Definition at line 411 of file global.h.

References _inventory_arm_armor.

Referenced by hoa_menu::private_menu::EquipWindow::_UpdateEquipList(), and hoa_menu::private_menu::InventoryWindow::_UpdateItemText().

std::vector<GlobalArmor*>* hoa_global::GameGlobal::GetInventoryHeadArmor (  )  [inline]

Definition at line 405 of file global.h.

References _inventory_head_armor.

Referenced by hoa_menu::private_menu::EquipWindow::_UpdateEquipList(), and hoa_menu::private_menu::InventoryWindow::_UpdateItemText().

std::vector<GlobalItem*>* hoa_global::GameGlobal::GetInventoryItems (  )  [inline]

Definition at line 399 of file global.h.

References _inventory_items.

Referenced by hoa_battle::private_battle::ActionWindow::_ConstructActionSelectionList(), hoa_menu::private_menu::InventoryWindow::_UpdateItemText(), and hoa_battle::private_battle::ActionWindow::Initialize().

std::vector<GlobalKeyItem*>* hoa_global::GameGlobal::GetInventoryKeyItems (  )  [inline]

Definition at line 420 of file global.h.

References _inventory_key_items.

Referenced by hoa_menu::private_menu::InventoryWindow::_UpdateItemText().

std::vector<GlobalArmor*>* hoa_global::GameGlobal::GetInventoryLegArmor (  )  [inline]

Definition at line 414 of file global.h.

References _inventory_leg_armor.

Referenced by hoa_menu::private_menu::EquipWindow::_UpdateEquipList(), and hoa_menu::private_menu::InventoryWindow::_UpdateItemText().

std::vector<GlobalShard*>* hoa_global::GameGlobal::GetInventoryShards (  )  [inline]

Definition at line 417 of file global.h.

References _inventory_shards.

std::vector<GlobalArmor*>* hoa_global::GameGlobal::GetInventoryTorsoArmor (  )  [inline]

Definition at line 408 of file global.h.

References _inventory_torso_armor.

Referenced by hoa_menu::private_menu::EquipWindow::_UpdateEquipList(), and hoa_menu::private_menu::InventoryWindow::_UpdateItemText().

std::vector<GlobalWeapon*>* hoa_global::GameGlobal::GetInventoryWeapons (  )  [inline]

Definition at line 402 of file global.h.

References _inventory_weapons.

Referenced by hoa_menu::private_menu::EquipWindow::_UpdateEquipList(), and hoa_menu::private_menu::InventoryWindow::_UpdateItemText().

hoa_video::StillImage& hoa_global::GameGlobal::GetLocationGraphic (  )  [inline]

Definition at line 387 of file global.h.

References _location_graphic.

hoa_utils::ustring& hoa_global::GameGlobal::GetLocationName (  )  [inline]

Definition at line 384 of file global.h.

References _location_name.

uint32 hoa_global::GameGlobal::GetNumberEventGroups (  )  const [inline]

Returns the number of event groups stored in the class.

Definition at line 333 of file global.h.

References _event_groups.

uint32 hoa_global::GameGlobal::GetNumberEvents ( const std::string &  group_name  )  const

Returns the number of events for a specified group name.

Parameters:
group_name The name of the event group to retrieve the number of events for
Returns:
The number of events in the group, or zero if no such group name existed

void hoa_global::GameGlobal::IncrementObjectCount ( uint32  obj_id,
uint32  obj_count = 1 
)

Increments the number (count) of an object in the inventory.

Parameters:
item_id The integer identifier of the item that will have its count incremented
count The amount to increase the object's count by (default value == 1)
If the item does not exist in the inventory, this function will do nothing. If the count parameter is set to zero, no change will take place.

Note:
The callee can not assume that the function call succeeded, but rather has to check this themselves.

Definition at line 475 of file global.cpp.

References _inventory, and hoa_global::GLOBAL_DEBUG.

bool hoa_global::GameGlobal::IsCharacterInParty ( uint32  id  )  [inline]

Checks whether or not a character is in the party.

Parameters:
id The id of the character to check for
Returns:
True if the character was found to be in the party, or false if they were not found.

Definition at line 209 of file global.h.

References _characters.

bool hoa_global::GameGlobal::IsObjectInInventory ( uint32  id  )  [inline]

Checks whether or a given object is currently stored in the inventory.

Parameters:
id The id of the object (item, weapon, armor, etc.) to check for
Returns:
True if the object was found in the inventor, or false if it was not found

Definition at line 284 of file global.h.

References _inventory.

bool hoa_global::GameGlobal::LoadGame ( const std::string &  filename  ) 

Loads all global data from a saved game file.

Parameters:
filename The filename of the saved game file where to read the data from
Returns:
True if the game was successfully loaded, false if it was not

Referenced by hoa_boot::BootMode::_OnLoadGame().

void hoa_global::GameGlobal::RemoveCharacter ( uint32  id  ) 

Removes a character from the party.

Parameters:
id The ID number of the character to remove from the party.

Definition at line 232 of file global.cpp.

References _active_party, _character_order, _characters, hoa_global::GlobalParty::AddActor(), hoa_global::GLOBAL_DEBUG, and hoa_global::GlobalParty::RemoveAllActors().

Here is the call graph for this function:

void hoa_global::GameGlobal::RemoveFromInventory ( uint32  obj_id  ) 

Removes an object from the inventory.

Parameters:
obj_id The identifier value of the object to remove
Note:
If the object is not in the inventory, the function will do nothing.
This function removes the item regardless of what the GlobalObject::_count member is set to. If you want to remove only a certain number of instances of the object, use the function GameGlobal::DecrementObjectCount.

Definition at line 385 of file global.cpp.

References _inventory, _inventory_arm_armor, _inventory_head_armor, _inventory_items, _inventory_key_items, _inventory_leg_armor, _inventory_shards, _inventory_torso_armor, _inventory_weapons, _RemoveFromInventory(), hoa_global::GLOBAL_DEBUG, hoa_global::private_global::MAX_ARM_ARMOR_ID, hoa_global::private_global::MAX_HEAD_ARMOR_ID, hoa_global::private_global::MAX_ITEM_ID, hoa_global::private_global::MAX_KEY_ITEM_ID, hoa_global::private_global::MAX_LEG_ARMOR_ID, hoa_global::private_global::MAX_SHARD_ID, hoa_global::private_global::MAX_TORSO_ARMOR_ID, and hoa_global::private_global::MAX_WEAPON_ID.

Referenced by DecrementObjectCount(), hoa_battle::private_battle::ScriptEvent::RunScript(), and hoa_menu::private_menu::InventoryWindow::Update().

Here is the call graph for this function:

GlobalObject * hoa_global::GameGlobal::RetrieveFromInventory ( uint32  obj_id,
bool  all_counts = false 
)

Retries a single copy of an object from the inventory.

Parameters:
obj_id The identifier value of the item to remove
all_counts If set to true, all counts of the object will be removed from the inventory (default value == false)
Returns:
A newly instantiated copy of the object, or NULL if the object was not found in the inventory
If all_counts is false, the returned object will have a count of one and the count of the object inside the inventory will be decremented by one. If all_counts is ture, the returned object will have the same count as was previously in the inventory, and the object will be removed from the inventory alltogether. Note that the pointer returned will need to be deleted by the user code, unless the object is re-added to the inventory or equipped on a character.

Definition at line 424 of file global.cpp.

References _inventory, _inventory_arm_armor, _inventory_head_armor, _inventory_items, _inventory_key_items, _inventory_leg_armor, _inventory_shards, _inventory_torso_armor, _inventory_weapons, _RetrieveFromInventory(), hoa_global::GLOBAL_DEBUG, hoa_global::private_global::MAX_ARM_ARMOR_ID, hoa_global::private_global::MAX_HEAD_ARMOR_ID, hoa_global::private_global::MAX_ITEM_ID, hoa_global::private_global::MAX_KEY_ITEM_ID, hoa_global::private_global::MAX_LEG_ARMOR_ID, hoa_global::private_global::MAX_SHARD_ID, hoa_global::private_global::MAX_TORSO_ARMOR_ID, and hoa_global::private_global::MAX_WEAPON_ID.

Here is the call graph for this function:

bool hoa_global::GameGlobal::SaveGame ( std::string &  filename  ) 

Saves all global data to a saved game file.

Parameters:
filename The filename of the saved game file where to write the data to
Returns:
True if the game was successfully saved, false if it was not

Referenced by hoa_menu::MenuMode::_HandleSaveMenu(), and hoa_menu::private_menu::FormationWindow::FormationWindow().

void hoa_global::GameGlobal::SetDrunes ( uint32  amount  )  [inline]

Definition at line 378 of file global.h.

References _drunes.

Referenced by hoa_boot::BootMode::_OnNewGame().

void hoa_global::GameGlobal::SetLocation ( const hoa_utils::ustring location_name,
const std::string &  location_graphic_filename 
)

Sets the name and graphic for the current location.

Parameters:
location_name The ustring that contains the name of the current map
location_graphic_filename The filename of the graphic image that represents this location

Definition at line 576 of file global.cpp.

References _location_graphic, _location_name, hoa_video::GameVideo::DeleteImage(), hoa_global::GLOBAL_DEBUG, hoa_video::GameVideo::LoadImage(), hoa_video::StillImage::SetFilename(), and hoa_video::VideoManager.

Here is the call graph for this function:

bool hoa_global::GameGlobal::SingletonInitialize (  )  [virtual]

A method for the inheriting class to implement, which initializes the class.

Returns:
True if initialization was successful, false if it was not

Implements hoa_utils::Singleton< T >.

Definition at line 119 of file global.cpp.

References _arm_armor_script, _attack_skills_script, _head_armor_script, _items_script, _leg_armor_script, _torso_armor_script, _weapons_script, hoa_script::ReadScriptDescriptor::OpenFile(), and hoa_script::ReadScriptDescriptor::OpenTable().

Referenced by InitializeEngine().

Here is the call graph for this function:

void hoa_global::GameGlobal::SubtractDrunes ( uint32  amount  )  [inline]

Note:
The amount is only subtracted if the current funds is equal to or exceeds the amount to subtract

Definition at line 348 of file global.h.

References _drunes.

Referenced by hoa_shop::private_shop::ConfirmWindow::Update().


Friends And Related Function Documentation

friend class GlobalArmor [friend]

Definition at line 151 of file global.h.

Referenced by _LoadCharacter(), and AddToInventory().

friend class GlobalItem [friend]

Definition at line 149 of file global.h.

Referenced by AddToInventory().

friend class GlobalSkill [friend]

Definition at line 152 of file global.h.

friend class GlobalWeapon [friend]

Definition at line 150 of file global.h.

Referenced by _LoadCharacter(), and AddToInventory().

friend class hoa_utils::Singleton< GameGlobal > [friend]

Definition at line 148 of file global.h.


Member Data Documentation

GlobalParty hoa_global::GameGlobal::_active_party [private]

The active party of characters The active party contains the group of characters that will fight when a battle begins. This party can be up to four characters, and should always contain at least one character.

Definition at line 451 of file global.h.

Referenced by AddCharacter(), AverageActivePartyExperienceLevel(), ClearAllData(), GetActiveParty(), and RemoveCharacter().

hoa_script::ReadScriptDescriptor hoa_global::GameGlobal::_arm_armor_script [private]

Definition at line 482 of file global.h.

Referenced by hoa_global::GlobalArmor::GlobalArmor(), SingletonInitialize(), and ~GameGlobal().

hoa_script::ReadScriptDescriptor hoa_global::GameGlobal::_attack_skills_script [private]

Definition at line 486 of file global.h.

Referenced by hoa_global::GlobalSkill::GlobalSkill(), SingletonInitialize(), and ~GameGlobal().

std::vector<GlobalCharacter*> hoa_global::GameGlobal::_character_order [private]

A vector whose purpose is to maintain the order of characters The first four characters in this vector are in the active party; the rest are in reserve.

Definition at line 445 of file global.h.

Referenced by AddCharacter(), ClearAllData(), GetCharacterOrder(), and RemoveCharacter().

std::map<uint32, GlobalCharacter*> hoa_global::GameGlobal::_characters [private]

A map containing all characters that the player has discovered This map contains all characters that the player has met with, regardless of whether or not they are in the active party. The map key is the character's unique ID number.

Definition at line 440 of file global.h.

Referenced by AddCharacter(), ClearAllData(), GetCharacter(), IsCharacterInParty(), and RemoveCharacter().

hoa_script::ReadScriptDescriptor hoa_global::GameGlobal::_defend_skills_script [private]

Definition at line 487 of file global.h.

Referenced by hoa_global::GlobalSkill::GlobalSkill().

uint32 hoa_global::GameGlobal::_drunes [private]

The amount of financial resources (drunes) that the party currently has.

Definition at line 428 of file global.h.

Referenced by AddDrunes(), GetDrunes(), SetDrunes(), and SubtractDrunes().

std::map<std::string, GlobalEventGroup*> hoa_global::GameGlobal::_event_groups [private]

The container which stores all of the groups of events that have occured in the game The name of the GlobalEventGroup serves as its key in this map data structure.

Definition at line 494 of file global.h.

Referenced by AddNewEventGroup(), ClearAllData(), DoesEventGroupExist(), GetEventGroup(), GetEventValue(), and GetNumberEventGroups().

hoa_script::ReadScriptDescriptor hoa_global::GameGlobal::_head_armor_script [private]

Definition at line 480 of file global.h.

Referenced by hoa_global::GlobalArmor::GlobalArmor(), SingletonInitialize(), and ~GameGlobal().

std::map<uint32, GlobalObject*> hoa_global::GameGlobal::_inventory [private]

Retains a list of all of the objects currently stored in the player's inventory This map is used to quickly check if an item is in the inventory or not. The key to the map is the object's identification number. When an object is added to the inventory, if it already exists then the object counter is simply increased instead of adding an entire new class object. When the object count becomes zero, the object is removed from the inventory. Duplicates of all objects are retained in the various inventory containers below.

Definition at line 459 of file global.h.

Referenced by _RemoveFromInventory(), _RetrieveFromInventory(), AddToInventory(), ClearAllData(), DecrementObjectCount(), GetInventory(), IncrementObjectCount(), IsObjectInInventory(), RemoveFromInventory(), and RetrieveFromInventory().

std::vector<GlobalArmor*> hoa_global::GameGlobal::_inventory_arm_armor [private]

Definition at line 470 of file global.h.

Referenced by AddToInventory(), ClearAllData(), GetInventoryArmArmor(), RemoveFromInventory(), and RetrieveFromInventory().

std::vector<GlobalArmor*> hoa_global::GameGlobal::_inventory_head_armor [private]

Definition at line 468 of file global.h.

Referenced by AddToInventory(), ClearAllData(), GetInventoryHeadArmor(), RemoveFromInventory(), and RetrieveFromInventory().

std::vector<GlobalItem*> hoa_global::GameGlobal::_inventory_items [private]

Inventory containers These vectors contain the inventory of the entire party. The vectors are sorted according to the user's personal preferences. When a new object is added to the inventory, by default it will be placed at the end of the vector.

Definition at line 466 of file global.h.

Referenced by AddToInventory(), ClearAllData(), GetInventoryItems(), RemoveFromInventory(), and RetrieveFromInventory().

std::vector<GlobalKeyItem*> hoa_global::GameGlobal::_inventory_key_items [private]

Definition at line 473 of file global.h.

Referenced by ClearAllData(), GetInventoryKeyItems(), RemoveFromInventory(), and RetrieveFromInventory().

std::vector<GlobalArmor*> hoa_global::GameGlobal::_inventory_leg_armor [private]

Definition at line 471 of file global.h.

Referenced by AddToInventory(), ClearAllData(), GetInventoryLegArmor(), RemoveFromInventory(), and RetrieveFromInventory().

std::vector<GlobalShard*> hoa_global::GameGlobal::_inventory_shards [private]

Definition at line 472 of file global.h.

Referenced by ClearAllData(), GetInventoryShards(), RemoveFromInventory(), and RetrieveFromInventory().

std::vector<GlobalArmor*> hoa_global::GameGlobal::_inventory_torso_armor [private]

Definition at line 469 of file global.h.

Referenced by AddToInventory(), ClearAllData(), GetInventoryTorsoArmor(), RemoveFromInventory(), and RetrieveFromInventory().

std::vector<GlobalWeapon*> hoa_global::GameGlobal::_inventory_weapons [private]

Definition at line 467 of file global.h.

Referenced by AddToInventory(), ClearAllData(), GetInventoryWeapons(), RemoveFromInventory(), and RetrieveFromInventory().

hoa_script::ReadScriptDescriptor hoa_global::GameGlobal::_items_script [private]

Script files that retain data for various global constructs.

Definition at line 478 of file global.h.

Referenced by hoa_global::GlobalItem::GlobalItem(), SingletonInitialize(), and ~GameGlobal().

hoa_script::ReadScriptDescriptor hoa_global::GameGlobal::_leg_armor_script [private]

Definition at line 483 of file global.h.

Referenced by hoa_global::GlobalArmor::GlobalArmor(), SingletonInitialize(), and ~GameGlobal().

hoa_video::StillImage hoa_global::GameGlobal::_location_graphic [private]

The graphical image which represents the current location.

Definition at line 434 of file global.h.

Referenced by GetLocationGraphic(), and SetLocation().

hoa_utils::ustring hoa_global::GameGlobal::_location_name [private]

The name of the map that the current party is on.

Definition at line 431 of file global.h.

Referenced by GetLocationName(), and SetLocation().

hoa_script::ReadScriptDescriptor hoa_global::GameGlobal::_support_skills_script [private]

Definition at line 488 of file global.h.

Referenced by hoa_global::GlobalSkill::GlobalSkill().

hoa_script::ReadScriptDescriptor hoa_global::GameGlobal::_torso_armor_script [private]

Definition at line 481 of file global.h.

Referenced by hoa_global::GlobalArmor::GlobalArmor(), SingletonInitialize(), and ~GameGlobal().

hoa_script::ReadScriptDescriptor hoa_global::GameGlobal::_weapons_script [private]

Definition at line 479 of file global.h.

Referenced by hoa_global::GlobalWeapon::GlobalWeapon(), SingletonInitialize(), and ~GameGlobal().


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 23:14:02 2007 for Hero of Allacrost by  doxygen 1.5.1