diff --git a/src/audio/AL/ALAudio.cpp b/src/audio/AL/ALAudio.cpp index c2e34b11..05cd4c56 100644 --- a/src/audio/AL/ALAudio.cpp +++ b/src/audio/AL/ALAudio.cpp @@ -458,7 +458,7 @@ std::vector ALAudio::getAvailableDevices() const { const char* ptr = devices; do { - devicesVec.push_back(std::string(ptr)); + devicesVec.emplace_back(ptr); ptr += devicesVec.back().size() + 1; } while (ptr[0]); diff --git a/src/content/ContentLUT.cpp b/src/content/ContentLUT.cpp index 779277d5..bb7ed390 100644 --- a/src/content/ContentLUT.cpp +++ b/src/content/ContentLUT.cpp @@ -19,7 +19,7 @@ ContentLUT::ContentLUT(const Content* content, size_t blocksCount, size_t itemsC blockNames.push_back(indices->getBlockDef(i)->name); } for (size_t i = indices->countBlockDefs(); i < blocksCount; i++) { - blockNames.push_back(""); + blockNames.emplace_back(""); } for (size_t i = 0; i < itemsCount; i++) { @@ -29,7 +29,7 @@ ContentLUT::ContentLUT(const Content* content, size_t blocksCount, size_t itemsC itemNames.push_back(indices->getItemDef(i)->name); } for (size_t i = indices->countItemDefs(); i < itemsCount; i++) { - itemNames.push_back(""); + itemNames.emplace_back(); } } diff --git a/src/content/ContentLoader.cpp b/src/content/ContentLoader.cpp index edf2277c..fb04c1b1 100644 --- a/src/content/ContentLoader.cpp +++ b/src/content/ContentLoader.cpp @@ -244,7 +244,7 @@ void ContentLoader::loadCustomBlockModel(Block& def, dynamic::Map* primitives) { } else for (uint j = 6; j < 12; j++) { - def.modelTextures.push_back("notfound"); + def.modelTextures.emplace_back("notfound"); } } } diff --git a/src/frontend/hud.cpp b/src/frontend/hud.cpp index dd319396..03844027 100644 --- a/src/frontend/hud.cpp +++ b/src/frontend/hud.cpp @@ -408,9 +408,9 @@ void Hud::add(const HudElement& element) { if (document) { auto inventory = invview ? invview->getInventory() : nullptr; std::vector args; - args.push_back(inventory ? inventory.get()->getId() : 0); + args.emplace_back(inventory ? inventory.get()->getId() : 0); for (int i = 0; i < 3; i++) { - args.push_back(static_cast(blockPos[i])); + args.emplace_back(static_cast(blockPos[i])); } scripting::on_ui_open( element.getDocument(), diff --git a/src/frontend/menu.cpp b/src/frontend/menu.cpp index 44e4fb9c..f2c8ae31 100644 --- a/src/frontend/menu.cpp +++ b/src/frontend/menu.cpp @@ -54,7 +54,7 @@ gui::page_loader_func menus::create_page_loader(Engine* engine) { auto value = std::string(parser.readUntil('&')); map->put(key, value); } - args.push_back(map); + args.emplace_back(map); } else { name = query; } diff --git a/src/graphics/ui/gui_xml.cpp b/src/graphics/ui/gui_xml.cpp index c70ffd71..94a0522d 100644 --- a/src/graphics/ui/gui_xml.cpp +++ b/src/graphics/ui/gui_xml.cpp @@ -546,7 +546,7 @@ static std::shared_ptr readPageBox(UiXmlReader& reader, const xml::xmlel } UiXmlReader::UiXmlReader(const scriptenv& env) : env(env) { - contextStack.push(""); + contextStack.emplace(""); add("image", readImage); add("label", readLabel); add("panel", readPanel); diff --git a/src/items/Inventory.cpp b/src/items/Inventory.cpp index c8ce5aac..e09dad45 100644 --- a/src/items/Inventory.cpp +++ b/src/items/Inventory.cpp @@ -54,7 +54,7 @@ void Inventory::deserialize(dynamic::Map* src) { auto slotsarr = src->list("slots"); size_t slotscount = slotsarr->size(); while (slots.size() < slotscount) { - slots.push_back(ItemStack()); + slots.emplace_back(); } for (size_t i = 0; i < slotscount; i++) { auto item = slotsarr->map(i); diff --git a/src/logic/scripting/lua/libcore.cpp b/src/logic/scripting/lua/libcore.cpp index b457befb..068c8824 100644 --- a/src/logic/scripting/lua/libcore.cpp +++ b/src/logic/scripting/lua/libcore.cpp @@ -81,7 +81,7 @@ static int l_reconfig_packs(lua_State* L) { int addLen = lua_objlen(L, 1); for (int i = 0; i < addLen; i++) { lua_rawgeti(L, 1, i+1); - addPacks.push_back(lua_tostring(L, -1)); + addPacks.emplace_back(lua_tostring(L, -1)); lua_pop(L, 1); } @@ -92,7 +92,7 @@ static int l_reconfig_packs(lua_State* L) { int remLen = lua_objlen(L, 2); for (int i = 0; i < remLen; i++) { lua_rawgeti(L, 2, i+1); - remPacks.push_back(lua_tostring(L, -1)); + remPacks.emplace_back(lua_tostring(L, -1)); lua_pop(L, 1); } auto controller = scripting::engine->getController(); diff --git a/src/util/stringutil.cpp b/src/util/stringutil.cpp index 3d894eaa..bc155c6a 100644 --- a/src/util/stringutil.cpp +++ b/src/util/stringutil.cpp @@ -403,7 +403,7 @@ std::vector util::split(const std::string& str, char delimiter) { result.push_back(tmp); } if (result.empty()) { - result.push_back(""); + result.emplace_back(""); } return result; } @@ -420,7 +420,7 @@ std::vector util::split(const std::wstring& str, char delimiter) { result.push_back(tmp); } if (result.empty()) { - result.push_back(L""); + result.emplace_back(L""); } return result; }