WorldSim  inDev
2D tile-based sandbox RPG with procedurally generated fantasy world simulator 🌏
World_Biome.hpp
Go to the documentation of this file.
1 #pragma once
2 #ifndef WORLDSIM_WORLD_BIOME_HPP
3 #define WORLDSIM_WORLD_BIOME_HPP
4 
5 /* WorldSim: World_Biome.hpp
6 #include "World_Biome.hpp" */
7 
36 #include "Static_FloraManager.hpp"
37 #include "Creature_Manager.hpp"
38 
39 class World_Local;
40 class Creature;
41 
42 #include <Game/WorldGenerator/WorldGenerator2.hpp>
43 #include <Container/Table/TableInterface.hpp>
44 #include <System/Sleep/Sleep.hpp>
45 
46 class World_Biome: public TableInterface
47 {
48  RandomLehmer rng;
49  FloraManager floraManager;
50  Creature_Manager creatureManager;
51 
52  public:
53 
54  bool isGenerated; // true if all tiles have been generated.
55  bool threadAccess; // true if a thread is using this biome
56 
57  bool isFloraGenerated; // flag so we only generate flora once for this biome.
58 
59  int id; // the biome's id. Used to lookup biome tables. The id is equal to it's position in the biome vector.
60 
61  std::string name;
62  unsigned int size; /* size in tiles */
63  unsigned char type; /* Biome type */
64 
65  Vector <HasXY> vXY; // every tile coordinate of this biome.
66  Vector <World_Local*> vMap; // pointer to every map on this biome
67 
68  // placeholders for objects
69 
70  Vector <Flora*> vFlora; // Vector of Flora types
71  //Vector <std::string> vHerbivore;
72  //Vector <std::string> vCarnivore;
73 
74  Vector <Creature*> vCreature;
75 
76  double averageX, averageY; /* For zooming to biome. */
77  int centerX, centerY; /* The closest tile to the average which is owned by the biome */
78 
79 
80  World_Biome();
81  virtual ~World_Biome();
82 
83  // generate entire biome including terrain, flora, etc.
84  void generate(const unsigned short int sleepTime=0);
85 
86  // generate all local maps for this biome
87  // map generation will be done per-biome rather than per tile
88  void generateLocals(const unsigned short int sleepTime=0);
89 
90  void generateFlora();
91 
92  void generateCreatures();
93 
94  // pick a flora type from the weighted list to spawn
95  Flora* getFlora();
96  // pick a creature type from the weighted list to spawn
98 
99  // return all flora types on this biome
100  Vector <Flora*> * getAllFloraTypes();
101  // return all Creature types on this biome
102  Vector <Creature_Species*> * getAllCreatureTypes();
103 
104  void getAverageCoordinates(/*Vector <HasXY*> * vXY*/);
105 
106  void addMap(World_Local * map);
107 
108 
109  // TableInterface
110  std::string getColumn(std::string _column);
111  // TableInterface
112  std::string getColumnType(std::string _column);
113 };
114 
115 #endif
Definition: Creature.hpp:34
unsigned int size
Definition: World_Biome.hpp:62
void getAverageCoordinates()
Definition: World_Biome.cpp:348
void addMap(World_Local *map)
Definition: World_Biome.cpp:379
std::string getColumn(std::string _column)
Definition: World_Biome.cpp:387
int centerX
Definition: World_Biome.hpp:77
unsigned char type
Definition: World_Biome.hpp:63
Vector< Creature_Species * > * getAllCreatureTypes()
Definition: World_Biome.cpp:342
World_Biome()
Definition: World_Biome.cpp:23
void generateCreatures()
Definition: World_Biome.cpp:234
Vector< Creature * > vCreature
Definition: World_Biome.hpp:74
Definition: World_Biome.hpp:46
std::string getColumnType(std::string _column)
Definition: World_Biome.cpp:404
Flora * getFlora()
Definition: World_Biome.cpp:291
Vector< Flora * > vFlora
Definition: World_Biome.hpp:70
Definition: World_Local.hpp:58
Creature * getCreature()
Definition: World_Biome.cpp:323
double averageY
Definition: World_Biome.hpp:76
void generate(const unsigned short int sleepTime=0)
Definition: World_Biome.cpp:48
Vector< HasXY > vXY
Definition: World_Biome.hpp:65
void generateFlora()
Definition: World_Biome.cpp:146
Definition: Static_Flora.hpp:201
double averageX
Definition: World_Biome.hpp:76
Definition: Static_FloraManager.hpp:16
bool threadAccess
Definition: World_Biome.hpp:55
std::string name
Definition: World_Biome.hpp:61
int centerY
Definition: World_Biome.hpp:77
bool isGenerated
Definition: World_Biome.hpp:54
Vector< World_Local * > vMap
Definition: World_Biome.hpp:66
int id
Definition: World_Biome.hpp:59
Definition: Creature_Manager.hpp:13
void generateLocals(const unsigned short int sleepTime=0)
Definition: World_Biome.cpp:62
virtual ~World_Biome()
Definition: World_Biome.cpp:42
Vector< Flora * > * getAllFloraTypes()
Definition: World_Biome.cpp:337
bool isFloraGenerated
Definition: World_Biome.hpp:57