Simulator::cMissionManager class

This class manages all the missions of a player in space stage.

Each instance is unique for each saved game (i.e. different saved games use different instances of this class). The following fields are saved:

  • mbFirstCommunication
  • mbFlightSchoolFinished
  • mbMission201Finished
  • mTutorialTargetPlanetKeys
  • mTutorialSpeciesIDs
  • mTrackedMissions
  • mRecentNPCMissions
  • mRecentColonyMissions
  • mTutorialMissionStates

Base classes

class cGonzagoSimulator
class App::IMessageListener
An interface that can receive messages sent through the app.

Public static functions

static auto Get() -> cMissionManager*

Public functions

auto CreateMission(uint32_t missionID, cPlanetRecord* pSourcePlanetRecord, cEmpire* pOwnerEmpire, cMission* pParentMission = nullptr) -> cMission*
Creates a new mission object; the object will be a subclass of cMission, depending on the missionType parameter of that mission configuration property list.
auto ChooseMission(cEmpire* pEmpire, cPlanetRecord* pPlanetRecord) -> cMission*
This function decides what mission needs to be done for the given empire.
auto HasMissionsAvailable(cEmpire* pEmpire, cPlanetRecord* pPlanetRecord) -> bool
Decdies whether new missions can be offered by the given empire at the given planet.
auto GetMissionByID(uint32_t missionID) -> cMission*
Returns the first existing mission object that has the given mission ID, or null if it does not exist.
auto GetMissionTrackColor(cMission* pMission, Color& dst) -> bool
Get the color used to track a certain mission.
auto ThereIsEventInPlanet(cPlanetRecord* pPlanetRecord) -> bool
Returns true if there is an ongoing event in the given planet.

Public variables

bool mbDebugDrawMissionLines
bool field_15
bool mbFirstCommunication
bool mbFlightSchoolFinished
bool mbMission201Finished
uint32_t mNextMissionType
eastl::vector<UnkMissionManagerStruct> field_20
eastl::vector<UnkMissionManagerStruct> field_34
eastl::vector<UnkMissionManagerStruct> field_48
eastl::map<uint32_t, MissionState> mTutorialMissionStates
PropertyListPtr mpGeneratorConfigPropList
PropertyListPtr mpConfigPropList
eastl::vector<uint32_t> mTutorialTargetPlanetKeys
eastl::vector<uint32_t> mTutorialSpeciesIDs
eastl::vector<cMissionPtr> mTrackedMissions
int field_BC
cMissionPtr field_C0
cMissionPtr field_C4
eastl::list<MissionManagerTimerEntry> mRecentNPCMissions
eastl::list<MissionManagerTimerEntry> mRecentColonyMissions
int mMaxNumMissions
int mGapBetweenNPCMissions
In milliseconds.
int mGapBetweenColonyMissions
In milliseconds.
int mMinEmpireSizeForArchetypeMissions
ResourceKey mDefaultMissionIcon
ResourceKey mDefaultDisasterIcon
eastl::vector<uint32_t> mTeachingInteractMissions
eastl::vector<uint32_t> mTeachingExpandMissions
eastl::vector<uint32_t> mTeachingExploreMissions

Function documentation

cMission* Simulator::cMissionManager::CreateMission(uint32_t missionID, cPlanetRecord* pSourcePlanetRecord, cEmpire* pOwnerEmpire, cMission* pParentMission = nullptr)

Creates a new mission object; the object will be a subclass of cMission, depending on the missionType parameter of that mission configuration property list.

Parameters
missionID ID of the mission to create, it must be the same ID as the mission configuration property list.
pSourcePlanetRecord Planet where the mission is generated.
pOwnerEmpire Empire that is assigning the mission.
pParentMission Parent mission, this is generally null unless you want the new mission to be part of a larger, multi-step mission.
Returns The created cMission subclass object, or nullptr.

This method assigns the source planet, empire and planet mission to the generated mission object, and calls the Initialize() method.

cMission* Simulator::cMissionManager::ChooseMission(cEmpire* pEmpire, cPlanetRecord* pPlanetRecord)

This function decides what mission needs to be done for the given empire.

Parameters
pEmpire The empire that is offering the mission.
pPlanetRecord The planet where the mission is being offered from.
Returns The offered mission object, or nullptr.

To be precise, if you communicate with empire pEmpire on planet pPlanetRecord and ask for missions, this function is called and must return the mission to be done, or nullptr if no mission is offered. By default, this function returns null if HasMissionsAvailable() returns false.

bool Simulator::cMissionManager::HasMissionsAvailable(cEmpire* pEmpire, cPlanetRecord* pPlanetRecord)

Decdies whether new missions can be offered by the given empire at the given planet.

Parameters
pEmpire
pPlanetRecord
Returns True if a new mission can be offered, false otherwise.

It returns false if:

  • You already have mMaxNumMissions active (event missions, such as pirate raids, do not count).
  • Another mission was requested recently on that planet (using fields mRecentNPCMissions and mRecentColonyMissions).
  • Based on the relationship you have with the empire on that planet.

cMission* Simulator::cMissionManager::GetMissionByID(uint32_t missionID)

Returns the first existing mission object that has the given mission ID, or null if it does not exist.

Parameters
missionID

This can only looks for mission objects that have already been instantiated; to create a mission, use CreateMission().

bool Simulator::cMissionManager::GetMissionTrackColor(cMission* pMission, Color& dst)

Get the color used to track a certain mission.

Returns True if a color was written to dst.

The mission must be currently tracked. The color will be stored in dst parameter.

bool Simulator::cMissionManager::ThereIsEventInPlanet(cPlanetRecord* pPlanetRecord)

Returns true if there is an ongoing event in the given planet.

Parameters
pPlanetRecord