xoreos  0.0.5
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Engines::NWN2::Campaign Class Reference

#include <campaign.h>

Inheritance diagram for Engines::NWN2::Campaign:
Inheritance graph
[legend]
Collaboration diagram for Engines::NWN2::Campaign:
Collaboration graph
[legend]

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::UStringgetName () const
 Return the name of the current campaign. More...
 
const Common::UStringgetDescription () const
 Return the description of the current campaign. More...
 
ModulegetModule ()
 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
 
VariablegetVariable (const Common::UString &var, Type type=kTypeVoid)
 
const VariablegetVariable (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::EventEventQueue
 

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
 

Detailed Description

Definition at line 47 of file campaign.h.

Member Typedef Documentation

◆ EventQueue

Definition at line 101 of file campaign.h.

Constructor & Destructor Documentation

◆ Campaign()

Engines::NWN2::Campaign::Campaign ( ::Engines::Console console)

Definition at line 56 of file campaign.cpp.

References _console, and _module.

◆ ~Campaign()

Engines::NWN2::Campaign::~Campaign ( )

Definition at line 62 of file campaign.cpp.

References clear().

Here is the call graph for this function:

Member Function Documentation

◆ addEvent()

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.

◆ changeCampaign()

void Engines::NWN2::Campaign::changeCampaign ( const Common::UString campaign,
bool  standalone 
)
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().

Here is the caller graph for this function:

◆ clear()

void Engines::NWN2::Campaign::clear ( )

Clear the whole context.

Definition at line 69 of file campaign.cpp.

References unload().

Referenced by loadCampaign(), and ~Campaign().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enter()

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().

Here is the caller graph for this function:

◆ exit()

void Engines::NWN2::Campaign::exit ( )

Exit the currently running campaign.

Definition at line 165 of file campaign.cpp.

References _exit.

◆ getDescription() [1/2]

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.

◆ getDescription() [2/2]

Common::UString Engines::NWN2::Campaign::getDescription ( const Common::UString campaign)
static

Definition at line 339 of file campaign.cpp.

References Common::FileList::findFirst(), getDirectory(), and MKTAG.

Here is the call graph for this function:

◆ getDirectory()

Common::UString Engines::NWN2::Campaign::getDirectory ( const Common::UString campaign,
bool  relative 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getModule()

Module & Engines::NWN2::Campaign::getModule ( )

Return the currently running module.

Definition at line 81 of file campaign.cpp.

References _module.

◆ getName() [1/2]

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().

Here is the caller graph for this function:

◆ getName() [2/2]

Common::UString Engines::NWN2::Campaign::getName ( const Common::UString campaign)
static

Definition at line 324 of file campaign.cpp.

References Common::FileList::findFirst(), getDirectory(), and MKTAG.

Here is the call graph for this function:

◆ handleEvents()

void Engines::NWN2::Campaign::handleEvents ( )
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isLoaded()

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.

◆ isRunning()

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().

Here is the caller graph for this function:

◆ leave()

void Engines::NWN2::Campaign::leave ( )

Leave the running campaign, quitting it.

Definition at line 245 of file campaign.cpp.

References _exit, _module, and _running.

◆ load()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadCampaign()

void Engines::NWN2::Campaign::loadCampaign ( const Common::UString campaign,
bool  standalone 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadCampaignResource()

void Engines::NWN2::Campaign::loadCampaignResource ( const Common::UString campaign)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadModule()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processEventQueue()

void Engines::NWN2::Campaign::processEventQueue ( )

Process the current event queue.

Definition at line 256 of file campaign.cpp.

References handleEvents(), isRunning(), and replaceCampaign().

Here is the call graph for this function:

◆ replaceCampaign()

void Engines::NWN2::Campaign::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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupStandaloneModule()

void Engines::NWN2::Campaign::setupStandaloneModule ( const Common::UString module)
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().

Here is the caller graph for this function:

◆ unload()

void Engines::NWN2::Campaign::unload ( bool  completeUnload = true)
private

Unload the whole shebang.

Parameters
completeUnloadAlso 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unloadPC()

void Engines::NWN2::Campaign::unloadPC ( )
private

Definition at line 121 of file campaign.cpp.

References _pc.

Referenced by unload(), and usePC().

Here is the caller graph for this function:

◆ 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().

Here is the call graph for this function:

Member Data Documentation

◆ _console

::Engines::Console* Engines::NWN2::Campaign::_console
private

Definition at line 104 of file campaign.h.

Referenced by Campaign(), and handleEvents().

◆ _description

Common::UString Engines::NWN2::Campaign::_description
private

The description of the currently loaded campaign.

Definition at line 113 of file campaign.h.

Referenced by getDescription(), loadCampaignResource(), and unload().

◆ _eventQueue

EventQueue Engines::NWN2::Campaign::_eventQueue
private

Definition at line 134 of file campaign.h.

Referenced by addEvent(), handleEvents(), and unload().

◆ _exit

bool Engines::NWN2::Campaign::_exit
private

Should we exit the campaign?

Definition at line 108 of file campaign.h.

Referenced by enter(), exit(), isRunning(), leave(), and unload().

◆ _hasCampaign

bool Engines::NWN2::Campaign::_hasCampaign
private

Do we have a campaign?

Definition at line 106 of file campaign.h.

Referenced by enter(), isLoaded(), loadCampaign(), and unload().

◆ _module

Common::ScopedPtr<Module> Engines::NWN2::Campaign::_module
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().

◆ _modules

std::list<Common::UString> Engines::NWN2::Campaign::_modules
private

All modules used by the current campaign.

Definition at line 116 of file campaign.h.

Referenced by loadCampaignResource(), setupStandaloneModule(), and unload().

◆ _name

Common::UString Engines::NWN2::Campaign::_name
private

The name of the currently loaded campaign.

Definition at line 111 of file campaign.h.

Referenced by getName(), loadCampaignResource(), and unload().

◆ _newCampaign

Common::UString Engines::NWN2::Campaign::_newCampaign
private

The campaign we should change to.

Definition at line 130 of file campaign.h.

Referenced by changeCampaign(), replaceCampaign(), and unload().

◆ _newCampaignStandalone

bool Engines::NWN2::Campaign::_newCampaignStandalone
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().

◆ _pc

Common::ScopedPtr<Creature> Engines::NWN2::Campaign::_pc
private

The player character we use.

Definition at line 127 of file campaign.h.

Referenced by enter(), isLoaded(), unloadPC(), and usePC().

◆ _resCampaign

Common::ChangeID Engines::NWN2::Campaign::_resCampaign
private

Resources added by the campaign.

Definition at line 121 of file campaign.h.

Referenced by loadCampaignResource(), and unload().

◆ _running

bool Engines::NWN2::Campaign::_running
private

Are we currently running a campaign?

Definition at line 107 of file campaign.h.

Referenced by enter(), isRunning(), leave(), and unload().

◆ _startModule

Common::UString Engines::NWN2::Campaign::_startModule
private

The module the current campaign starts in.

Definition at line 118 of file campaign.h.

Referenced by loadCampaign(), loadCampaignResource(), setupStandaloneModule(), and unload().


The documentation for this class was generated from the following files: