xoreos
0.0.5
|
#include <campaign.h>
Public Member Functions | |
Campaign (::Engines::Console &console) | |
~Campaign () | |
void | clear () |
Clear the whole context. More... | |
bool | isLoaded () const |
Is a campaign currently loaded and ready to run? More... | |
bool | isRunning () const |
Is a campaign currently running? More... | |
void | load (const Common::UString &campaign) |
Load a campaign. More... | |
void | loadModule (const Common::UString &module) |
Load a stand-alone module as a campaign. More... | |
void | usePC (const Common::UString &bic, bool local) |
Use this character as the player character. More... | |
void | exit () |
Exit the currently running campaign. More... | |
const Common::UString & | getName () const |
Return the name of the current campaign. More... | |
const Common::UString & | getDescription () const |
Return the description of the current campaign. More... | |
Module & | getModule () |
Return the currently running module. More... | |
void | enter () |
Enter the loaded campaign, starting it. More... | |
void | leave () |
Leave the running campaign, quitting it. More... | |
void | addEvent (const Events::Event &event) |
Add a single event for consideration into the event queue. More... | |
void | processEventQueue () |
Process the current event queue. More... | |
Public Member Functions inherited from Aurora::NWScript::VariableContainer | |
VariableContainer () | |
virtual | ~VariableContainer () |
bool | hasVariable (const Common::UString &var) const |
Variable & | getVariable (const Common::UString &var, Type type=kTypeVoid) |
const Variable & | getVariable (const Common::UString &var) const |
void | setVariable (const Common::UString &var, const Variable &value) |
void | removeVariable (const Common::UString &var) |
void | clearVariables () |
Static Public Member Functions | |
static Common::UString | getName (const Common::UString &campaign) |
static Common::UString | getDescription (const Common::UString &campaign) |
Private Types | |
typedef std::list< Events::Event > | EventQueue |
Private Member Functions | |
void | unload (bool completeUnload=true) |
Unload the whole shebang. More... | |
void | unloadPC () |
void | loadCampaign (const Common::UString &campaign, bool standalone) |
Load a new campaign. More... | |
void | changeCampaign (const Common::UString &campaign, bool standalone) |
Schedule a change to a new campaign. More... | |
void | replaceCampaign () |
Actually replace the currently running campaign. More... | |
void | loadCampaignResource (const Common::UString &campaign) |
Load the actual campaign resources. More... | |
void | setupStandaloneModule (const Common::UString &module) |
Set up the loading of a singular, stand-alone module. More... | |
void | handleEvents () |
Static Private Member Functions | |
static Common::UString | getDirectory (const Common::UString &campaign, bool relative) |
Return the actual real directory for this campaign. More... | |
Private Attributes | |
::Engines::Console * | _console |
bool | _hasCampaign |
Do we have a campaign? More... | |
bool | _running |
Are we currently running a campaign? More... | |
bool | _exit |
Should we exit the campaign? More... | |
Common::UString | _name |
The name of the currently loaded campaign. More... | |
Common::UString | _description |
The description of the currently loaded campaign. More... | |
std::list< Common::UString > | _modules |
All modules used by the current campaign. More... | |
Common::UString | _startModule |
The module the current campaign starts in. More... | |
Common::ChangeID | _resCampaign |
Resources added by the campaign. More... | |
Common::ScopedPtr< Module > | _module |
The current module of the current campaign. More... | |
Common::ScopedPtr< Creature > | _pc |
The player character we use. More... | |
Common::UString | _newCampaign |
The campaign we should change to. More... | |
bool | _newCampaignStandalone |
Is the campaign to change to a stand-alone module? More... | |
EventQueue | _eventQueue |
Definition at line 47 of file campaign.h.
|
private |
Definition at line 101 of file campaign.h.
Engines::NWN2::Campaign::Campaign | ( | ::Engines::Console & | console | ) |
Definition at line 56 of file campaign.cpp.
Engines::NWN2::Campaign::~Campaign | ( | ) |
Definition at line 62 of file campaign.cpp.
References clear().
void Engines::NWN2::Campaign::addEvent | ( | const Events::Event & | event | ) |
Add a single event for consideration into the event queue.
Definition at line 252 of file campaign.cpp.
References _eventQueue.
|
private |
Schedule a change to a new campaign.
Definition at line 298 of file campaign.cpp.
References _newCampaign, and _newCampaignStandalone.
Referenced by load(), and loadModule().
void Engines::NWN2::Campaign::clear | ( | ) |
Clear the whole context.
Definition at line 69 of file campaign.cpp.
References unload().
Referenced by loadCampaign(), and ~Campaign().
void Engines::NWN2::Campaign::enter | ( | ) |
Enter the loaded campaign, starting it.
Definition at line 231 of file campaign.cpp.
References _exit, _hasCampaign, _module, _pc, and _running.
Referenced by replaceCampaign().
void Engines::NWN2::Campaign::exit | ( | ) |
const Common::UString & Engines::NWN2::Campaign::getDescription | ( | ) | const |
Return the description of the current campaign.
Definition at line 77 of file campaign.cpp.
References _description.
|
static |
Definition at line 339 of file campaign.cpp.
References Common::FileList::findFirst(), getDirectory(), and MKTAG.
|
staticprivate |
Return the actual real directory for this campaign.
Definition at line 314 of file campaign.cpp.
References ConfigMan, Common::FilePath::findSubDirectory(), Common::FilePath::relativize(), and ResMan.
Referenced by getDescription(), getName(), and loadCampaignResource().
Module & Engines::NWN2::Campaign::getModule | ( | ) |
Return the currently running module.
Definition at line 81 of file campaign.cpp.
References _module.
const Common::UString & Engines::NWN2::Campaign::getName | ( | ) | const |
Return the name of the current campaign.
Definition at line 73 of file campaign.cpp.
References _name.
Referenced by Engines::NWN2::Console::cmdListCampaigns().
|
static |
Definition at line 324 of file campaign.cpp.
References Common::FileList::findFirst(), getDirectory(), and MKTAG.
|
private |
Definition at line 268 of file campaign.cpp.
References _console, _eventQueue, _module, CameraMan, FreeRoamCam, Engines::Console::isVisible(), Events::kEventKeyDown, Engines::Console::processEvent(), and Engines::Console::show().
Referenced by processEventQueue().
bool Engines::NWN2::Campaign::isLoaded | ( | ) | const |
Is a campaign currently loaded and ready to run?
Definition at line 87 of file campaign.cpp.
References _hasCampaign, _module, and _pc.
bool Engines::NWN2::Campaign::isRunning | ( | ) | const |
Is a campaign currently running?
Definition at line 91 of file campaign.cpp.
References _exit, _module, _running, and EventMan.
Referenced by load(), loadModule(), and processEventQueue().
void Engines::NWN2::Campaign::leave | ( | ) |
Leave the running campaign, quitting it.
Definition at line 245 of file campaign.cpp.
void Engines::NWN2::Campaign::load | ( | const Common::UString & | campaign | ) |
Load a campaign.
Definition at line 125 of file campaign.cpp.
References changeCampaign(), isRunning(), and loadCampaign().
Referenced by Engines::NWN2::Console::cmdLoadCampaign().
|
private |
Load a new campaign.
Definition at line 211 of file campaign.cpp.
References _hasCampaign, _module, _startModule, Common::StackException::add(), clear(), loadCampaignResource(), setupStandaloneModule(), and unload().
Referenced by load(), loadModule(), and replaceCampaign().
|
private |
Load the actual campaign resources.
Definition at line 169 of file campaign.cpp.
References _description, _modules, _name, _resCampaign, _startModule, Common::StackException::add(), Common::UString::c_str(), Common::UString::empty(), getDirectory(), Engines::indexMandatoryDirectory(), Aurora::kFileTypeCAM, MKTAG, and Common::ScopedPtrBase< T, Deallocator >::reset().
Referenced by loadCampaign().
void Engines::NWN2::Campaign::loadModule | ( | const Common::UString & | module | ) |
Load a stand-alone module as a campaign.
Definition at line 137 of file campaign.cpp.
References changeCampaign(), isRunning(), and loadCampaign().
Referenced by Engines::NWN2::Console::cmdLoadModule().
void Engines::NWN2::Campaign::processEventQueue | ( | ) |
Process the current event queue.
Definition at line 256 of file campaign.cpp.
References handleEvents(), isRunning(), and replaceCampaign().
|
private |
Actually replace the currently running campaign.
Definition at line 303 of file campaign.cpp.
References _newCampaign, _newCampaignStandalone, Common::UString::empty(), enter(), and loadCampaign().
Referenced by processEventQueue().
|
private |
Set up the loading of a singular, stand-alone module.
Definition at line 205 of file campaign.cpp.
References _modules, and _startModule.
Referenced by loadCampaign().
|
private |
Unload the whole shebang.
completeUnload | Also unload the PC true: completely quit the module false: the PC can be transferred to a new module. |
Definition at line 95 of file campaign.cpp.
References _description, _eventQueue, _exit, _hasCampaign, _module, _modules, _name, _newCampaign, _newCampaignStandalone, _resCampaign, _running, _startModule, Common::UString::clear(), Aurora::NWScript::VariableContainer::clearVariables(), Engines::deindexResources(), and unloadPC().
Referenced by clear(), and loadCampaign().
|
private |
Definition at line 121 of file campaign.cpp.
References _pc.
Referenced by unload(), and usePC().
void Engines::NWN2::Campaign::usePC | ( | const Common::UString & | bic, |
bool | local | ||
) |
Use this character as the player character.
Definition at line 149 of file campaign.cpp.
References _pc, Common::StackException::add(), Common::UString::c_str(), Common::UString::empty(), Aurora::kLanguageGenderFemale, Aurora::kLanguageGenderMale, LangMan, and unloadPC().
|
private |
Definition at line 104 of file campaign.h.
Referenced by Campaign(), and handleEvents().
|
private |
The description of the currently loaded campaign.
Definition at line 113 of file campaign.h.
Referenced by getDescription(), loadCampaignResource(), and unload().
|
private |
Definition at line 134 of file campaign.h.
Referenced by addEvent(), handleEvents(), and unload().
|
private |
Should we exit the campaign?
Definition at line 108 of file campaign.h.
Referenced by enter(), exit(), isRunning(), leave(), and unload().
|
private |
Do we have a campaign?
Definition at line 106 of file campaign.h.
Referenced by enter(), isLoaded(), loadCampaign(), and unload().
|
private |
The current module of the current campaign.
Definition at line 124 of file campaign.h.
Referenced by Campaign(), enter(), getModule(), handleEvents(), isLoaded(), isRunning(), leave(), loadCampaign(), and unload().
|
private |
All modules used by the current campaign.
Definition at line 116 of file campaign.h.
Referenced by loadCampaignResource(), setupStandaloneModule(), and unload().
|
private |
The name of the currently loaded campaign.
Definition at line 111 of file campaign.h.
Referenced by getName(), loadCampaignResource(), and unload().
|
private |
The campaign we should change to.
Definition at line 130 of file campaign.h.
Referenced by changeCampaign(), replaceCampaign(), and unload().
|
private |
Is the campaign to change to a stand-alone module?
Definition at line 132 of file campaign.h.
Referenced by changeCampaign(), replaceCampaign(), and unload().
|
private |
The player character we use.
Definition at line 127 of file campaign.h.
Referenced by enter(), isLoaded(), unloadPC(), and usePC().
|
private |
Resources added by the campaign.
Definition at line 121 of file campaign.h.
Referenced by loadCampaignResource(), and unload().
|
private |
Are we currently running a campaign?
Definition at line 107 of file campaign.h.
Referenced by enter(), isRunning(), leave(), and unload().
|
private |
The module the current campaign starts in.
Definition at line 118 of file campaign.h.
Referenced by loadCampaign(), loadCampaignResource(), setupStandaloneModule(), and unload().