WorldSim  inDev
2D tile-based sandbox RPG with procedurally generated fantasy world simulator 🌏
Public Member Functions | Public Attributes | List of all members
World Class Reference

#include <World.hpp>

Inheritance diagram for World:
Inheritance graph
[legend]
Collaboration diagram for World:
Collaboration graph
[legend]

Public Member Functions

 World ()
 
 ~World ()
 
World_Localoperator() (const int _x, const int _y)
 
LocalTileoperator() (unsigned long int _x, unsigned long int _y, const bool subterranean=false)
 
LocalTileoperator() (HasXY2< unsigned long int > *, const bool subterranean=false)
 
bool absoluteToRelative (const unsigned long int _absoluteX, const unsigned long int _absoluteY, int *_globalX, int *_globalY, int *_localX, int *_localY)
 
bool isGenerated (unsigned long int _absoluteX, unsigned long int _absoluteY)
 
void startSimulation ()
 
void incrementTicks (int)
 
void incrementTicksBacklog (long long unsigned int)
 
bool handleTickBacklog ()
 
void idleTick ()
 
void logicTick ()
 
void updateMaps ()
 
bool loadWorld (std::string)
 
void generateWorld (const std::string, const int, const int, int, int, const bool, const bool, const bool, const double)
 
void generateLocal (const int, const int)
 
void generateLocal (HasXY *)
 
void unloadLocal (const int, const int)
 
bool prepareAdventureMode (Character *)
 
void buildArrays (WorldGenerator2 &wg)
 
void nameRegions ()
 
void generateTribes (int, int, int)
 
bool addRace (int, std::string)
 
void controlCharacter (Character *)
 
CharactergetRandomCharacter ()
 
Vector< HasXY2< unsigned long int > * > * rayTraceLOS (unsigned long int _x, unsigned long int _y, const int RANGE, const bool, const bool subterranean=false)
 
void rayTrace (unsigned long int _x1, unsigned long int _y1, unsigned long int _x2, unsigned long int _y2, Vector< HasXY2< unsigned long int > *> *vVisibleTiles, bool subterranean=false)
 
int getPopulation ()
 
bool isLand (int _x, int _y)
 
bool isLand (HasXY *)
 
bool isSafe (int _x, int _y)
 
bool isSafe (unsigned long int _x, unsigned long int _y)
 
World_LocalgetTile (const int, const int)
 
int getTileFertility (const int, const int)
 
int getTileFertility (const HasXY *)
 
int getSurroundingFertility (const int _x, const int _y)
 
int getHuntingYield (const int _x, const int _y)
 
void getRandomTile (int *x, int *y)
 
bool getRandomLandTile (int *x, int *y)
 
HasXY * getRandomLandTile ()
 
HasXY * getRandomTileOfType (enumBiome _type)
 
Vector< WorldObjectGlobal * > * getNeighboringObjects (WorldObjectGlobal *)
 
bool putObject (WorldObjectGlobal *_object, int x=-1, int y=-1)
 
bool removeObject (WorldObjectGlobal *_object)
 
std::string getLandmassName (const int, const int)
 
std::string getLandmassName (HasXY *)
 
World_BiomegetBiome (const int id)
 
std::string getBiomeName (const int, const int)
 
std::string getTileType (const int _x, const int _y)
 
void queryTile (int hoveredXTile, int hoveredYTile)
 
void queryTileLocal (int hoveredXTile, int hoveredYTile)
 
void addInfluence (Tribe *tribe, int amount)
 
void degradeInfluence (int amount=1)
 
void destroyInfluence (Tribe *tribe)
 
TribegetDominantInfluence (const int, const int)
 
TribegetDominantInfluence (HasXY *)
 
Vector< Tribe * > * getTribesOn (const int, const int)
 
TribecombatCheck (Tribe *)
 
bool hasFreeTerritory (int landmassID)
 
int nFreeTerritory (int landmassID)
 
void evolveToCiv (Tribe *)
 
TribegetNearestConnectedTribe (Tribe *, bool sameRace=true)
 
int getHighestInfluence (const int, const int)
 
int getHighestInfluence (HasXY *)
 
void buildMinimap ()
 
virtual void save ()
 

Public Attributes

bool active
 
bool generated
 
int nX
 
int nY
 
unsigned long int maximumX
 
unsigned long int maximumY
 
int simX
 
int simY
 
int queryWorldX
 
int queryWorldY
 
int queryWorldXLocal
 
int queryWorldYLocal
 
long long unsigned int ticksBacklog
 
bool incrementContinuous
 
Timer relinquishTimer
 
std::string name
 
std::string strSavePath
 
std::string worldFilePath
 
World_Astronomy astronomy
 
int landmassSeed
 
int dailyCounter
 
int monthlyCounter
 
ArrayS3< unsigned char > aTopoMap
 
ArrayS2< WorldObject * > aWorldObject
 
Vector< WorldObjectGlobal * > vWorldObjectGlobal
 
ArrayS2< World_LocalaWorldTile
 
Vector< World_Local * > vWorldLocal
 
ArrayS2< int > aBiomeID
 
ArrayS2< int > aRiverID
 
Vector< World_Landmass * > vLandmass
 
Vector< World_Biome * > vBiome
 
Vector< Vector< int > *> vAllTiles
 
Vector< HasXY * > vAllTiles2
 
unsigned char seaLevel
 
unsigned char mountainLevel
 
Vector< Tribe * > vTribe
 
Vector< Civ * > vCiv
 
ArrayS2< unsigned char > aGoodEvil
 
Calendar calendar
 
Calendar lastDate
 
bool isRaining
 

Constructor & Destructor Documentation

◆ World()

World::World ( )

◆ ~World()

World::~World ( )

Member Function Documentation

◆ absoluteToRelative()

bool World::absoluteToRelative ( const unsigned long int  _absoluteX,
const unsigned long int  _absoluteY,
int *  _globalX,
int *  _globalY,
int *  _localX,
int *  _localY 
)

◆ addInfluence()

void World::addInfluence ( Tribe tribe,
int  amount 
)

◆ addRace()

bool World::addRace ( int  ,
std::string   
)

◆ buildArrays()

void World::buildArrays ( WorldGenerator2 &  wg)

◆ buildMinimap()

void World::buildMinimap ( )

This function builds a minimap texture which is later rendered in the world simulator.

◆ combatCheck()

Tribe * World::combatCheck ( Tribe _tribe)

◆ controlCharacter()

void World::controlCharacter ( Character _character)

◆ degradeInfluence()

void World::degradeInfluence ( int  amount = 1)

◆ destroyInfluence()

void World::destroyInfluence ( Tribe tribe)

◆ evolveToCiv()

void World::evolveToCiv ( Tribe _tribe)

◆ generateLocal() [1/2]

void World::generateLocal ( const int  _localX,
const int  _localY 
)

◆ generateLocal() [2/2]

void World::generateLocal ( HasXY *  _xy)

◆ generateTribes()

void World::generateTribes ( int  nTribesHuman = DEFAULT_NUMBER_TRIBES_HUMAN,
int  nTribesDwarven = DEFAULT_NUMBER_TRIBES_DWARVEN,
int  nTribesElven = DEFAULT_NUMBER_TRIBES_ELVEN 
)

◆ generateWorld()

void World::generateWorld ( const std::string  _worldName,
const int  x = 127,
const int  y = 127,
int  seed = 0,
int  fragmentation = 2,
const bool  islandMode = true,
const bool  wrapX = true,
const bool  wrapY = false,
const double  landPercent = 0.66 
)

◆ getBiome()

World_Biome * World::getBiome ( const int  id)

◆ getBiomeName()

std::string World::getBiomeName ( const int  _x,
const int  _y 
)

◆ getDominantInfluence() [1/2]

Tribe * World::getDominantInfluence ( const int  _x,
const int  _y 
)

◆ getDominantInfluence() [2/2]

Tribe * World::getDominantInfluence ( HasXY *  _xy)

◆ getHighestInfluence() [1/2]

int World::getHighestInfluence ( const int  _x,
const int  _y 
)

◆ getHighestInfluence() [2/2]

int World::getHighestInfluence ( HasXY *  _xy)

◆ getHuntingYield()

int World::getHuntingYield ( const int  _x,
const int  _y 
)

◆ getLandmassName() [1/2]

std::string World::getLandmassName ( const int  _x,
const int  _y 
)

◆ getLandmassName() [2/2]

std::string World::getLandmassName ( HasXY *  _xy)

◆ getNearestConnectedTribe()

Tribe * World::getNearestConnectedTribe ( Tribe _tribe,
bool  sameRace = true 
)

◆ getNeighboringObjects()

Vector< WorldObjectGlobal * > * World::getNeighboringObjects ( WorldObjectGlobal _obj)

◆ getPopulation()

int World::getPopulation ( )

◆ getRandomCharacter()

Character * World::getRandomCharacter ( )

◆ getRandomLandTile() [1/2]

bool World::getRandomLandTile ( int *  x,
int *  y 
)

◆ getRandomLandTile() [2/2]

HasXY * World::getRandomLandTile ( )

◆ getRandomTile()

void World::getRandomTile ( int *  x,
int *  y 
)

◆ getRandomTileOfType()

HasXY * World::getRandomTileOfType ( enumBiome  _type)

◆ getSurroundingFertility()

int World::getSurroundingFertility ( const int  _x,
const int  _y 
)

◆ getTile()

World_Local * World::getTile ( const int  x,
const int  y 
)

◆ getTileFertility() [1/2]

int World::getTileFertility ( const int  _x,
const int  _y 
)

◆ getTileFertility() [2/2]

int World::getTileFertility ( const HasXY *  xy)
inline

◆ getTileType()

std::string World::getTileType ( const int  _x,
const int  _y 
)

◆ getTribesOn()

Vector< Tribe * > * World::getTribesOn ( const int  _x,
const int  _y 
)

◆ handleTickBacklog()

bool World::handleTickBacklog ( )

◆ hasFreeTerritory()

bool World::hasFreeTerritory ( int  landmassID)

◆ idleTick()

void World::idleTick ( )

◆ incrementTicks()

void World::incrementTicks ( int  nTicks)

◆ incrementTicksBacklog()

void World::incrementTicksBacklog ( long long unsigned int  nTicks)

◆ isGenerated()

bool World::isGenerated ( unsigned long int  _absoluteX,
unsigned long int  _absoluteY 
)

◆ isLand() [1/2]

bool World::isLand ( int  _x,
int  _y 
)

◆ isLand() [2/2]

bool World::isLand ( HasXY *  _xy)
inline

◆ isSafe() [1/2]

bool World::isSafe ( int  _x,
int  _y 
)

◆ isSafe() [2/2]

bool World::isSafe ( unsigned long int  _x,
unsigned long int  _y 
)

◆ loadWorld()

bool World::loadWorld ( std::string  _name)

◆ logicTick()

void World::logicTick ( )

◆ nameRegions()

void World::nameRegions ( )

◆ nFreeTerritory()

int World::nFreeTerritory ( int  landmassID)

◆ operator()() [1/3]

World_Local * World::operator() ( const int  _x,
const int  _y 
)
inline

◆ operator()() [2/3]

LocalTile * World::operator() ( unsigned long int  _x,
unsigned long int  _y,
const bool  subterranean = false 
)
inline

◆ operator()() [3/3]

LocalTile * World::operator() ( HasXY2< unsigned long int > *  _xy,
const bool  subterranean = false 
)
inline

◆ prepareAdventureMode()

bool World::prepareAdventureMode ( Character _character)

◆ putObject()

bool World::putObject ( WorldObjectGlobal _object,
int  x = -1,
int  y = -1 
)

◆ queryTile()

void World::queryTile ( int  hoveredXTile,
int  hoveredYTile 
)

◆ queryTileLocal()

void World::queryTileLocal ( int  hoveredXTile,
int  hoveredYTile 
)

◆ rayTrace()

void World::rayTrace ( unsigned long int  _x1,
unsigned long int  _y1,
unsigned long int  _x2,
unsigned long int  _y2,
Vector< HasXY2< unsigned long int > *> *  vVisibleTiles,
bool  subterranean = false 
)

◆ rayTraceLOS()

Vector< HasXY2< unsigned long int > * > * World::rayTraceLOS ( unsigned long int  _x,
unsigned long int  _y,
const int  RANGE,
const bool  isSneaking = false,
const bool  subterranean = false 
)

◆ removeObject()

bool World::removeObject ( WorldObjectGlobal _object)

◆ save()

void World::save ( )
virtual

◆ startSimulation()

void World::startSimulation ( )

◆ unloadLocal()

void World::unloadLocal ( const int  _localX,
const int  _localY 
)

◆ updateMaps()

void World::updateMaps ( )

Member Data Documentation

◆ aBiomeID

ArrayS2<int> World::aBiomeID

◆ active

bool World::active

◆ aGoodEvil

ArrayS2<unsigned char> World::aGoodEvil

◆ aRiverID

ArrayS2<int> World::aRiverID

◆ astronomy

World_Astronomy World::astronomy

◆ aTopoMap

ArrayS3<unsigned char> World::aTopoMap

◆ aWorldObject

ArrayS2<WorldObject*> World::aWorldObject

◆ aWorldTile

ArrayS2<World_Local> World::aWorldTile

◆ calendar

Calendar World::calendar

◆ dailyCounter

int World::dailyCounter

◆ generated

bool World::generated

◆ incrementContinuous

bool World::incrementContinuous

◆ isRaining

bool World::isRaining

◆ landmassSeed

int World::landmassSeed

◆ lastDate

Calendar World::lastDate

◆ maximumX

unsigned long int World::maximumX

◆ maximumY

unsigned long int World::maximumY

◆ monthlyCounter

int World::monthlyCounter

◆ mountainLevel

unsigned char World::mountainLevel

◆ name

std::string World::name

◆ nX

int World::nX

◆ nY

int World::nY

◆ queryWorldX

int World::queryWorldX

◆ queryWorldXLocal

int World::queryWorldXLocal

◆ queryWorldY

int World::queryWorldY

◆ queryWorldYLocal

int World::queryWorldYLocal

◆ relinquishTimer

Timer World::relinquishTimer

◆ seaLevel

unsigned char World::seaLevel

◆ simX

int World::simX

◆ simY

int World::simY

◆ strSavePath

std::string World::strSavePath

◆ ticksBacklog

long long unsigned int World::ticksBacklog

◆ vAllTiles

Vector< Vector <int> * > World::vAllTiles

◆ vAllTiles2

Vector<HasXY*> World::vAllTiles2

◆ vBiome

Vector<World_Biome*> World::vBiome

◆ vCiv

Vector<Civ*> World::vCiv

◆ vLandmass

Vector<World_Landmass*> World::vLandmass

◆ vTribe

Vector<Tribe*> World::vTribe

◆ vWorldLocal

Vector<World_Local*> World::vWorldLocal

◆ vWorldObjectGlobal

Vector<WorldObjectGlobal*> World::vWorldObjectGlobal

◆ worldFilePath

std::string World::worldFilePath

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