diff options
author | Andy Belle-Isle <drumsetmonkey@gmail.com> | 2019-09-12 18:16:06 -0400 |
---|---|---|
committer | Andy Belle-Isle <drumsetmonkey@gmail.com> | 2019-09-12 18:16:06 -0400 |
commit | 2564533a4860a8452abc27ba05115ca11ed4a787 (patch) | |
tree | 67c5dfb2e892f0d492d977b8a5fa42321f2fa4a5 /src/world.hpp | |
parent | 8f0db67c5fdbc1e7b8759f44b45ad64caf336cb5 (diff) |
Ability to pass world data into Lua
Diffstat (limited to 'src/world.hpp')
-rw-r--r-- | src/world.hpp | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/src/world.hpp b/src/world.hpp index 4ceca94..c0e6098 100644 --- a/src/world.hpp +++ b/src/world.hpp @@ -37,11 +37,39 @@ struct WorldMaterial class World { private: + unsigned int seed; + unsigned int layers; + + std::vector<std::vector<std::vector<unsigned int>>> data; std::vector<unsigned int> registry; - std::vector<std::vector<unsigned int>> worldData; public: + World() {} World(sol::object ref); - ~World() {} + ~World() { + generate = sol::nil; + registry.clear(); + data.clear(); + } + + sol::function generate; + + /* SEED */ + unsigned int getSeed() {return seed;} + void setSeed(unsigned int s) {seed = s;} + + /* LAYERS */ + unsigned int getLayers() {return layers;} + // If we change the amount of layers, we have to regenerate the world + void setLayers(unsigned int l) { + layers = l; + generate(); + } + + /* DATA */ + void setData(unsigned int x, + unsigned int y, + unsigned int z, + unsigned int d); }; /** @@ -57,9 +85,16 @@ public: WorldSystem(void): currentWorld(nullptr) {} - ~WorldSystem(void) {} + ~WorldSystem(void) { + currentWorld = nullptr; + worlds.clear(); + } World* addWorld(sol::object); + void cleanup() + { + worlds.clear(); + } /** * Prepares the system for running. |