Simulator::cRelationshipManager class

Handles relationships between political entities.

A political entity is a tribe, civilization, empire, etc. Relationships are always between two different political enties (such as two empires). They are composed of a series of events (declared war, gave gift, etc) and a global score (negative means you hate each other, positive you like each other).

Base classes

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

Public static variables

static const uint32_t TYPE

Public static functions

static auto Get() -> cRelationshipManager*
Gets the active relationship manager, which depends on the current game stage.

Public functions

auto IsAtWar(cEmpire* pEmpire1, cEmpire* pEmpire2) -> bool
Returns true if the two empires are currently at war, or false otherwise.
auto IsAtWar(uint32_t politicalID1, uint32_t politicalID2) -> bool
Returns true if the two political entities are currently at war, or false otherwise.
auto IsAllied(cEmpire* pEmpire1, cEmpire* pEmpire2) -> bool
Returns true if there is an alliance between the two empires, or false otherwise.
auto IsAllied(uint32_t politicalID1, uint32_t politicalID2) -> bool
Returns true if there is an alliance between the two political entities, or false otherwise.
auto DeclareWar(cEmpire* pEmpire1, cEmpire* pEmpire2) -> void
Declares war between the two empires, applying a bad relationship between them.
auto DeclarePeace(cEmpire* pEmpire1, cEmpire* pEmpire2) -> void
Declares peace between two empires.
auto DeclareAlliance(cEmpire* pEmpire1, cEmpire* pEmpire2) -> void
Declares an alliance between two empires.
auto BreakAlliance(cEmpire* pEmpire1, cEmpire* pEmpire2) -> void
Breaks the alliance between two empires, if it exists.
auto ResetRelationship(uint32_t politicalID1, uint32_t politicalID2) -> void
Resets the relationship between two political entities, setting their global relationship to 0 and removing all events between them.
auto ApplyRelationship(uint32_t politicalID, uint32_t causePoliticalID, uint32_t relationshipID, float scale = 1.0f) -> float
Applies a relationship event between two political entities (tribes, civilizations, empires,...).
auto RelationshipExists(uint32_t politicalID1, uint32_t politicalID2) -> bool
Returns true if there is a relationship between the two political entities.
auto GetRelationshipEventValue(uint32_t politicalID1, uint32_t politicalID2, uint32_t relationshipID) -> float
Returns the value of a relationship event between two political entities, or 0 if no such relation exists.

Public variables

float field_10
float field_14
float field_18
float field_1C
bool mbIsInitialized
eastl::map<eastl::pair<uint32_t, uint32_t>, cRelationshipData> mRelationships
int field_40
int field_44
eastl::vector<int> field_48
int field_5C
eastl::vector<uint32_t> mEmpiresToDecayPending
int field_74
int field_78
int field_7C
int field_80
int field_84
App::MessageListenerData mMessageData
eastl::vector<int> field_9C
int field_B0
eastl::vector<int> field_B4
int field_C8
eastl::vector<int> field_CC
int field_E0
eastl::map<int, int> field_E4

Function documentation

bool Simulator::cRelationshipManager::IsAtWar(cEmpire* pEmpire1, cEmpire* pEmpire2)

Returns true if the two empires are currently at war, or false otherwise.

Parameters
pEmpire1
pEmpire2

The order of the parameters is irrelevant.

bool Simulator::cRelationshipManager::IsAtWar(uint32_t politicalID1, uint32_t politicalID2)

Returns true if the two political entities are currently at war, or false otherwise.

Parameters
politicalID1
politicalID2

The order of the parameters is irrelevant.

bool Simulator::cRelationshipManager::IsAllied(cEmpire* pEmpire1, cEmpire* pEmpire2)

Returns true if there is an alliance between the two empires, or false otherwise.

Parameters
pEmpire1
pEmpire2

The order of the parameters is irrelevant.

bool Simulator::cRelationshipManager::IsAllied(uint32_t politicalID1, uint32_t politicalID2)

Returns true if there is an alliance between the two political entities, or false otherwise.

Parameters
politicalID1
politicalID2

The order of the parameters is irrelevant.

void Simulator::cRelationshipManager::DeclareWar(cEmpire* pEmpire1, cEmpire* pEmpire2)

Declares war between the two empires, applying a bad relationship between them.

Parameters
pEmpire1
pEmpire2

void Simulator::cRelationshipManager::DeclarePeace(cEmpire* pEmpire1, cEmpire* pEmpire2)

Declares peace between two empires.

Parameters
pEmpire1
pEmpire2

This does not change the relationship events or score.

void Simulator::cRelationshipManager::DeclareAlliance(cEmpire* pEmpire1, cEmpire* pEmpire2)

Declares an alliance between two empires.

If one of the empires is the player, it sends a SimulatorMessages::kMsgPlayerEmpireAllied message.

void Simulator::cRelationshipManager::BreakAlliance(cEmpire* pEmpire1, cEmpire* pEmpire2)

Breaks the alliance between two empires, if it exists.

If one of the empires is the player, it sends a SimulatorMessages::kMsgPlayerEmpireLostAlliance message.

void Simulator::cRelationshipManager::ResetRelationship(uint32_t politicalID1, uint32_t politicalID2)

Resets the relationship between two political entities, setting their global relationship to 0 and removing all events between them.

Parameters
politicalID1
politicalID2

float Simulator::cRelationshipManager::ApplyRelationship(uint32_t politicalID, uint32_t causePoliticalID, uint32_t relationshipID, float scale = 1.0f)

Applies a relationship event between two political entities (tribes, civilizations, empires,...).

Parameters
politicalID ID of the political entity
causePoliticalID ID of the other political entity, that caused the relation change
relationshipID ID of the relationship properties, like those in RelationshipEvents
scale Optional, a multiplier over the effect the relationship has.
Returns The current state of the relationship

The relationship ID is a property ID; the list of base relationships is found in the RelationshipEvents enum, but more can be added. The relations aren't necessarily symmetric, so there's one of the two political entities that is considered the causant of the relation change (for example, the empire that declared war is responsible for the bad relation).

bool Simulator::cRelationshipManager::RelationshipExists(uint32_t politicalID1, uint32_t politicalID2)

Returns true if there is a relationship between the two political entities.

Parameters
politicalID1
politicalID2

float Simulator::cRelationshipManager::GetRelationshipEventValue(uint32_t politicalID1, uint32_t politicalID2, uint32_t relationshipID)

Returns the value of a relationship event between two political entities, or 0 if no such relation exists.

Parameters
politicalID1
politicalID2
relationshipID