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::Witcher::Campaign Class Reference

#include <campaign.h>

Collaboration diagram for Engines::Witcher::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 &utc)
 Use this character as the player character. More...
 
void exit ()
 Exit the currently running campaign. More...
 
const Aurora::LocStringgetName () const
 Return the name of the current campaign. More...
 
const Aurora::LocStringgetDescription () const
 Return the description of the current campaign. More...
 
ModulegetModule ()
 Return the currently running module. More...
 
void refreshLocalized ()
 Refresh all localized strings. 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...
 

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 loadCampaignFile (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)
 Return the actual real directory for this campaign. More...
 
static Common::SeekableReadStreamopenMMD (const Common::UString &campaign)
 Open the MMD campaign file 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...
 
Aurora::LocString _name
 The name of the currently loaded campaign. More...
 
Aurora::LocString _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::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 50 of file campaign.h.

Member Typedef Documentation

◆ EventQueue

Definition at line 109 of file campaign.h.

Constructor & Destructor Documentation

◆ Campaign()

Engines::Witcher::Campaign::Campaign ( ::Engines::Console console)

Definition at line 50 of file campaign.cpp.

References _console, and _module.

◆ ~Campaign()

Engines::Witcher::Campaign::~Campaign ( )

Definition at line 56 of file campaign.cpp.

References clear().

Here is the call graph for this function:

Member Function Documentation

◆ addEvent()

void Engines::Witcher::Campaign::addEvent ( const Events::Event event)

Add a single event for consideration into the event queue.

Definition at line 257 of file campaign.cpp.

References _eventQueue.

◆ changeCampaign()

void Engines::Witcher::Campaign::changeCampaign ( const Common::UString campaign,
bool  standalone 
)
private

Schedule a change to a new campaign.

Definition at line 303 of file campaign.cpp.

References _newCampaign, and _newCampaignStandalone.

Referenced by load(), and loadModule().

Here is the caller graph for this function:

◆ clear()

void Engines::Witcher::Campaign::clear ( )

Clear the whole context.

Definition at line 63 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::Witcher::Campaign::enter ( )

Enter the loaded campaign, starting it.

Definition at line 236 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::Witcher::Campaign::exit ( )

Exit the currently running campaign.

Definition at line 232 of file campaign.cpp.

References _exit.

◆ getDescription() [1/2]

const Aurora::LocString & Engines::Witcher::Campaign::getDescription ( ) const

Return the description of the current campaign.

Definition at line 71 of file campaign.cpp.

References _description.

◆ getDescription() [2/2]

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

Definition at line 335 of file campaign.cpp.

References Aurora::GFF3Struct::getString(), Aurora::GFF3File::getTopLevel(), MKTAG, and openMMD().

Here is the call graph for this function:

◆ getDirectory()

Common::UString Engines::Witcher::Campaign::getDirectory ( const Common::UString campaign)
staticprivate

Return the actual real directory for this campaign.

Definition at line 152 of file campaign.cpp.

References Common::UString::c_str(), ConfigMan, Common::UString::equalsIgnoreCase(), Common::FilePath::getDirectory(), Common::FilePath::getFile(), Common::FilePath::relativize(), and ResMan.

Referenced by loadCampaignFile().

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

◆ getModule()

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

Return the currently running module.

Definition at line 75 of file campaign.cpp.

References _module.

◆ getName() [1/2]

const Aurora::LocString & Engines::Witcher::Campaign::getName ( ) const

Return the name of the current campaign.

Definition at line 67 of file campaign.cpp.

References _name.

Referenced by Engines::Witcher::Console::cmdListCampaigns().

Here is the caller graph for this function:

◆ getName() [2/2]

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

Definition at line 323 of file campaign.cpp.

References Aurora::GFF3Struct::getString(), Aurora::GFF3File::getTopLevel(), MKTAG, and openMMD().

Here is the call graph for this function:

◆ handleEvents()

void Engines::Witcher::Campaign::handleEvents ( )
private

Definition at line 273 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::Witcher::Campaign::isLoaded ( ) const

Is a campaign currently loaded and ready to run?

Definition at line 81 of file campaign.cpp.

References _hasCampaign, _module, and _pc.

◆ isRunning()

bool Engines::Witcher::Campaign::isRunning ( ) const

Is a campaign currently running?

Definition at line 85 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::Witcher::Campaign::leave ( )

Leave the running campaign, quitting it.

Definition at line 250 of file campaign.cpp.

References _exit, _module, and _running.

◆ load()

void Engines::Witcher::Campaign::load ( const Common::UString campaign)

Load a campaign.

Definition at line 115 of file campaign.cpp.

References changeCampaign(), isRunning(), and loadCampaign().

Referenced by Engines::Witcher::Console::cmdLoadCampaign().

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

◆ loadCampaign()

void Engines::Witcher::Campaign::loadCampaign ( const Common::UString campaign,
bool  standalone 
)
private

Load a new campaign.

Definition at line 198 of file campaign.cpp.

References _hasCampaign, _module, _startModule, Common::StackException::add(), clear(), loadCampaignFile(), 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:

◆ loadCampaignFile()

void Engines::Witcher::Campaign::loadCampaignFile ( const Common::UString campaign)
private

◆ loadModule()

void Engines::Witcher::Campaign::loadModule ( const Common::UString module)

Load a stand-alone module as a campaign.

Definition at line 127 of file campaign.cpp.

References changeCampaign(), isRunning(), and loadCampaign().

Referenced by Engines::Witcher::Console::cmdLoadModule().

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

◆ openMMD()

Common::SeekableReadStream * Engines::Witcher::Campaign::openMMD ( const Common::UString campaign)
staticprivate

Open the MMD campaign file for this campaign.

Definition at line 139 of file campaign.cpp.

References Common::UString::c_str(), ConfigMan, Common::UString::equalsIgnoreCase(), and Common::FilePath::getFile().

Referenced by getDescription(), getName(), and loadCampaignFile().

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

◆ processEventQueue()

void Engines::Witcher::Campaign::processEventQueue ( )

Process the current event queue.

Definition at line 261 of file campaign.cpp.

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

Here is the call graph for this function:

◆ refreshLocalized()

void Engines::Witcher::Campaign::refreshLocalized ( )

Refresh all localized strings.

Definition at line 319 of file campaign.cpp.

References _module.

◆ replaceCampaign()

void Engines::Witcher::Campaign::replaceCampaign ( )
private

Actually replace the currently running campaign.

Definition at line 308 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::Witcher::Campaign::setupStandaloneModule ( const Common::UString module)
private

Set up the loading of a singular, stand-alone module.

Definition at line 189 of file campaign.cpp.

References _modules, _startModule, Common::UString::c_str(), Common::UString::empty(), and Engines::Witcher::Module::findModule().

Referenced by loadCampaign().

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

◆ unload()

void Engines::Witcher::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 89 of file campaign.cpp.

References _description, _eventQueue, _exit, _hasCampaign, _module, _modules, _name, _newCampaign, _newCampaignStandalone, _running, _startModule, Aurora::LocString::clear(), Common::UString::clear(), 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::Witcher::Campaign::unloadPC ( )
private

Definition at line 111 of file campaign.cpp.

References _pc.

Referenced by unload(), and usePC().

Here is the caller graph for this function:

◆ usePC()

void Engines::Witcher::Campaign::usePC ( const Common::UString utc)

Use this character as the player character.

Definition at line 218 of file campaign.cpp.

References _pc, Common::StackException::add(), Common::UString::c_str(), Common::UString::empty(), and unloadPC().

Here is the call graph for this function:

Member Data Documentation

◆ _console

::Engines::Console* Engines::Witcher::Campaign::_console
private

Definition at line 112 of file campaign.h.

Referenced by Campaign(), and handleEvents().

◆ _description

Aurora::LocString Engines::Witcher::Campaign::_description
private

The description of the currently loaded campaign.

Definition at line 121 of file campaign.h.

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

◆ _eventQueue

EventQueue Engines::Witcher::Campaign::_eventQueue
private

Definition at line 139 of file campaign.h.

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

◆ _exit

bool Engines::Witcher::Campaign::_exit
private

Should we exit the campaign?

Definition at line 116 of file campaign.h.

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

◆ _hasCampaign

bool Engines::Witcher::Campaign::_hasCampaign
private

Do we have a campaign?

Definition at line 114 of file campaign.h.

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

◆ _module

Common::ScopedPtr<Module> Engines::Witcher::Campaign::_module
private

The current module of the current campaign.

Definition at line 129 of file campaign.h.

Referenced by Campaign(), enter(), getModule(), handleEvents(), isLoaded(), isRunning(), leave(), loadCampaign(), refreshLocalized(), and unload().

◆ _modules

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

All modules used by the current campaign.

Definition at line 124 of file campaign.h.

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

◆ _name

Aurora::LocString Engines::Witcher::Campaign::_name
private

The name of the currently loaded campaign.

Definition at line 119 of file campaign.h.

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

◆ _newCampaign

Common::UString Engines::Witcher::Campaign::_newCampaign
private

The campaign we should change to.

Definition at line 135 of file campaign.h.

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

◆ _newCampaignStandalone

bool Engines::Witcher::Campaign::_newCampaignStandalone
private

Is the campaign to change to a stand-alone module?

Definition at line 137 of file campaign.h.

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

◆ _pc

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

The player character we use.

Definition at line 132 of file campaign.h.

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

◆ _running

bool Engines::Witcher::Campaign::_running
private

Are we currently running a campaign?

Definition at line 115 of file campaign.h.

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

◆ _startModule

Common::UString Engines::Witcher::Campaign::_startModule
private

The module the current campaign starts in.

Definition at line 126 of file campaign.h.

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


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