#include <global.h>
Collaboration diagram for hoa_global::GlobalEventGroup:

| GlobalEventGroup (const GlobalEventGroup &geg) | |
| |
| GlobalEventGroup & | operator= (const GlobalEventGroup &geg) |
Public Member Functions | |
| void | AddNewEvent (const std::string &event_name, int32 event_value=0) |
| Adds a new event to the group. | |
| bool | DoesEventExist (const std::string &event_name) |
| Queries whether or not an event of a given name exists in the group. | |
| int32 | GetEvent (const std::string &event_name) |
| Retrieves the value of a specific event in the group. | |
| std::string | GetGroupName () const |
| Returns a copy of the name of this group. | |
| uint32 | GetNumberEvents () const |
| Returns the number of events currently stored within the group. | |
| void | SetEvent (const std::string &event_name, int32 event_value) |
| Sets the value for an existing event. | |
| ~GlobalEventGroup () | |
Private Member Functions | |
| GlobalEventGroup (const std::string &group_name) | |
| The class constructor is private because groups may only be created by the GameGlobal class. | |
Private Attributes | |
| std::map< std::string, int32 > | _events |
| The map container for all the events in the group The string is the name of the event, which should be unique to the group. The integer value represents the event's status and can take on multiple meanings depending on the event's context. | |
| std::string | _group_name |
| The name given to this group of events. | |
Friends | |
| class | GameGlobal |
****************************************************************************
Events in Allacrost are nothing more than a string, integer pair. The string represents the name of the event while the integer takes on various meanings about the event. One example of an event could be if the player has already seen a certain piece of dialogue, and the integer would be set to zero or non-zero to emulate a boolean value. Another example could be whether the player previous chose option A, B, C, or D when presented with a list of possible actions to take, in which the integer value would represent the option taken.
Because we want to continually look-up whether or not an event has occured, it is not efficient to store all game events in a single container (the larger the number of events, the longer the event search time). Instead, this class collectively represents a group of related events. A typical event group could represent all of the events that occured on a particular map, for instance.
Definition at line 68 of file global.h.
| hoa_global::GlobalEventGroup::~GlobalEventGroup | ( | ) | [inline] |
| hoa_global::GlobalEventGroup::GlobalEventGroup | ( | const std::string & | group_name | ) | [inline, private] |
The class constructor is private because groups may only be created by the GameGlobal class.
| group_name | The name of the group to create (this can not be changed) |
| hoa_global::GlobalEventGroup::GlobalEventGroup | ( | const GlobalEventGroup & | geg | ) | [private] |
| void hoa_global::GlobalEventGroup::AddNewEvent | ( | const std::string & | event_name, | |
| int32 | event_value = 0 | |||
| ) |
Adds a new event to the group.
| event_name | The name of the event to add | |
| event_value | The value of the event to add (default value is zero) |
Definition at line 46 of file global.cpp.
References _events, _group_name, DoesEventExist(), and hoa_global::GLOBAL_DEBUG.
Referenced by hoa_global::GameGlobal::_LoadEvents().
Here is the call graph for this function:

| bool hoa_global::GlobalEventGroup::DoesEventExist | ( | const std::string & | event_name | ) | [inline] |
Queries whether or not an event of a given name exists in the group.
| event_name | The name of the event to check for |
Definition at line 78 of file global.h.
References _events.
Referenced by AddNewEvent().
| int32 hoa_global::GlobalEventGroup::GetEvent | ( | const std::string & | event_name | ) |
Retrieves the value of a specific event in the group.
| event_name | The name of the event to retrieve |
Definition at line 58 of file global.cpp.
References _events, _group_name, hoa_global::GLOBAL_BAD_EVENT, and hoa_global::GLOBAL_DEBUG.
| std::string hoa_global::GlobalEventGroup::GetGroupName | ( | ) | const [inline] |
Returns a copy of the name of this group.
Definition at line 107 of file global.h.
References _group_name.
Referenced by hoa_global::GameGlobal::_SaveEvents().
| uint32 hoa_global::GlobalEventGroup::GetNumberEvents | ( | ) | const [inline] |
| GlobalEventGroup& hoa_global::GlobalEventGroup::operator= | ( | const GlobalEventGroup & | geg | ) | [private] |
| void hoa_global::GlobalEventGroup::SetEvent | ( | const std::string & | event_name, | |
| int32 | event_value | |||
| ) |
Sets the value for an existing event.
| event_name | The name of the event whose value should be changed | |
| event_value | The value to set for the event |
Definition at line 71 of file global.cpp.
References _events, _group_name, and hoa_global::GLOBAL_DEBUG.
friend class GameGlobal [friend] |
std::map<std::string, int32> hoa_global::GlobalEventGroup::_events [private] |
The map container for all the events in the group The string is the name of the event, which should be unique to the group. The integer value represents the event's status and can take on multiple meanings depending on the event's context.
Definition at line 119 of file global.h.
Referenced by hoa_global::GameGlobal::_SaveEvents(), AddNewEvent(), DoesEventExist(), GetEvent(), GetNumberEvents(), and SetEvent().
std::string hoa_global::GlobalEventGroup::_group_name [private] |
The name given to this group of events.
Definition at line 112 of file global.h.
Referenced by AddNewEvent(), GetEvent(), GetGroupName(), and SetEvent().
1.5.1