diff --git a/src/assets/Assets.cpp b/src/assets/Assets.cpp index 993e7360..c7ef6946 100644 --- a/src/assets/Assets.cpp +++ b/src/assets/Assets.cpp @@ -1,6 +1,7 @@ #include "Assets.hpp" -Assets::~Assets() = default; +Assets::~Assets() { +} const std::vector& Assets::getAnimations() { return animations; diff --git a/src/assets/Assets.hpp b/src/assets/Assets.hpp index d30f8187..4474301e 100644 --- a/src/assets/Assets.hpp +++ b/src/assets/Assets.hpp @@ -68,7 +68,7 @@ class Assets { std::unordered_map assets; std::vector setupFuncs; public: - Assets() = default; + Assets() {} Assets(const Assets&) = delete; ~Assets(); diff --git a/src/audio/AL/alutil.hpp b/src/audio/AL/alutil.hpp index 9aff6433..6ceccda4 100644 --- a/src/audio/AL/alutil.hpp +++ b/src/audio/AL/alutil.hpp @@ -40,8 +40,7 @@ namespace AL { /// @param field enum value /// @param def default value will be returned in case of error /// @return field value or default - inline glm::vec3 getSource3f(uint source, ALenum field, const glm::vec3& def= {} - ) { + inline glm::vec3 getSource3f(uint source, ALenum field, glm::vec3 def={}) { glm::vec3 value = def; if (source == 0) return def; diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index afd96cb5..b6a36e42 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -210,10 +210,10 @@ std::unique_ptr audio::open_stream(std::shared_ptr stream, bo void audio::set_listener( - const glm::vec3& position, - const glm::vec3& velocity, - const glm::vec3& lookAt, - const glm::vec3& up + glm::vec3 position, + glm::vec3 velocity, + glm::vec3 lookAt, + glm::vec3 up ) { backend->setListener(position, velocity, lookAt, up); } @@ -253,7 +253,7 @@ speakerid_t audio::play( if (!sound->variants.empty()) { size_t index = rand() % (sound->variants.size() + 1); if (index < sound->variants.size()) { - sound = sound->variants[index].get(); + sound = sound->variants.at(index).get(); } } auto speaker_ptr = sound->newInstance(priority, channel); @@ -266,7 +266,7 @@ speakerid_t audio::play( } auto speaker = speaker_ptr.get(); speakerid_t id = nextId++; - speakers.try_emplace(id, std::move(speaker_ptr)); + speakers.emplace(id, std::move(speaker_ptr)); speaker->setPosition(position); speaker->setVolume(volume); speaker->setPitch(pitch); @@ -295,8 +295,8 @@ speakerid_t audio::play( } auto speaker = speaker_ptr.get(); speakerid_t id = nextId++; - streams.try_emplace(id, stream); - speakers.try_emplace(id, std::move(speaker_ptr)); + streams.emplace(id, stream); + speakers.emplace(id, std::move(speaker_ptr)); stream->bindSpeaker(id); speaker->setPosition(position); @@ -310,7 +310,7 @@ speakerid_t audio::play( speakerid_t audio::play_stream( const fs::path& file, - const glm::vec3& position, + glm::vec3 position, bool relative, float volume, float pitch, diff --git a/src/audio/audio.hpp b/src/audio/audio.hpp index 5e58a854..4656de6f 100644 --- a/src/audio/audio.hpp +++ b/src/audio/audio.hpp @@ -399,10 +399,10 @@ namespace audio { /// @param lookAt point the listener look at /// @param up camera up vector void set_listener( - const glm::vec3& position, - const glm::vec3& velocity, - const glm::vec3& lookAt, - const glm::vec3& up + glm::vec3 position, + glm::vec3 velocity, + glm::vec3 lookAt, + glm::vec3 up ); /// @brief Play 3D sound in the world @@ -457,7 +457,7 @@ namespace audio { /// @return speaker id or 0 speakerid_t play_stream( const fs::path& file, - const glm::vec3& position, + glm::vec3 position, bool relative, float volume, float pitch, diff --git a/src/coders/xml.hpp b/src/coders/xml.hpp index 4af2e4b1..c70ce9c2 100644 --- a/src/coders/xml.hpp +++ b/src/coders/xml.hpp @@ -23,7 +23,7 @@ namespace xml { std::string name; std::string text; public: - Attribute() = default; + Attribute() {}; Attribute(std::string name, std::string text); const std::string& getName() const; diff --git a/src/content/Content.cpp b/src/content/Content.cpp index 2e5612a4..11e204d6 100644 --- a/src/content/Content.cpp +++ b/src/content/Content.cpp @@ -46,7 +46,8 @@ Content::Content( } } -Content::~Content() = default; +Content::~Content() { +} const rigging::SkeletonConfig* Content::getSkeleton(const std::string& id) const { auto found = skeletons.find(id); diff --git a/src/content/Content.hpp b/src/content/Content.hpp index 7f3a7d75..16e072b7 100644 --- a/src/content/Content.hpp +++ b/src/content/Content.hpp @@ -119,7 +119,7 @@ public: static constexpr size_t MISSING = SIZE_MAX; - void add(const std::string& name, dynamic::Map_sptr map) { + void add(std::string name, dynamic::Map_sptr map) { indices[name] = names.size(); names.push_back(name); savedData->push_back(map); diff --git a/src/content/ContentBuilder.cpp b/src/content/ContentBuilder.cpp index 76f3052c..6f7b730b 100644 --- a/src/content/ContentBuilder.cpp +++ b/src/content/ContentBuilder.cpp @@ -2,7 +2,7 @@ #include "../objects/rigging.hpp" -ContentBuilder::~ContentBuilder() = default; +ContentBuilder::~ContentBuilder() {} void ContentBuilder::add(std::unique_ptr pack) { packs[pack->getId()] = std::move(pack); diff --git a/src/content/ContentLoader.cpp b/src/content/ContentLoader.cpp index d82f0b70..448754a2 100644 --- a/src/content/ContentLoader.cpp +++ b/src/content/ContentLoader.cpp @@ -85,7 +85,7 @@ bool ContentLoader::fixPackIndices( indexed.push_back(name); } } - for (const auto &name : detected) { + for (auto name : detected) { if (!util::contains(indexed, name)) { arr->put(name); modified = true; @@ -176,10 +176,9 @@ void ContentLoader::loadBlock(Block& def, const std::string& name, const fs::pat def.hitboxes.resize(boxarr->size()); for (uint i = 0; i < boxarr->size(); i++) { auto box = boxarr->list(i); - auto& hitboxesIndex = def.hitboxes[i]; - hitboxesIndex.a = glm::vec3(box->num(0), box->num(1), box->num(2)); - hitboxesIndex.b = glm::vec3(box->num(3), box->num(4), box->num(5)); - hitboxesIndex.b += hitboxesIndex.a; + def.hitboxes[i].a = glm::vec3(box->num(0), box->num(1), box->num(2)); + def.hitboxes[i].b = glm::vec3(box->num(3), box->num(4), box->num(5)); + def.hitboxes[i].b += def.hitboxes[i].a; } } else if ((boxarr = root->list("hitbox"))){ AABB aabb; @@ -252,11 +251,11 @@ void ContentLoader::loadCustomBlockModel(Block& def, dynamic::Map* primitives) { if (boxarr->size() == 7) for (uint j = 6; j < 12; j++) { - def.modelTextures.emplace_back(boxarr->str(6)); + def.modelTextures.push_back(boxarr->str(6)); } else if (boxarr->size() == 12) for (uint j = 6; j < 12; j++) { - def.modelTextures.emplace_back(boxarr->str(j)); + def.modelTextures.push_back(boxarr->str(j)); } else for (uint j = 6; j < 12; j++) { @@ -277,7 +276,7 @@ void ContentLoader::loadCustomBlockModel(Block& def, dynamic::Map* primitives) { def.modelExtraPoints.push_back(p1+xw+yh); def.modelExtraPoints.push_back(p1+yh); - def.modelTextures.emplace_back(tgonobj->str(9)); + def.modelTextures.push_back(tgonobj->str(9)); } } } @@ -314,7 +313,7 @@ void ContentLoader::loadEntity(EntityDef& def, const std::string& name, const fs auto root = files::read_json(file); if (auto componentsarr = root->list("components")) { for (size_t i = 0; i < componentsarr->size(); i++) { - def.components.emplace_back(componentsarr->str(i)); + def.components.push_back(componentsarr->str(i)); } } if (auto boxarr = root->list("hitbox")) { @@ -325,12 +324,12 @@ void ContentLoader::loadEntity(EntityDef& def, const std::string& name, const fs if (auto sensorarr = sensorsarr->list(i)) { auto sensorType = sensorarr->str(0); if (sensorType == "aabb") { - def.boxSensors.emplace_back(i, AABB{ + def.boxSensors.push_back({i, { {sensorarr->num(1), sensorarr->num(2), sensorarr->num(3)}, {sensorarr->num(4), sensorarr->num(5), sensorarr->num(6)} - }); + }}); } else if (sensorType == "radius") { - def.radialSensors.emplace_back(i, sensorarr->num(1)); + def.radialSensors.push_back({i, sensorarr->num(1)}); } else { logger.error() << name << ": sensor #" << i << " - unknown type " << util::quote(sensorType); diff --git a/src/content/ContentPack.cpp b/src/content/ContentPack.cpp index 0c88c7b0..8388e30c 100644 --- a/src/content/ContentPack.cpp +++ b/src/content/ContentPack.cpp @@ -142,4 +142,5 @@ ContentPackRuntime::ContentPackRuntime( { } -ContentPackRuntime::~ContentPackRuntime() = default; +ContentPackRuntime::~ContentPackRuntime() { +} diff --git a/src/content/PacksManager.cpp b/src/content/PacksManager.cpp index 3a47d66d..c8bb4e05 100644 --- a/src/content/PacksManager.cpp +++ b/src/content/PacksManager.cpp @@ -5,10 +5,11 @@ #include #include -PacksManager::PacksManager() = default; +PacksManager::PacksManager() { +} void PacksManager::setSources(std::vector sources) { - this->sources = std::move(sources); + this->sources = sources; } void PacksManager::scan() { @@ -18,7 +19,7 @@ void PacksManager::scan() { for (auto& folder : sources) { ContentPack::scanFolder(folder, packsList); for (auto& pack : packsList) { - packs.try_emplace(pack.id, pack); + packs.emplace(pack.id, pack); } } } diff --git a/src/data/dynamic.hpp b/src/data/dynamic.hpp index ab66bdd8..90f4fe69 100644 --- a/src/data/dynamic.hpp +++ b/src/data/dynamic.hpp @@ -41,7 +41,7 @@ namespace dynamic { public: std::vector values; - List() = default; + List() {} List(std::vector values) : values(std::move(values)) {} std::string str(size_t index) const; @@ -79,7 +79,7 @@ namespace dynamic { public: std::unordered_map values; - Map() = default; + Map() {} Map(std::unordered_map values) : values(std::move(values)) {}; @@ -118,34 +118,34 @@ namespace dynamic { List_sptr list(const std::string& key) const; void flag(const std::string& key, bool& dst) const; - Map& put(const std::string& key, std::unique_ptr value) { + Map& put(std::string key, std::unique_ptr value) { return put(key, Map_sptr(value.release())); } - Map& put(const std::string& key, std::unique_ptr value) { + Map& put(std::string key, std::unique_ptr value) { return put(key, List_sptr(value.release())); } - Map& put(const std::string& key, int value) { + Map& put(std::string key, int value) { return put(key, Value(static_cast(value))); } - Map& put(const std::string& key, unsigned int value) { + Map& put(std::string key, unsigned int value) { return put(key, Value(static_cast(value))); } - Map& put(const std::string& key, int64_t value) { + Map& put(std::string key, int64_t value) { return put(key, Value(static_cast(value))); } - Map& put(const std::string& key, uint64_t value) { + Map& put(std::string key, uint64_t value) { return put(key, Value(static_cast(value))); } - Map& put(const std::string& key, float value) { + Map& put(std::string key, float value) { return put(key, Value(static_cast(value))); } - Map& put(const std::string& key, double value) { + Map& put(std::string key, double value) { return put(key, Value(static_cast(value))); } - Map& put(const std::string& key, bool value) { + Map& put(std::string key, bool value) { return put(key, Value(static_cast(value))); } - Map& put(const std::string& key, const char* value) { + Map& put(std::string key, const char* value) { return put(key, Value(value)); } Map& put(const std::string& key, const Value& value); diff --git a/src/engine.cpp b/src/engine.cpp index f7f6b0e1..cd88298f 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -55,7 +55,7 @@ static void add_world_generators() { WorldGenerators::addGenerator("core:flat"); } -static void create_channel(Engine* engine, const std::string& name, NumberSetting& setting) { +static void create_channel(Engine* engine, std::string name, NumberSetting& setting) { if (name != "master") { audio::create_channel(name); } diff --git a/src/files/WorldConverter.cpp b/src/files/WorldConverter.cpp index 006d031b..1f0b7ad2 100644 --- a/src/files/WorldConverter.cpp +++ b/src/files/WorldConverter.cpp @@ -73,12 +73,11 @@ std::shared_ptr WorldConverter::startTask( [=](){return std::make_shared(converter);}, [=](int&) {} ); - auto& converterTasks = converter->tasks; - while (!converterTasks.empty()) { - const convert_task& task = converterTasks.front(); + while (!converter->tasks.empty()) { + const convert_task& task = converter->tasks.front(); auto ptr = std::make_shared(task); pool->enqueueJob(ptr); - converterTasks.pop(); + converter->tasks.pop(); } pool->setOnComplete([=]() { converter->write(); diff --git a/src/files/WorldFiles.cpp b/src/files/WorldFiles.cpp index 31868e81..0d2f96c5 100644 --- a/src/files/WorldFiles.cpp +++ b/src/files/WorldFiles.cpp @@ -47,7 +47,8 @@ WorldFiles::WorldFiles(const fs::path& directory, const DebugSettings& settings) regions.doWriteLights = doWriteLights; } -WorldFiles::~WorldFiles() = default; +WorldFiles::~WorldFiles() { +} void WorldFiles::createDirectories() { fs::create_directories(directory / fs::path("data")); diff --git a/src/files/WorldRegions.cpp b/src/files/WorldRegions.cpp index f6bf00b9..92feacda 100644 --- a/src/files/WorldRegions.cpp +++ b/src/files/WorldRegions.cpp @@ -56,7 +56,8 @@ WorldRegion::WorldRegion() sizes(std::make_unique(REGION_CHUNKS_COUNT)) {} -WorldRegion::~WorldRegion() = default; +WorldRegion::~WorldRegion() { +} void WorldRegion::setUnsaved(bool unsaved) { this->unsaved = unsaved; @@ -97,7 +98,8 @@ WorldRegions::WorldRegions(const fs::path& directory) : directory(directory) { layers[REGION_LAYER_ENTITIES].folder = directory/fs::path("entities"); } -WorldRegions::~WorldRegions() = default; +WorldRegions::~WorldRegions() { +} WorldRegion* WorldRegions::getRegion(int x, int z, int layer) { RegionsLayer& regions = layers[layer]; @@ -196,7 +198,7 @@ ubyte* WorldRegions::getData(int x, int z, int layer, uint32_t& size) { return nullptr; } -regfile_ptr WorldRegions::useRegFile(const glm::ivec3& coord) { +regfile_ptr WorldRegions::useRegFile(glm::ivec3 coord) { auto* file = openRegFiles[coord].get(); file->inUse = true; return regfile_ptr(file, ®FilesCv); @@ -208,7 +210,7 @@ void WorldRegions::closeRegFile(glm::ivec3 coord) { } // Marks regfile as used and unmarks when shared_ptr dies -regfile_ptr WorldRegions::getRegFile(const glm::ivec3& coord, bool create) { +regfile_ptr WorldRegions::getRegFile(glm::ivec3 coord, bool create) { { std::lock_guard lock(regFilesMutex); const auto found = openRegFiles.find(coord); @@ -225,7 +227,7 @@ regfile_ptr WorldRegions::getRegFile(const glm::ivec3& coord, bool create) { return nullptr; } -regfile_ptr WorldRegions::createRegFile(const glm::ivec3& coord) { +regfile_ptr WorldRegions::createRegFile(glm::ivec3 coord) { fs::path file = layers[coord[2]].folder/getRegionFilename(coord[0], coord[1]); if (!fs::exists(file)) { return nullptr; @@ -352,7 +354,7 @@ static std::unique_ptr write_inventories(Chunk* chunk, uint& datasize) } /// @brief Store chunk data (voxels and lights) in region (existing or new) -void WorldRegions::put(Chunk* chunk, const std::vector& entitiesData){ +void WorldRegions::put(Chunk* chunk, std::vector entitiesData){ assert(chunk != nullptr); if (!chunk->flags.lighted) { return; diff --git a/src/files/WorldRegions.hpp b/src/files/WorldRegions.hpp index 67c6bb9d..f681794d 100644 --- a/src/files/WorldRegions.hpp +++ b/src/files/WorldRegions.hpp @@ -149,10 +149,10 @@ class WorldRegions { ubyte* getData(int x, int z, int layer, uint32_t& size); - regfile_ptr getRegFile(const glm::ivec3& coord, bool create=true); + regfile_ptr getRegFile(glm::ivec3 coord, bool create=true); void closeRegFile(glm::ivec3 coord); - regfile_ptr useRegFile(const glm::ivec3& coord); - regfile_ptr createRegFile(const glm::ivec3& coord); + regfile_ptr useRegFile(glm::ivec3 coord); + regfile_ptr createRegFile(glm::ivec3 coord); fs::path getRegionFilename(int x, int y) const; @@ -172,7 +172,7 @@ public: ~WorldRegions(); /// @brief Put all chunk data to regions - void put(Chunk* chunk, const std::vector& entitiesData); + void put(Chunk* chunk, std::vector entitiesData); /// @brief Store data in specified region /// @param x chunk.x diff --git a/src/files/engine_paths.cpp b/src/files/engine_paths.cpp index 00bc7670..c08d6bd2 100644 --- a/src/files/engine_paths.cpp +++ b/src/files/engine_paths.cpp @@ -214,7 +214,7 @@ std::vector ResPaths::listdirRaw(const std::string& folderName) con continue; for (const auto& entry : fs::directory_iterator(folder)) { auto name = entry.path().filename().u8string(); - entries.emplace_back(root.name+":"+folderName+"/"+name); + entries.push_back(root.name+":"+folderName+"/"+name); } } { @@ -223,7 +223,7 @@ std::vector ResPaths::listdirRaw(const std::string& folderName) con return entries; for (const auto& entry : fs::directory_iterator(folder)) { auto name = entry.path().filename().u8string(); - entries.emplace_back("core:"+folderName+"/"+name); + entries.push_back("core:"+folderName+"/"+name); } } return entries; diff --git a/src/files/files.cpp b/src/files/files.cpp index 3c0a7fe4..4c4d4ffd 100644 --- a/src/files/files.cpp +++ b/src/files/files.cpp @@ -103,7 +103,7 @@ std::string files::read_string(const fs::path& filename) { return std::string((const char*)bytes.get(), size); } -bool files::write_string(const fs::path& filename, const std::string& content) { +bool files::write_string(const fs::path& filename, const std::string content) { std::ofstream file(filename); if (!file) { return false; diff --git a/src/files/files.hpp b/src/files/files.hpp index 5c3cd0b2..1a124b25 100644 --- a/src/files/files.hpp +++ b/src/files/files.hpp @@ -40,7 +40,7 @@ namespace files { uint append_bytes(const fs::path& file, const ubyte* data, size_t size); /// @brief Write string to the file - bool write_string(const fs::path& filename, const std::string& content); + bool write_string(const fs::path& filename, const std::string content); /// @brief Write dynamic data to the JSON file /// @param nice if true, human readable format will be used, otherwise minimal diff --git a/src/frontend/ContentGfxCache.cpp b/src/frontend/ContentGfxCache.cpp index 4de80069..b18492fd 100644 --- a/src/frontend/ContentGfxCache.cpp +++ b/src/frontend/ContentGfxCache.cpp @@ -38,7 +38,8 @@ ContentGfxCache::ContentGfxCache(const Content* content, Assets* assets) : conte } } -ContentGfxCache::~ContentGfxCache() = default; +ContentGfxCache::~ContentGfxCache() { +} const Content* ContentGfxCache::getContent() const { return content; diff --git a/src/frontend/LevelFrontend.cpp b/src/frontend/LevelFrontend.cpp index e5cadff5..067b71a3 100644 --- a/src/frontend/LevelFrontend.cpp +++ b/src/frontend/LevelFrontend.cpp @@ -81,7 +81,8 @@ LevelFrontend::LevelFrontend( ); } -LevelFrontend::~LevelFrontend() = default; +LevelFrontend::~LevelFrontend() { +} Level* LevelFrontend::getLevel() const { return level; diff --git a/src/frontend/hud.cpp b/src/frontend/hud.cpp index 2983f1af..055ae314 100644 --- a/src/frontend/hud.cpp +++ b/src/frontend/hud.cpp @@ -314,7 +314,7 @@ void Hud::openInventory() { } void Hud::openInventory( - const glm::ivec3& block, + glm::ivec3 block, UiDocument* doc, std::shared_ptr blockinv, bool playerInventory @@ -406,9 +406,9 @@ void Hud::add(const HudElement& element) { using namespace dynamic; gui->add(element.getNode()); + auto invview = std::dynamic_pointer_cast(element.getNode()); auto document = element.getDocument(); if (document) { - auto invview = std::dynamic_pointer_cast(element.getNode()); auto inventory = invview ? invview->getInventory() : nullptr; std::vector args; args.emplace_back(inventory ? inventory.get()->getId() : 0); diff --git a/src/frontend/hud.hpp b/src/frontend/hud.hpp index e296d9ac..a2a778ed 100644 --- a/src/frontend/hud.hpp +++ b/src/frontend/hud.hpp @@ -140,12 +140,12 @@ public: /// @brief Show block inventory in inventory-mode /// @param block block position /// @param doc block ui layout - /// @param blockinv block inventory + /// @param blockInv block inventory /// @param playerInventory show player inventory too void openInventory( - const glm::ivec3& block, + glm::ivec3 block, UiDocument* doc, - std::shared_ptr blockinv, + std::shared_ptr blockInv, bool playerInventory ); diff --git a/src/frontend/locale.cpp b/src/frontend/locale.cpp index f4f08a26..e20b3059 100644 --- a/src/frontend/locale.cpp +++ b/src/frontend/locale.cpp @@ -146,7 +146,7 @@ void langs::load(const fs::path& resdir, if (locale != fallback) { load(resdir, locale, packs, *lang.get()); } - current = std::move(lang); + current.reset(lang.release()); } void langs::setup(const fs::path& resdir, diff --git a/src/graphics/core/Atlas.cpp b/src/graphics/core/Atlas.cpp index 6823757d..7d8f7a31 100644 --- a/src/graphics/core/Atlas.cpp +++ b/src/graphics/core/Atlas.cpp @@ -19,7 +19,8 @@ Atlas::Atlas( } } -Atlas::~Atlas() = default; +Atlas::~Atlas() { +} void Atlas::prepare() { texture = Texture::from(image.get()); diff --git a/src/graphics/core/Atlas.hpp b/src/graphics/core/Atlas.hpp index 827f6d0a..8e8a7b33 100644 --- a/src/graphics/core/Atlas.hpp +++ b/src/graphics/core/Atlas.hpp @@ -47,7 +47,7 @@ class AtlasBuilder { std::vector entries; std::set names; public: - AtlasBuilder() = default; + AtlasBuilder() {} void add(const std::string& name, std::unique_ptr image); bool has(const std::string& name) const; const std::set& getNames() { return names; }; diff --git a/src/graphics/core/Batch2D.cpp b/src/graphics/core/Batch2D.cpp index c3521b76..387fa4da 100644 --- a/src/graphics/core/Batch2D.cpp +++ b/src/graphics/core/Batch2D.cpp @@ -59,8 +59,8 @@ void Batch2D::vertex( buffer[index++] = a; } void Batch2D::vertex( - const glm::vec2& point, - const glm::vec2& uvpoint, + glm::vec2 point, + glm::vec2 uvpoint, float r, float g, float b, float a ) { buffer[index++] = point.x; @@ -138,7 +138,7 @@ void Batch2D::rect( UVRegion region, bool flippedX, bool flippedY, - const glm::vec4& tint + glm::vec4 tint ) { if (index + 6*B2D_VERTEX_SIZE >= capacity) { flush(); @@ -322,13 +322,11 @@ void Batch2D::rect( vertex(v1, glm::vec2(0, 0), r2,g2,b2,1.0f); } -void Batch2D::sprite(float x, float y, float w, float h, const UVRegion& region, - const glm::vec4& tint){ +void Batch2D::sprite(float x, float y, float w, float h, const UVRegion& region, glm::vec4 tint){ rect(x, y, w, h, region.u1, region.v1, region.u2-region.u1, region.v2-region.v1, tint.r, tint.g, tint.b, tint.a); } -void Batch2D::sprite(float x, float y, float w, float h, int atlasRes, int index, - const glm::vec4& tint){ +void Batch2D::sprite(float x, float y, float w, float h, int atlasRes, int index, glm::vec4 tint){ float scale = 1.0f / (float)atlasRes; float u = (index % atlasRes) * scale; float v = 1.0f - ((index / atlasRes) * scale) - scale; diff --git a/src/graphics/core/Batch2D.hpp b/src/graphics/core/Batch2D.hpp index 1e72a65f..ed8f9f70 100644 --- a/src/graphics/core/Batch2D.hpp +++ b/src/graphics/core/Batch2D.hpp @@ -31,8 +31,8 @@ class Batch2D : public Flushable { ); void vertex( - const glm::vec2& point, - const glm::vec2& uvpoint, + glm::vec2 point, + glm::vec2 uvpoint, float r, float g, float b, float a ); @@ -44,13 +44,11 @@ public: void texture(Texture* texture); void untexture(); void setRegion(UVRegion region); - void sprite(float x, float y, float w, float h, const UVRegion& region, - const glm::vec4& tint); - void sprite(float x, float y, float w, float h, int atlasRes, int index, - const glm::vec4& tint); + void sprite(float x, float y, float w, float h, const UVRegion& region, glm::vec4 tint); + void sprite(float x, float y, float w, float h, int atlasRes, int index, glm::vec4 tint); void point(float x, float y, float r, float g, float b, float a); - inline void setColor(const glm::vec4& color) { + inline void setColor(glm::vec4 color) { this->color = color; } inline glm::vec4 getColor() const { @@ -71,7 +69,7 @@ public: float ox, float oy, float angle, UVRegion region, bool flippedX, bool flippedY, - const glm::vec4& tint + glm::vec4 tint ); void rect(float x, float y, float w, float h); diff --git a/src/graphics/core/Batch3D.cpp b/src/graphics/core/Batch3D.cpp index 979347c6..c25d6f0b 100644 --- a/src/graphics/core/Batch3D.cpp +++ b/src/graphics/core/Batch3D.cpp @@ -51,7 +51,7 @@ void Batch3D::vertex( buffer[index++] = a; } void Batch3D::vertex( - const glm::vec3& coord, float u, float v, + glm::vec3 coord, float u, float v, float r, float g, float b, float a ) { buffer[index++] = coord.x; @@ -65,8 +65,8 @@ void Batch3D::vertex( buffer[index++] = a; } void Batch3D::vertex( - const glm::vec3& point, - const glm::vec2& uvpoint, + glm::vec3 point, + glm::vec2 uvpoint, float r, float g, float b, float a ) { buffer[index++] = point.x; @@ -118,12 +118,12 @@ void Batch3D::texture(Texture* new_texture){ } void Batch3D::sprite( - const glm::vec3& pos, - const glm::vec3& up, - const glm::vec3& right, + glm::vec3 pos, + glm::vec3 up, + glm::vec3 right, float w, float h, - const UVRegion& uv, - const glm::vec4& color + const UVRegion& uv, + glm::vec4 color ){ const float r = color.r; const float g = color.g; @@ -245,11 +245,11 @@ void Batch3D::blockCube( cube((1.0f - size) * -0.5f, size, texfaces, tint, shading); } -void Batch3D::point(const glm::vec3& coord, const glm::vec2& uv, const glm::vec4& tint) { +void Batch3D::point(glm::vec3 coord, glm::vec2 uv, glm::vec4 tint) { vertex(coord, uv, tint.r, tint.g, tint.b, tint.a); } -void Batch3D::point(const glm::vec3& coord, const glm::vec4& tint) { +void Batch3D::point(glm::vec3 coord, glm::vec4 tint) { point(coord, glm::vec2(), tint); } diff --git a/src/graphics/core/Batch3D.hpp b/src/graphics/core/Batch3D.hpp index 93bd0b64..79b17697 100644 --- a/src/graphics/core/Batch3D.hpp +++ b/src/graphics/core/Batch3D.hpp @@ -27,13 +27,12 @@ class Batch3D : public Flushable { float r, float g, float b, float a ); void vertex( - const glm::vec3& coord, + glm::vec3 coord, float u, float v, float r, float g, float b, float a ); void vertex( - const glm::vec3& point, - const glm::vec2& uvpoint, + glm::vec3 point, glm::vec2 uvpoint, float r, float g, float b, float a ); void face( @@ -50,18 +49,12 @@ public: void begin(); void texture(Texture* texture); - void sprite( - const glm::vec3& pos, - const glm::vec3& up, - const glm::vec3& right, float w, float h, const UVRegion& uv, - const glm::vec4& color - ); + void sprite(glm::vec3 pos, glm::vec3 up, glm::vec3 right, float w, float h, const UVRegion& uv, glm::vec4 tint); void xSprite(float w, float h, const UVRegion& uv, const glm::vec4 tint, bool shading=true); void cube(const glm::vec3 coords, const glm::vec3 size, const UVRegion(&texfaces)[6], const glm::vec4 tint, bool shading=true); void blockCube(const glm::vec3 size, const UVRegion(&texfaces)[6], const glm::vec4 tint, bool shading=true); - void point( - const glm::vec3& coord, const glm::vec2& uv, const glm::vec4& tint); - void point(const glm::vec3& coord, const glm::vec4& tint); + void point(glm::vec3 pos, glm::vec2 uv, glm::vec4 tint); + void point(glm::vec3 pos, glm::vec4 tint); void flush() override; void flushPoints(); }; diff --git a/src/graphics/core/DrawContext.cpp b/src/graphics/core/DrawContext.cpp index 0f07db3d..68b31125 100644 --- a/src/graphics/core/DrawContext.cpp +++ b/src/graphics/core/DrawContext.cpp @@ -148,7 +148,7 @@ void DrawContext::setBlendMode(BlendMode mode) { set_blend_mode(mode); } -void DrawContext::setScissors(const glm::vec4& area) { +void DrawContext::setScissors(glm::vec4 area) { Window::pushScissor(area); scissorsCount++; } diff --git a/src/graphics/core/DrawContext.hpp b/src/graphics/core/DrawContext.hpp index ffe05a37..ea152f20 100644 --- a/src/graphics/core/DrawContext.hpp +++ b/src/graphics/core/DrawContext.hpp @@ -35,7 +35,7 @@ public: void setDepthTest(bool flag); void setCullFace(bool flag); void setBlendMode(BlendMode mode); - void setScissors(const glm::vec4& area); + void setScissors(glm::vec4 area); void setLineWidth(float width); }; diff --git a/src/graphics/core/Font.cpp b/src/graphics/core/Font.cpp index ca94bd8b..14a05296 100644 --- a/src/graphics/core/Font.cpp +++ b/src/graphics/core/Font.cpp @@ -12,7 +12,8 @@ Font::Font(std::vector> pages, int lineHeight, int yoff : lineHeight(lineHeight), yoffset(yoffset), pages(std::move(pages)) { } -Font::~Font() = default; +Font::~Font(){ +} int Font::getYOffset() const { return yoffset; diff --git a/src/graphics/core/ImageData.cpp b/src/graphics/core/ImageData.cpp index ee40bafc..6499afb4 100644 --- a/src/graphics/core/ImageData.cpp +++ b/src/graphics/core/ImageData.cpp @@ -41,7 +41,8 @@ ImageData::ImageData(ImageFormat format, uint width, uint height, const ubyte* d std::memcpy(this->data.get(), data, width * height * pixsize); } -ImageData::~ImageData() = default; +ImageData::~ImageData() { +} void ImageData::flipX() { switch (format) { diff --git a/src/graphics/core/LineBatch.hpp b/src/graphics/core/LineBatch.hpp index b3dc689a..a31b827d 100644 --- a/src/graphics/core/LineBatch.hpp +++ b/src/graphics/core/LineBatch.hpp @@ -18,7 +18,7 @@ public: LineBatch(size_t capacity=4096); ~LineBatch(); - inline void line(const glm::vec3 &a, const glm::vec3 &b, const glm::vec4 &color) { + inline void line(const glm::vec3 a, const glm::vec3 b, const glm::vec4 color) { line(a.x, a.y, a.z, b.x, b.y, b.z, color.r, color.g, color.b, color.a); } void line(float x1, float y1, float z1, float x2, float y2, float z2, @@ -26,7 +26,7 @@ public: void box(float x, float y, float z, float w, float h, float d, float r, float g, float b, float a); - inline void box(const glm::vec3 &xyz, const glm::vec3 &whd, const glm::vec4 &rgba) { + inline void box(glm::vec3 xyz, glm::vec3 whd, glm::vec4 rgba) { box(xyz.x, xyz.y, xyz.z, whd.x, whd.y, whd.z, rgba.r, rgba.g, rgba.b, rgba.a); } diff --git a/src/graphics/core/Model.cpp b/src/graphics/core/Model.cpp index ee58fefc..78e15354 100644 --- a/src/graphics/core/Model.cpp +++ b/src/graphics/core/Model.cpp @@ -8,11 +8,7 @@ inline constexpr glm::vec3 X(1, 0, 0); inline constexpr glm::vec3 Y(0, 1, 0); inline constexpr glm::vec3 Z(0, 0, 1); -void Mesh::addPlane( - const glm::vec3 &pos, - const glm::vec3 &right, - const glm::vec3 &up, - const glm::vec3 &norm) { +void Mesh::addPlane(glm::vec3 pos, glm::vec3 right, glm::vec3 up, glm::vec3 norm) { vertices.push_back({pos-right-up, {0,0}, norm}); vertices.push_back({pos+right-up, {1,0}, norm}); vertices.push_back({pos+right+up, {1,1}, norm}); @@ -22,7 +18,7 @@ void Mesh::addPlane( vertices.push_back({pos-right+up, {0,1}, norm}); } -void Mesh::addBox(const glm::vec3 &pos, const glm::vec3 &size) { +void Mesh::addBox(glm::vec3 pos, glm::vec3 size) { addPlane(pos+Z*size, X*size, Y*size, Z); addPlane(pos-Z*size, -X*size, Y*size, -Z); diff --git a/src/graphics/core/Model.hpp b/src/graphics/core/Model.hpp index e7cae9fd..03d00826 100644 --- a/src/graphics/core/Model.hpp +++ b/src/graphics/core/Model.hpp @@ -16,12 +16,8 @@ namespace model { std::string texture; std::vector vertices; - void addPlane( - const glm::vec3& pos, - const glm::vec3& right, - const glm::vec3& up, - const glm::vec3& norm); - void addBox(const glm::vec3& pos, const glm::vec3& size); + void addPlane(glm::vec3 pos, glm::vec3 right, glm::vec3 up, glm::vec3 norm); + void addBox(glm::vec3 pos, glm::vec3 size); }; struct Model { diff --git a/src/graphics/core/PostProcessing.cpp b/src/graphics/core/PostProcessing.cpp index 7352c3b5..0498c5e7 100644 --- a/src/graphics/core/PostProcessing.cpp +++ b/src/graphics/core/PostProcessing.cpp @@ -18,7 +18,8 @@ PostProcessing::PostProcessing() { quadMesh = std::make_unique(vertices, 6, attrs); } -PostProcessing::~PostProcessing() = default; +PostProcessing::~PostProcessing() { +} void PostProcessing::use(DrawContext& context) { const auto& vp = context.getViewport(); diff --git a/src/graphics/core/Shader.cpp b/src/graphics/core/Shader.cpp index 5917e834..62d82ee3 100644 --- a/src/graphics/core/Shader.cpp +++ b/src/graphics/core/Shader.cpp @@ -32,7 +32,7 @@ uint Shader::getUniformLocation(const std::string& name) { auto found = uniformLocations.find(name); if (found == uniformLocations.end()) { uint location = glGetUniformLocation(id, name.c_str()); - uniformLocations.try_emplace(name, location); + uniformLocations.emplace(name, location); return location; } return found->second; @@ -54,11 +54,11 @@ void Shader::uniform2f(const std::string& name, float x, float y){ glUniform2f(getUniformLocation(name), x, y); } -void Shader::uniform2f(const std::string& name, const glm::vec2& xy){ +void Shader::uniform2f(const std::string& name, glm::vec2 xy){ glUniform2f(getUniformLocation(name), xy.x, xy.y); } -void Shader::uniform2i(const std::string& name, const glm::ivec2& xy){ +void Shader::uniform2i(const std::string& name, glm::ivec2 xy){ glUniform2i(getUniformLocation(name), xy.x, xy.y); } @@ -66,7 +66,7 @@ void Shader::uniform3f(const std::string& name, float x, float y, float z){ glUniform3f(getUniformLocation(name), x,y,z); } -void Shader::uniform3f(const std::string& name, const glm::vec3& xyz){ +void Shader::uniform3f(const std::string& name, glm::vec3 xyz){ glUniform3f(getUniformLocation(name), xyz.x, xyz.y, xyz.z); } diff --git a/src/graphics/core/Shader.hpp b/src/graphics/core/Shader.hpp index 2f5d8b89..25d182a5 100644 --- a/src/graphics/core/Shader.hpp +++ b/src/graphics/core/Shader.hpp @@ -26,10 +26,10 @@ public: void uniform1i(const std::string& name, int x); void uniform1f(const std::string& name, float x); void uniform2f(const std::string& name, float x, float y); - void uniform2f(const std::string& name, const glm::vec2& xy); - void uniform2i(const std::string& name, const glm::ivec2& xy); + void uniform2f(const std::string& name, glm::vec2 xy); + void uniform2i(const std::string& name, glm::ivec2 xy); void uniform3f(const std::string& name, float x, float y, float z); - void uniform3f(const std::string& name, const glm::vec3& xyz); + void uniform3f(const std::string& name, glm::vec3 xyz); /// @brief Create shader program using vertex and fragment shaders source. /// @param vertexFile vertex shader file name diff --git a/src/graphics/core/TextureAnimation.hpp b/src/graphics/core/TextureAnimation.hpp index 839566bd..ac6eb3b7 100644 --- a/src/graphics/core/TextureAnimation.hpp +++ b/src/graphics/core/TextureAnimation.hpp @@ -22,7 +22,7 @@ struct Frame { class TextureAnimation { public: TextureAnimation(Texture* srcTex, Texture* dstTex) : srcTexture(srcTex), dstTexture(dstTex) {}; - ~TextureAnimation() = default; + ~TextureAnimation() {}; void addFrame(const Frame& frame) { frames.emplace_back(frame); }; diff --git a/src/graphics/render/BlocksPreview.cpp b/src/graphics/render/BlocksPreview.cpp index 3f3cce33..fa62e318 100644 --- a/src/graphics/render/BlocksPreview.cpp +++ b/src/graphics/render/BlocksPreview.cpp @@ -50,10 +50,9 @@ std::unique_ptr BlocksPreview::draw( } offset = glm::vec3(1, 1, 0.0f); shader->uniformMatrix("u_apply", glm::translate(glm::mat4(1.0f), offset)); - glm::vec3 scaledSize = glm::vec3(size * 0.63f); batch->cube( - -hitbox * scaledSize * 0.5f * glm::vec3(1,1,-1), - hitbox * scaledSize, + -hitbox * glm::vec3(size * 0.63f)*0.5f * glm::vec3(1,1,-1), + hitbox * glm::vec3(size * 0.63f), texfaces, glm::vec4(1.0f), !def->rt.emissive ); diff --git a/src/graphics/render/ModelBatch.cpp b/src/graphics/render/ModelBatch.cpp index fd9d24c5..c5130402 100644 --- a/src/graphics/render/ModelBatch.cpp +++ b/src/graphics/render/ModelBatch.cpp @@ -35,7 +35,7 @@ struct DecomposedMat4 { glm::vec4 perspective; }; -static glm::mat4 extract_rotation(const glm::mat4& matrix) { +static glm::mat4 extract_rotation(glm::mat4 matrix) { DecomposedMat4 decomposed = {}; glm::quat rotation; glm::decompose( @@ -64,12 +64,11 @@ ModelBatch::ModelBatch(size_t capacity, Assets* assets, Chunks* chunks) blank = Texture::from(&image); } -ModelBatch::~ModelBatch() = default; +ModelBatch::~ModelBatch() { +} -void ModelBatch::draw(const model::Mesh& mesh, - const glm::mat4& matrix, - const glm::mat3& rotation, - const glm::vec3& tint, +void ModelBatch::draw(const model::Mesh& mesh, const glm::mat4& matrix, + const glm::mat3& rotation, glm::vec3 tint, const texture_names_map* varTextures) { glm::vec3 gpos = matrix * glm::vec4(0.0f, 0.0f, 0.0f, 1.0f); light_t light = chunks->getLight(floor(gpos.x), floor(gpos.y), floor(gpos.z)); @@ -96,9 +95,8 @@ void ModelBatch::draw(const model::Mesh& mesh, } } -void ModelBatch::draw( - const glm::mat4& matrix, - const glm::vec3& tint, +void ModelBatch::draw(glm::mat4 matrix, + glm::vec3 tint, const model::Model* model, const texture_names_map* varTextures) { for (const auto& mesh : model->meshes) { diff --git a/src/graphics/render/ModelBatch.hpp b/src/graphics/render/ModelBatch.hpp index c34f9369..69608ddc 100644 --- a/src/graphics/render/ModelBatch.hpp +++ b/src/graphics/render/ModelBatch.hpp @@ -37,10 +37,7 @@ class ModelBatch { static inline glm::vec3 SUN_VECTOR {0.411934f, 0.863868f, -0.279161f}; inline void vertex( - const glm::vec3& pos, - const glm::vec2& uv, - const glm::vec4& light, - const glm::vec3& tint + glm::vec3 pos, glm::vec2 uv, glm::vec4 light, glm::vec3 tint ) { float* buffer = this->buffer.get(); buffer[index++] = pos.x; @@ -67,8 +64,8 @@ class ModelBatch { void draw(const model::Mesh& mesh, const glm::mat4& matrix, - const glm::mat3& rotation, - const glm::vec3& tint, + const glm::mat3& rotation, + glm::vec3 tint, const texture_names_map* varTextures); void setTexture(const std::string& name, const texture_names_map* varTextures); @@ -87,9 +84,8 @@ public: ModelBatch(size_t capacity, Assets* assets, Chunks* chunks); ~ModelBatch(); - void draw( - const glm::mat4& matrix, - const glm::vec3& tint, + void draw(glm::mat4 matrix, + glm::vec3 tint, const model::Model* model, const texture_names_map* varTextures); void render(); diff --git a/src/graphics/render/Skybox.cpp b/src/graphics/render/Skybox.cpp index 029f0b8b..49310609 100644 --- a/src/graphics/render/Skybox.cpp +++ b/src/graphics/render/Skybox.cpp @@ -55,7 +55,8 @@ Skybox::Skybox(uint size, Shader* shader) }); } -Skybox::~Skybox() = default; +Skybox::~Skybox() { +} void Skybox::drawBackground(Camera* camera, Assets* assets, int width, int height) { auto backShader = assets->get("background"); diff --git a/src/graphics/render/WorldRenderer.cpp b/src/graphics/render/WorldRenderer.cpp index 64212271..73a10047 100644 --- a/src/graphics/render/WorldRenderer.cpp +++ b/src/graphics/render/WorldRenderer.cpp @@ -75,7 +75,8 @@ WorldRenderer::WorldRenderer(Engine* engine, LevelFrontend* frontend, Player* pl ); } -WorldRenderer::~WorldRenderer() = default; +WorldRenderer::~WorldRenderer() { +} bool WorldRenderer::drawChunk( size_t index, @@ -230,29 +231,26 @@ void WorldRenderer::renderBlockSelection() { : block->hitboxes; lineBatch->lineWidth(2.0f); - constexpr auto boxOffset = glm::vec3(0.02); - constexpr auto boxColor = glm::vec4(0.f, 0.f, 0.f, 0.5f); for (auto& hitbox: hitboxes) { const glm::vec3 center = glm::vec3(pos) + hitbox.center(); const glm::vec3 size = hitbox.size(); - lineBatch->box(center, size + boxOffset, boxColor); + lineBatch->box(center, size + glm::vec3(0.02), glm::vec4(0.f, 0.f, 0.f, 0.5f)); if (player->debug) { lineBatch->line(point, point+norm*0.5f, glm::vec4(1.0f, 0.0f, 1.0f, 1.0f)); } } - lineBatch->flush(); } void WorldRenderer::renderLines( Camera* camera, Shader* linesShader, const DrawContext& pctx ) { + auto ctx = pctx.sub(lineBatch.get()); linesShader->use(); linesShader->uniformMatrix("u_projview", camera->getProjView()); if (player->selection.vox.id != BLOCK_VOID) { renderBlockSelection(); } if (player->debug && showEntitiesDebug) { - auto ctx = pctx.sub(lineBatch.get()); level->entities->renderDebug(*lineBatch, *frustumCulling, ctx); } } @@ -343,12 +341,12 @@ void WorldRenderer::draw( ctx.setDepthTest(true); ctx.setCullFace(true); renderLevel(ctx, camera, settings, delta, pause); - + // Debug lines if (hudVisible){ renderLines(camera, linesShader, ctx); } } - // Debug lines + if (hudVisible && player->debug) { renderDebugLines(wctx, camera, linesShader); } diff --git a/src/graphics/ui/GUI.cpp b/src/graphics/ui/GUI.cpp index 40ae9bf5..13f32a38 100644 --- a/src/graphics/ui/GUI.cpp +++ b/src/graphics/ui/GUI.cpp @@ -44,7 +44,8 @@ GUI::GUI() { container->add(tooltip); } -GUI::~GUI() = default; +GUI::~GUI() { +} std::shared_ptr GUI::getMenu() { return menu; diff --git a/src/graphics/ui/elements/InventoryView.cpp b/src/graphics/ui/elements/InventoryView.cpp index 8ae93eab..de121327 100644 --- a/src/graphics/ui/elements/InventoryView.cpp +++ b/src/graphics/ui/elements/InventoryView.cpp @@ -52,7 +52,7 @@ InventoryBuilder::InventoryBuilder() { void InventoryBuilder::addGrid( int cols, int count, - const glm::vec2 &pos, + glm::vec2 pos, int padding, bool addpanel, const SlotLayout& slotLayout @@ -126,7 +126,7 @@ void SlotView::draw(const DrawContext* pctx, Assets* assets) { langs::get(util::str2wstr_utf8(def->caption)) ); } else { - tooltip.clear(); + tooltip = L""; } } prevItem = itemid; @@ -381,7 +381,7 @@ void InventoryView::setPos(glm::vec2 pos) { Container::setPos(pos - origin); } -void InventoryView::setOrigin(const glm::vec2 &origin) { +void InventoryView::setOrigin(glm::vec2 origin) { this->origin = origin; } diff --git a/src/graphics/ui/elements/InventoryView.hpp b/src/graphics/ui/elements/InventoryView.hpp index 9aafd51b..476b4d99 100644 --- a/src/graphics/ui/elements/InventoryView.hpp +++ b/src/graphics/ui/elements/InventoryView.hpp @@ -93,7 +93,7 @@ namespace gui { virtual void setPos(glm::vec2 pos) override; - void setOrigin(const glm::vec2 &origin); + void setOrigin(glm::vec2 origin); glm::vec2 getOrigin() const; void setSelected(int index); @@ -130,7 +130,7 @@ namespace gui { /// @param slotLayout slot settings (index and position are ignored) void addGrid( int cols, int count, - const glm::vec2 &pos, + glm::vec2 pos, int padding, bool addpanel, const SlotLayout& slotLayout diff --git a/src/graphics/ui/elements/Label.cpp b/src/graphics/ui/elements/Label.cpp index e2fd44db..ac31e2a9 100644 --- a/src/graphics/ui/elements/Label.cpp +++ b/src/graphics/ui/elements/Label.cpp @@ -145,7 +145,7 @@ uint Label::getLineByYOffset(int offset) const { uint Label::getLineByTextIndex(size_t index) const { for (size_t i = 0; i < cache.lines.size(); i++) { - if (cache.lines[i].offset > index) { + if (cache.lines.at(i).offset > index) { return i-1; } } @@ -195,7 +195,7 @@ void Label::draw(const DrawContext* pctx, Assets* assets) { if (multiline) { for (size_t i = 0; i < cache.lines.size(); i++) { - auto& line = cache.lines[i]; + auto& line = cache.lines.at(i); size_t offset = line.offset; std::wstring_view view(text.c_str()+offset, text.length()-offset); if (i < cache.lines.size()-1) { diff --git a/src/graphics/ui/gui_xml.cpp b/src/graphics/ui/gui_xml.cpp index 7b0bd0d5..297ee4ac 100644 --- a/src/graphics/ui/gui_xml.cpp +++ b/src/graphics/ui/gui_xml.cpp @@ -203,7 +203,7 @@ static void _readPanel(UiXmlReader& reader, const xml::xmlelement& element, Pane panel.setMaxLength(element->attr("max-length").asInt()); } if (element->has("orientation")) { - const auto &oname = element->attr("orientation").getText(); + auto oname = element->attr("orientation").getText(); if (oname == "horizontal") { panel.setOrientation(Orientation::horizontal); } @@ -286,7 +286,7 @@ static std::shared_ptr readButton(UiXmlReader& reader, const xml::xmlele std::shared_ptr