diff --git a/src/voxels/WorldGenerator.h b/src/voxels/WorldGenerator.h index 5e14bb4c..7972ed46 100644 --- a/src/voxels/WorldGenerator.h +++ b/src/voxels/WorldGenerator.h @@ -7,7 +7,6 @@ struct voxel; class Content; class WorldGenerator { -protected: blockid_t const idStone; blockid_t const idDirt; blockid_t const idGrassBlock; @@ -20,7 +19,7 @@ protected: blockid_t const idBazalt; public: WorldGenerator(const Content* content); - virtual void generate(voxel* voxels, int x, int z, int seed); + void generate(voxel* voxels, int x, int z, int seed); }; -#endif /* VOXELS_WORLDGENERATOR_H_ */ \ No newline at end of file +#endif /* VOXELS_WORLDGENERATOR_H_ */ diff --git a/src/window/Window.cpp b/src/window/Window.cpp index e05b6b3b..d18462b7 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -318,6 +318,10 @@ const char* Window::getClipboardText() { return glfwGetClipboardString(window); } +void Window::setClipboardText(const char* text) { + glfwSetClipboardString(window, text); +} + bool Window::tryToMaximize(GLFWwindow* window, GLFWmonitor* monitor) { glm::ivec4 windowFrame(0); glm::ivec4 workArea(0); diff --git a/src/window/Window.h b/src/window/Window.h index 9712c588..ab3cb096 100644 --- a/src/window/Window.h +++ b/src/window/Window.h @@ -55,6 +55,7 @@ public: static void setBgColor(glm::vec4 color); static double time(); static const char* getClipboardText(); + static void setClipboardText(const char* text); static DisplaySettings* getSettings(); static void setBlendMode(blendmode mode); diff --git a/src/world/World.cpp b/src/world/World.cpp index 85934bee..d442cbd1 100644 --- a/src/world/World.cpp +++ b/src/world/World.cpp @@ -6,7 +6,6 @@ #include "Level.h" #include "../files/WorldFiles.h" -#include "../world/WorldTypes.h" #include "../content/Content.h" #include "../content/ContentLUT.h" #include "../voxels/Chunk.h" @@ -35,23 +34,6 @@ World::World( wfile = new WorldFiles(directory, settings.debug); } -World::World( - std::string name, - std::string type, - fs::path directory, - uint64_t seed, - EngineSettings& settings, - const Content* content, - const std::vector packs) - : name(name), - type(type), - seed(seed), - settings(settings), - content(content), - packs(packs) { - wfile = new WorldFiles(directory, settings.debug); -} - World::~World(){ delete wfile; } @@ -83,13 +65,12 @@ void World::write(Level* level) { } Level* World::create(std::string name, - std::string type, fs::path directory, uint64_t seed, EngineSettings& settings, const Content* content, const std::vector& packs) { - auto world = new World(name, type, directory, seed, settings, content, packs); + auto world = new World(name, directory, seed, settings, content, packs); auto level = new Level(world, content, settings); auto inventory = level->player->getInventory(); inventory->setId(world->getNextInventoryId()); @@ -150,57 +131,47 @@ uint64_t World::getSeed() const { return seed; } -std::string World::getType() const { - return type; -} - const std::vector& World::getPacks() const { return packs; } void World::deserialize(dynamic::Map* root) { name = root->getStr("name", name); - type = root->getStr("type", type); seed = root->getInt("seed", seed); - if(type == "") { - type = WorldTypes::getDefaultWorldType(); - } + auto verobj = root->map("version"); + if (verobj) { + int major=0, minor=-1; + verobj->num("major", major); + verobj->num("minor", minor); + std::cout << "world version: " << major << "." << minor << std::endl; + } - auto verobj = root->map("version"); - if (verobj) { - int major=0, minor=-1; - verobj->num("major", major); - verobj->num("minor", minor); - std::cout << "world version: " << major << "." << minor << std::endl; - } - - auto timeobj = root->map("time"); - if (timeobj) { - timeobj->num("day-time", daytime); - timeobj->num("day-time-speed", daytimeSpeed); + auto timeobj = root->map("time"); + if (timeobj) { + timeobj->num("day-time", daytime); + timeobj->num("day-time-speed", daytimeSpeed); timeobj->num("total-time", totalTime); - } + } nextInventoryId = root->getNum("next-inventory-id", 2); } std::unique_ptr World::serialize() const { - auto root = std::make_unique(); + auto root = std::make_unique(); - auto& versionobj = root->putMap("version"); - versionobj.put("major", ENGINE_VERSION_MAJOR); - versionobj.put("minor", ENGINE_VERSION_MINOR); + auto& versionobj = root->putMap("version"); + versionobj.put("major", ENGINE_VERSION_MAJOR); + versionobj.put("minor", ENGINE_VERSION_MINOR); - root->put("name", name); - root->put("type", type); - root->put("seed", seed); - + root->put("name", name); + root->put("seed", seed); + auto& timeobj = root->putMap("time"); - timeobj.put("day-time", daytime); - timeobj.put("day-time-speed", daytimeSpeed); + timeobj.put("day-time", daytime); + timeobj.put("day-time-speed", daytimeSpeed); timeobj.put("total-time", totalTime); root->put("next-inventory-id", nextInventoryId); return root; -} \ No newline at end of file +} diff --git a/src/world/World.h b/src/world/World.h index ff307e6d..faf142e7 100644 --- a/src/world/World.h +++ b/src/world/World.h @@ -28,7 +28,6 @@ public: class World : public Serializable { std::string name; - std::string type; uint64_t seed; EngineSettings& settings; const Content* const content; @@ -53,15 +52,6 @@ public: EngineSettings& settings, const Content* content, std::vector packs); - - World(std::string name, - std::string type, - fs::path directory, - uint64_t seed, - EngineSettings& settings, - const Content* content, - std::vector packs); - ~World(); /** @@ -87,7 +77,6 @@ public: * Create new world * @param name internal world name * @param directory root world directory - * @param type of the world * @param seed world generation seed * @param settings current engine settings * @param content current engine Content instance @@ -96,7 +85,6 @@ public: * @return Level instance containing World instance */ static Level* create(std::string name, - std::string type, fs::path directory, uint64_t seed, EngineSettings& settings, @@ -136,8 +124,6 @@ public: /** Get world generation seed */ uint64_t getSeed() const; - /** Get world type */ - std::string getType() const; /** * Get vector of all content-packs installed in world */ @@ -162,4 +148,4 @@ public: void deserialize(dynamic::Map *src) override; }; -#endif /* WORLD_WORLD_H_ */ \ No newline at end of file +#endif /* WORLD_WORLD_H_ */