diff --git a/.github/workflows/appimage-wayland.yml b/.github/workflows/appimage-wayland.yml deleted file mode 100644 index f59902f7..00000000 --- a/.github/workflows/appimage-wayland.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: C/C++ AppImage (wayland) - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build-appimage: - - strategy: - matrix: - include: - - os: ubuntu-latest - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v2 - with: - submodules: 'true' - - name: install dependencies - run: | - sudo apt-get update - sudo apt-get install -y build-essential libglfw3-wayland libglfw3-dev libglew-dev libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev cmake squashfs-tools - sudo ln -s /usr/lib/x86_64-linux-gnu/libluajit-5.1.a /usr/lib/x86_64-linux-gnu/liblua5.1.a - sudo ln -s /usr/include/luajit-2.1 /usr/include/lua - - name: configure - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_APPDIR=1 - - name: build - run: cmake --build build -t install - - name: Build AppImage - uses: AppImageCrafters/build-appimage-action@fe2205a4d6056be47051f7b1b3811106e9814910 - env: - UPDATE_INFO: gh-releases-zsync|MihailRis|VoxelEngine-Cpp|latest|*x86_64.AppImage.zsync - with: - recipe: dev/AppImageBuilder.yml - - uses: actions/upload-artifact@v2 - with: - name: AppImage - path: './*.AppImage*' diff --git a/res/scripts/stdlib.lua b/res/scripts/stdlib.lua index 370d4eef..44e6e3f4 100644 --- a/res/scripts/stdlib.lua +++ b/res/scripts/stdlib.lua @@ -20,8 +20,10 @@ function parse_path(path) return string.sub(path, 1, index-1), string.sub(path, index+1, -1) end +package = { + loaded={} +} local __cached_scripts = {} -local __cached_results = {} -- Load script with caching -- @@ -31,38 +33,44 @@ local __cached_results = {} -- nocache - ignore cached script, load anyway function load_script(path, nocache) local packname, filename = parse_path(path) - local fullpath = file.resolve(path); -- __cached_scripts used in condition because cached result may be nil - if not nocache and __cached_scripts[fullpath] ~= nil then - return __cached_results[fullpath] + if not nocache and __cached_scripts[path] ~= nil then + return package.loaded[path] end if not file.isfile(path) then error("script '"..filename.."' not found in '"..packname.."'") end - local script, err = loadfile(fullpath) + local script, err = loadfile(file.resolve(path)) if script == nil then error(err) end local result = script() if not nocache then - __cached_scripts[fullpath] = script - __cached_results[fullpath] = result + __cached_scripts[path] = script + package.loaded[path] = result end return result end +function __scripts_cleanup() + print("cleaning scripts cache") + for k, v in pairs(__cached_scripts) do + local packname, _ = parse_path(k) + if packname ~= "core" then + print("unloaded "..k) + __cached_scripts[k] = nil + package.loaded[k] = nil + end + end +end + function require(path) local prefix, file = parse_path(path) return load_script(prefix..":modules/"..file..".lua") end -function __reset_scripts_cache() - __cached_scripts = {} - __cached_results = {} -end - function sleep(timesec) local start = time.uptime() while time.uptime() - start < timesec do diff --git a/src/files/WorldFiles.cpp b/src/files/WorldFiles.cpp index 62b79a41..24c3dfe4 100644 --- a/src/files/WorldFiles.cpp +++ b/src/files/WorldFiles.cpp @@ -559,11 +559,11 @@ bool WorldFiles::readWorldInfo(World* world) { return true; } -void WorldFiles::writePlayer(Player* player) { +void WorldFiles::writePlayer(std::shared_ptr player) { files::write_json(getPlayerFile(), player->serialize().release()); } -bool WorldFiles::readPlayer(Player* player) { +bool WorldFiles::readPlayer(std::shared_ptr player) { fs::path file = getPlayerFile(); if (!fs::is_regular_file(file)) { std::cerr << "warning: player.json does not exists" << std::endl; diff --git a/src/files/WorldFiles.h b/src/files/WorldFiles.h index 34203b97..a3a9a483 100644 --- a/src/files/WorldFiles.h +++ b/src/files/WorldFiles.h @@ -143,13 +143,13 @@ public: chunk_inventories_map fetchInventories(int x, int z); bool readWorldInfo(World* world); - bool readPlayer(Player* player); + bool readPlayer(std::shared_ptr player); void writeRegion(int x, int y, WorldRegion* entry, fs::path file, int layer); - void writePlayer(Player* player); + void writePlayer(std::shared_ptr player); /* @param world world info to save (nullable) */ void write(const World* world, const Content* content); void writePacks(const World* world); diff --git a/src/frontend/gui/controls.cpp b/src/frontend/gui/controls.cpp index 3e68f392..1328b4dc 100644 --- a/src/frontend/gui/controls.cpp +++ b/src/frontend/gui/controls.cpp @@ -361,10 +361,18 @@ std::wstring TextBox::getText() const { return input; } -void TextBox::setText(std::wstring value) { +void TextBox::setText(const std::wstring value) { this->input = value; } +std::wstring TextBox::getPlaceholder() const { + return placeholder; +} + +void TextBox::setPlaceholder(const std::wstring& placeholder) { + this->placeholder = placeholder; +} + // ============================== InputBindBox ================================ InputBindBox::InputBindBox(Binding& binding, glm::vec4 padding) : Panel(glm::vec2(100,32), padding, 0), diff --git a/src/frontend/gui/controls.h b/src/frontend/gui/controls.h index fd62f0db..1d0cb1ea 100644 --- a/src/frontend/gui/controls.h +++ b/src/frontend/gui/controls.h @@ -122,6 +122,8 @@ namespace gui { virtual std::wstring getText() const; /* Set TextBox content text */ virtual void setText(std::wstring value); + virtual std::wstring getPlaceholder() const; + virtual void setPlaceholder(const std::wstring&); virtual bool validate(); virtual void setValid(bool valid); virtual bool isValid() const; diff --git a/src/frontend/hud.cpp b/src/frontend/hud.cpp index 860131a2..c2fec154 100644 --- a/src/frontend/hud.cpp +++ b/src/frontend/hud.cpp @@ -645,6 +645,6 @@ void Hud::setPause(bool pause) { menu->setVisible(pause); } -Player* Hud::getPlayer() const { +std::shared_ptr Hud::getPlayer() const { return frontend->getLevel()->player; } diff --git a/src/frontend/hud.h b/src/frontend/hud.h index 7e9e2153..5a5b8914 100644 --- a/src/frontend/hud.h +++ b/src/frontend/hud.h @@ -118,7 +118,7 @@ public: void remove(HudElement& element); void remove(std::shared_ptr node); - Player* getPlayer() const; + std::shared_ptr getPlayer() const; }; #endif /* SRC_HUD_H_ */ diff --git a/src/graphics/BlocksRenderer.cpp b/src/graphics/BlocksRenderer.cpp index 70271c31..14bdf0cd 100644 --- a/src/graphics/BlocksRenderer.cpp +++ b/src/graphics/BlocksRenderer.cpp @@ -102,13 +102,9 @@ void BlocksRenderer::face(const vec3& coord, void BlocksRenderer::vertex(const vec3& coord, float u, float v, const vec4& tint, - const vec3& X, - const vec3& Y, - const vec3& Z) { - // TODO: optimize - vec3 axisX = glm::normalize(X); - vec3 axisY = glm::normalize(Y); - vec3 axisZ = glm::normalize(Z); + const vec3& axisX, + const vec3& axisY, + const vec3& axisZ) { vec3 pos = coord+axisZ*0.5f+(axisX+axisY)*0.5f; vec4 light = pickSoftLight(ivec3(round(pos.x), round(pos.y), round(pos.z)), axisX, axisY); vertex(coord, u, v, light * tint); @@ -130,11 +126,15 @@ void BlocksRenderer::face(const vec3& coord, float d = glm::dot(Z, SUN_VECTOR); d = 0.8f + d * 0.2f; + vec3 axisX = glm::normalize(X); + vec3 axisY = glm::normalize(Y); + vec3 axisZ = glm::normalize(Z); + vec4 tint(d); - vertex(coord + (-X - Y + Z) * s, region.u1, region.v1, tint, X, Y, Z); - vertex(coord + ( X - Y + Z) * s, region.u2, region.v1, tint, X, Y, Z); - vertex(coord + ( X + Y + Z) * s, region.u2, region.v2, tint, X, Y, Z); - vertex(coord + (-X + Y + Z) * s, region.u1, region.v2, tint, X, Y, Z); + vertex(coord + (-X - Y + Z) * s, region.u1, region.v1, tint, axisX, axisY, axisZ); + vertex(coord + ( X - Y + Z) * s, region.u2, region.v1, tint, axisX, axisY, axisZ); + vertex(coord + ( X + Y + Z) * s, region.u2, region.v2, tint, axisX, axisY, axisZ); + vertex(coord + (-X + Y + Z) * s, region.u1, region.v2, tint, axisX, axisY, axisZ); } else { vec4 tint(1.0f); vertex(coord + (-X - Y + Z) * s, region.u1, region.v1, tint); @@ -142,7 +142,7 @@ void BlocksRenderer::face(const vec3& coord, vertex(coord + ( X + Y + Z) * s, region.u2, region.v2, tint); vertex(coord + (-X + Y + Z) * s, region.u1, region.v2, tint); } - index(0, 1, 2, 0, 2, 3); + index(0, 1, 2, 0, 2, 3); } void BlocksRenderer::tetragonicFace(const vec3& coord, const vec3& p1, diff --git a/src/interfaces/Object.h b/src/interfaces/Object.h new file mode 100644 index 00000000..5ffe1cb6 --- /dev/null +++ b/src/interfaces/Object.h @@ -0,0 +1,25 @@ +#ifndef OBJECT_H +#define OBJECT_H + +#include "stdlib.h" +#include + +class Level; + +class Object { +private: + +public: + uint64_t objectUID; + bool shouldUpdate = true; + +public: + ~Object() { destroyed(); } + +public: + virtual void spawned() { } + virtual void update(float delta) { } + virtual void destroyed() { } +}; + +#endif /* OBJECT_H */ \ No newline at end of file diff --git a/src/interfaces/Serializable.h b/src/interfaces/Serializable.h index a1c0d4e2..ee75498b 100644 --- a/src/interfaces/Serializable.h +++ b/src/interfaces/Serializable.h @@ -4,12 +4,11 @@ #include #include "../coders/json.h" -class Serializable -{ +class Serializable { public: virtual ~Serializable() { } virtual std::unique_ptr serialize() const = 0; virtual void deserialize(dynamic::Map* src) = 0; }; -#endif \ No newline at end of file +#endif /* SERIALIZABLE_H */ \ No newline at end of file diff --git a/src/items/Inventory.h b/src/items/Inventory.h index 677f8d9a..69f6e173 100644 --- a/src/items/Inventory.h +++ b/src/items/Inventory.h @@ -13,7 +13,7 @@ class ContentLUT; class ContentIndices; -class Inventory : Serializable { +class Inventory : public Serializable { int64_t id; std::vector slots; public: diff --git a/src/lighting/Lightmap.h b/src/lighting/Lightmap.h index 16a273dd..12d2b586 100644 --- a/src/lighting/Lightmap.h +++ b/src/lighting/Lightmap.h @@ -73,11 +73,11 @@ public: return map; } - static inline light_t combine(int r, int g, int b, int s) { + static constexpr light_t combine(int r, int g, int b, int s) { return r | (g << 4) | (b << 8) | (s << 12); } - static inline light_t extract(light_t light, ubyte channel) { + static constexpr light_t extract(light_t light, ubyte channel) { return (light >> (channel << 2)) & 0xF; } diff --git a/src/logic/LevelController.cpp b/src/logic/LevelController.cpp index 826204ca..94a82062 100644 --- a/src/logic/LevelController.cpp +++ b/src/logic/LevelController.cpp @@ -6,6 +6,7 @@ #include "ChunksController.h" #include "scripting/scripting.h" +#include "../interfaces/Object.h" LevelController::LevelController(EngineSettings& settings, Level* level) : settings(settings), level(level) { @@ -23,7 +24,20 @@ void LevelController::update(float delta, bool input, bool pause) { player->update(delta, input, pause); level->update(); chunks->update(settings.chunks.loadSpeed); + + // erease null pointers + level->objects.remove_if([](auto obj) { return obj == nullptr; }); + if (!pause) { + // update all objects that needed + for(auto obj : level->objects) + { + if(obj) { + if(obj->shouldUpdate) { + obj->update(delta); + } + } + } blocks->update(delta); } } diff --git a/src/logic/PlayerController.cpp b/src/logic/PlayerController.cpp index 482b5b01..ab44336e 100644 --- a/src/logic/PlayerController.cpp +++ b/src/logic/PlayerController.cpp @@ -31,7 +31,7 @@ const float C_ZOOM = 0.1f; const float CROUCH_SHIFT_Y = -0.2f; -CameraControl::CameraControl(Player* player, const CameraSettings& settings) +CameraControl::CameraControl(std::shared_ptr player, const CameraSettings& settings) : player(player), camera(player->camera), currentViewCamera(player->currentCamera), @@ -202,13 +202,13 @@ void PlayerController::resetKeyboard() { } void PlayerController::updateControls(float delta){ - player->update(level, input, delta); + player->updateInput(level, input, delta); } void PlayerController::updateInteraction(){ auto indices = level->content->getIndices(); Chunks* chunks = level->chunks; - Player* player = level->player; + Player* player = level->player.get(); Lighting* lighting = level->lighting; Camera* camera = player->camera.get(); glm::vec3 end; diff --git a/src/logic/PlayerController.h b/src/logic/PlayerController.h index d9d002d6..a1479820 100644 --- a/src/logic/PlayerController.h +++ b/src/logic/PlayerController.h @@ -12,7 +12,7 @@ class Level; class BlocksController; class CameraControl { - Player* player; + std::shared_ptr player; std::shared_ptr camera, currentViewCamera; const CameraSettings& settings; glm::vec3 offset; @@ -20,7 +20,7 @@ class CameraControl { float shakeTimer = 0.0f; glm::vec3 interpVel {0.0f}; public: - CameraControl(Player* player, const CameraSettings& settings); + CameraControl(std::shared_ptr player, const CameraSettings& settings); void updateMouse(PlayerInput& input); void update(PlayerInput& input, float delta, Chunks* chunks); void refresh(); @@ -28,7 +28,7 @@ public: class PlayerController { Level* level; - Player* player; + std::shared_ptr player; PlayerInput input; CameraControl camControl; BlocksController* blocksController; diff --git a/src/logic/scripting/lua/libgui.cpp b/src/logic/scripting/lua/libgui.cpp index cdcc6561..d83c57f9 100644 --- a/src/logic/scripting/lua/libgui.cpp +++ b/src/logic/scripting/lua/libgui.cpp @@ -103,6 +103,29 @@ static bool getattr(lua_State* L, gui::FullCheckBox* box, const std::string& att return false; } +static bool getattr(lua_State* L, gui::TextBox* box, const std::string& attr) { + if (box == nullptr) + return false; + if (attr == "text") { + lua_pushstring(L, util::wstr2str_utf8(box->getText()).c_str()); + return true; + } else if (attr == "placeholder") { + lua_pushstring(L, util::wstr2str_utf8(box->getPlaceholder()).c_str()); + return true; + } + return false; +} + +static bool setattr(lua_State* L, gui::FullCheckBox* box, const std::string& attr) { + if (box == nullptr) + return false; + if (attr == "checked") { + box->setChecked(lua_toboolean(L, 4)); + return true; + } + return false; +} + static bool setattr(lua_State* L, gui::Button* button, const std::string& attr) { if (button == nullptr) return false; @@ -115,11 +138,14 @@ static bool setattr(lua_State* L, gui::Button* button, const std::string& attr) return false; } -static bool setattr(lua_State* L, gui::FullCheckBox* box, const std::string& attr) { +static bool setattr(lua_State* L, gui::TextBox* box, const std::string& attr) { if (box == nullptr) return false; - if (attr == "checked") { - box->setChecked(lua_toboolean(L, 4)); + if (attr == "text") { + box->setText(util::str2wstr_utf8(lua_tostring(L, 4))); + return true; + } else if (attr == "placeholder") { + box->setPlaceholder(util::str2wstr_utf8(lua_tostring(L, 4))); return true; } return false; @@ -161,6 +187,8 @@ int l_gui_getattr(lua_State* L) { return 1; if (getattr(L, dynamic_cast(node), attr)) return 1; + if (getattr(L, dynamic_cast(node), attr)) + return 1; if (getattr(L, dynamic_cast(node), attr)) return 1; if (getattr(L, dynamic_cast(node), attr)) @@ -197,6 +225,8 @@ int l_gui_setattr(lua_State* L) { return 0; if (setattr(L, dynamic_cast(node), attr)) return 0; + if (setattr(L, dynamic_cast(node), attr)) + return 0; if (setattr(L, dynamic_cast(node), attr)) return 0; if (setattr(L, dynamic_cast(node), attr)) diff --git a/src/logic/scripting/lua/libplayer.cpp b/src/logic/scripting/lua/libplayer.cpp index cbf1fe47..dfb8fc16 100644 --- a/src/logic/scripting/lua/libplayer.cpp +++ b/src/logic/scripting/lua/libplayer.cpp @@ -57,7 +57,7 @@ int l_player_get_inv(lua_State* L) { int playerid = lua_tointeger(L, 1); if (playerid != 1) return 0; - Player* player = scripting::level->player; + auto player = scripting::level->player; lua_pushinteger(L, player->getInventory()->getId()); lua_pushinteger(L, player->getChosenSlot()); return 2; diff --git a/src/logic/scripting/scripting.cpp b/src/logic/scripting/scripting.cpp index 26d55047..6ea8da5b 100644 --- a/src/logic/scripting/scripting.cpp +++ b/src/logic/scripting/scripting.cpp @@ -124,6 +124,9 @@ void scripting::on_world_quit() { state->callNoThrow(0); } } + if (state->getglobal("__scripts_cleanup")) { + state->callNoThrow(0); + } scripting::level = nullptr; scripting::content = nullptr; scripting::indices = nullptr; diff --git a/src/objects/Player.cpp b/src/objects/Player.cpp index 39268de6..62c9d712 100644 --- a/src/objects/Player.cpp +++ b/src/objects/Player.cpp @@ -33,7 +33,7 @@ Player::Player(glm::vec3 position, float speed, std::shared_ptr inv) Player::~Player() { } -void Player::update( +void Player::updateInput( Level* level, PlayerInput& input, float delta) { diff --git a/src/objects/Player.h b/src/objects/Player.h index f49a9fc2..bea94c2b 100644 --- a/src/objects/Player.h +++ b/src/objects/Player.h @@ -8,6 +8,7 @@ #include "../voxels/voxel.h" #include "../settings.h" #include "../interfaces/Serializable.h" +#include "../interfaces/Object.h" class Camera; class Hitbox; @@ -32,7 +33,7 @@ struct PlayerInput { bool flight; }; -class Player : Serializable { +class Player : public Object, public Serializable { float speed; int chosenSlot; glm::vec3 spawnpoint {}; @@ -52,7 +53,7 @@ public: ~Player(); void teleport(glm::vec3 position); - void update(Level* level, PlayerInput& input, float delta); + void updateInput(Level* level, PlayerInput& input, float delta); void attemptToFindSpawnpoint(Level* level); diff --git a/src/window/Window.h b/src/window/Window.h index 751c2058..9712c588 100644 --- a/src/window/Window.h +++ b/src/window/Window.h @@ -9,9 +9,9 @@ #include -class GLFWwindow; class ImageData; struct DisplaySettings; +struct GLFWwindow; struct GLFWmonitor; enum class blendmode { diff --git a/src/world/Level.cpp b/src/world/Level.cpp index 90d0df46..287607ed 100644 --- a/src/world/Level.cpp +++ b/src/world/Level.cpp @@ -8,19 +8,27 @@ #include "../voxels/ChunksStorage.h" #include "../physics/Hitbox.h" #include "../physics/PhysicsSolver.h" +#include "../interfaces/Object.h" #include "../objects/Player.h" #include "../items/Inventory.h" #include "../items/Inventories.h" -Level::Level(World* world, const Content* content, Player* player, EngineSettings& settings) + +const float DEF_PLAYER_Y = 100.0f; +const float DEF_PLAYER_SPEED = 4.0f; +const int DEF_PLAYER_INVENTORY_SIZE = 40; + +Level::Level(World* world, const Content* content, EngineSettings& settings) : world(world), content(content), - player(player), chunksStorage(new ChunksStorage(this)), events(new LevelEvents()) , settings(settings) { + objCounter = 0; physics = new PhysicsSolver(glm::vec3(0, -22.6f, 0)); + auto inv = std::make_shared(world->getNextInventoryId(), DEF_PLAYER_INVENTORY_SIZE); + player = spawnObject(glm::vec3(0, DEF_PLAYER_Y, 0), DEF_PLAYER_SPEED, inv); uint matrixSize = (settings.chunks.loadDistance+ settings.chunks.padding) * 2; @@ -33,15 +41,20 @@ Level::Level(World* world, const Content* content, Player* player, EngineSetting }); inventories = std::make_unique(*this); + inventories->store(player->getInventory()); } Level::~Level(){ delete chunks; delete events; delete physics; - delete player; delete lighting; delete chunksStorage; + + for(auto obj : objects) + { + obj.reset(); + } } void Level::update() { @@ -58,3 +71,18 @@ void Level::update() { World* Level::getWorld() { return world.get(); } + + +template +std::shared_ptr Level::spawnObject(Args&&... args) +{ + static_assert(std::is_base_of::value, "T must be a derived of Object class"); + std::shared_ptr tObj = std::make_shared(args...); + + std::shared_ptr obj = std::dynamic_pointer_cast(tObj); + objects.push_back(obj); + obj->objectUID = objCounter; + obj->spawned(); + objCounter += 1; + return tObj; +} diff --git a/src/world/Level.h b/src/world/Level.h index e670422f..fbf9d283 100644 --- a/src/world/Level.h +++ b/src/world/Level.h @@ -5,10 +5,14 @@ #include "../typedefs.h" #include "../settings.h" +#include +#include +#include class Content; class World; class Player; +class Object; class Chunks; class Inventory; class Inventories; @@ -18,10 +22,13 @@ class PhysicsSolver; class ChunksStorage; class Level { +private: + int objCounter; public: std::unique_ptr world; const Content* const content; - Player* player; + std::list> objects; + std::shared_ptr player; Chunks* chunks; ChunksStorage* chunksStorage; std::unique_ptr inventories; @@ -34,13 +41,18 @@ public: Level(World* world, const Content* content, - Player* player, EngineSettings& settings); ~Level(); void update(); World* getWorld(); + + // Spawns object of class T and returns pointer to it. + // @param T class that derives the Object class + // @param args pass arguments needed for T class constructor + template + std::shared_ptr spawnObject(Args&&... args); }; #endif /* WORLD_LEVEL_H_ */ diff --git a/src/world/World.cpp b/src/world/World.cpp index 281233f1..85401b3e 100644 --- a/src/world/World.cpp +++ b/src/world/World.cpp @@ -82,10 +82,6 @@ void World::write(Level* level) { wfile->writePlayer(level->player); } -const float DEF_PLAYER_Y = 100.0f; -const float DEF_PLAYER_SPEED = 4.0f; -const int DEF_PLAYER_INVENTORY_SIZE = 40; - Level* World::create(std::string name, std::string type, fs::path directory, @@ -94,12 +90,8 @@ Level* World::create(std::string name, const Content* content, const std::vector& packs) { auto world = new World(name, type, directory, seed, settings, content, packs); - auto inv = std::make_shared(world->getNextInventoryId(), DEF_PLAYER_INVENTORY_SIZE); - auto player = new Player( - glm::vec3(0, DEF_PLAYER_Y, 0), DEF_PLAYER_SPEED, inv - ); - auto level = new Level(world, content, player, settings); - level->inventories->store(player->getInventory()); + auto level = new Level(world, content, settings); + return level; } @@ -116,13 +108,8 @@ Level* World::load(fs::path directory, throw world_load_error("could not to find world.json"); } - auto inv = std::make_shared(0, DEF_PLAYER_INVENTORY_SIZE); - auto player = new Player( - glm::vec3(0, DEF_PLAYER_Y, 0), DEF_PLAYER_SPEED, inv - ); - auto level = new Level(world.get(), content, player, settings); - wfile->readPlayer(player); - level->inventories->store(player->getInventory()); + auto level = new Level(world.get(), content, settings); + wfile->readPlayer(level->player); world.release(); return level; } diff --git a/src/world/World.h b/src/world/World.h index d74beb87..ff307e6d 100644 --- a/src/world/World.h +++ b/src/world/World.h @@ -26,7 +26,7 @@ public: world_load_error(std::string message); }; -class World : Serializable { +class World : public Serializable { std::string name; std::string type; uint64_t seed;