Symphony Of Empires
World Class Reference

#include <world.hpp>

Collaboration diagram for World:

Public Member Functions

 World ()=default
 
Worldoperator= (const World &)=delete
 
 ~World ()=default
 
void do_tick ()
 
void init_lua ()
 
void load_initial ()
 
void load_mod ()
 
void fire_special_event (const std::string_view event_ref_name, const std::string_view nation_ref_name, const std::string_view other_nation_ref_name)
 
template<typename T >
void insert (T &ptr)
 
template<typename T >
void remove (T &ptr)
 
template<typename T >
T::Id get_id (const T &obj) const
 Get the id of an object, this is a template for all types except for tiles and locally-stored types (we can do this because we can obtain the list from the type) with get_list helper functions. Please do not store the value of this function on a local variable because said variable could potentially get invalidated! More...
 
float get_dist_from_equator (float y) const
 Get the dist from the equator in respect to Y. More...
 
Nation::Relationget_relation (NationId a, NationId b)
 
const Nation::Relationget_relation (NationId a, NationId b) const
 
int get_year (void) const
 
int get_month (void) const
 
int get_day (void) const
 

Static Public Member Functions

static Worldget_instance ()
 

Public Attributes

Eng3D::Profiler profiler
 
UnitManager unit_manager
 
ProvinceManager province_manager
 
Economy::EconomyState economy_state
 
std::vector< Nation::Relationrelations
 
Eng3D::LuaVM lua
 
std::unique_ptr< ProvinceId[]> tiles
 
size_t width
 
size_t height
 
int time
 
bool needs_to_sync = false
 Used to signal the lua scripts of invalid operations (eg. adding a country midgame) More...
 
std::mutex world_mutex
 
std::mutex list_mutex
 
std::mutex inbox_mutex
 
std::vector< std::pair< Decision, NationId > > taken_decisions
 

Static Public Attributes

constexpr static unsigned int ticks_per_month = 30
 

Detailed Description

Definition at line 114 of file world.hpp.

Constructor & Destructor Documentation

◆ World()

World::World ( )
default

◆ ~World()

World::~World ( )
default

Member Function Documentation

◆ do_tick()

void World::do_tick ( )

Definition at line 753 of file world.cpp.

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

◆ fire_special_event()

void World::fire_special_event ( const std::string_view  event_ref_name,
const std::string_view  nation_ref_name,
const std::string_view  other_nation_ref_name 
)

Definition at line 730 of file world.cpp.

Here is the call graph for this function:

◆ get_day()

int World::get_day ( void  ) const
inline

Definition at line 212 of file world.hpp.

Here is the caller graph for this function:

◆ get_dist_from_equator()

float World::get_dist_from_equator ( float  y) const
inline

Get the dist from the equator in respect to Y.

Parameters
yPosition to get distance from
Returns
float

Definition at line 186 of file world.hpp.

◆ get_id()

template<typename T >
T::Id World::get_id ( const T &  obj) const
inline

Get the id of an object, this is a template for all types except for tiles and locally-stored types (we can do this because we can obtain the list from the type) with get_list helper functions. Please do not store the value of this function on a local variable because said variable could potentially get invalidated!

Template Parameters
TType of object
Parameters
objReference to the object
Returns
TId Id of the object

Definition at line 179 of file world.hpp.

Here is the caller graph for this function:

◆ get_instance()

static World& World::get_instance ( )
inlinestatic

Definition at line 121 of file world.hpp.

Here is the caller graph for this function:

◆ get_month()

int World::get_month ( void  ) const
inline

Definition at line 208 of file world.hpp.

Here is the caller graph for this function:

◆ get_relation() [1/2]

Nation::Relation& World::get_relation ( NationId  a,
NationId  b 
)
inline

Definition at line 192 of file world.hpp.

Here is the caller graph for this function:

◆ get_relation() [2/2]

const Nation::Relation& World::get_relation ( NationId  a,
NationId  b 
) const
inline

Definition at line 198 of file world.hpp.

◆ get_year()

int World::get_year ( void  ) const
inline

Definition at line 204 of file world.hpp.

Here is the caller graph for this function:

◆ init_lua()

void World::init_lua ( )

Definition at line 79 of file world.cpp.

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

◆ insert()

template<typename T >
void World::insert ( T &  ptr)
inline

Definition at line 150 of file world.hpp.

Here is the caller graph for this function:

◆ load_initial()

void World::load_initial ( )

Definition at line 419 of file world.cpp.

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

◆ load_mod()

void World::load_mod ( )

Definition at line 590 of file world.cpp.

Here is the caller graph for this function:

◆ operator=()

World& World::operator= ( const World )
delete

◆ remove()

template<typename T >
void World::remove ( T &  ptr)
inline

Definition at line 160 of file world.hpp.

Member Data Documentation

◆ economy_state

Economy::EconomyState World::economy_state

Definition at line 147 of file world.hpp.

◆ height

size_t World::height

Definition at line 220 of file world.hpp.

◆ inbox_mutex

std::mutex World::inbox_mutex

Definition at line 227 of file world.hpp.

◆ list_mutex

std::mutex World::list_mutex

Definition at line 226 of file world.hpp.

◆ lua

Eng3D::LuaVM World::lua

Definition at line 216 of file world.hpp.

◆ needs_to_sync

bool World::needs_to_sync = false

Used to signal the lua scripts of invalid operations (eg. adding a country midgame)

Definition at line 224 of file world.hpp.

◆ profiler

Eng3D::Profiler World::profiler

Definition at line 130 of file world.hpp.

◆ province_manager

ProvinceManager World::province_manager

Definition at line 146 of file world.hpp.

◆ relations

std::vector<Nation::Relation> World::relations

Definition at line 190 of file world.hpp.

◆ taken_decisions

std::vector<std::pair<Decision, NationId> > World::taken_decisions

Definition at line 228 of file world.hpp.

◆ ticks_per_month

constexpr static unsigned int World::ticks_per_month = 30
staticconstexpr

Definition at line 116 of file world.hpp.

◆ tiles

std::unique_ptr<ProvinceId[]> World::tiles

Definition at line 219 of file world.hpp.

◆ time

int World::time

Definition at line 221 of file world.hpp.

◆ unit_manager

UnitManager World::unit_manager

Definition at line 145 of file world.hpp.

◆ width

size_t World::width

Definition at line 220 of file world.hpp.

◆ world_mutex

std::mutex World::world_mutex

Definition at line 225 of file world.hpp.


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