From 065ed5138e51468f916cfbe1e8f5a225e9859eca Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 17 Oct 2020 12:26:35 +0400 Subject: [PATCH] Use emplace_back instead of push_back --- apps/mwiniimporter/importer.cpp | 4 +- apps/opencs/editor.cpp | 4 +- apps/opencs/model/doc/loader.cpp | 2 +- apps/opencs/model/doc/operation.cpp | 2 +- apps/opencs/model/prefs/enumsetting.cpp | 2 +- .../model/prefs/shortcuteventhandler.cpp | 2 +- apps/opencs/model/world/commanddispatcher.cpp | 2 +- apps/opencs/model/world/idtable.cpp | 6 +- apps/opencs/model/world/refidcollection.cpp | 215 +++++++++--------- apps/opencs/view/render/cell.cpp | 2 +- apps/opencs/view/render/worldspacewidget.cpp | 3 +- .../opencs/view/world/datadisplaydelegate.cpp | 2 +- apps/opencs/view/world/enumdelegate.cpp | 2 +- apps/opencs/view/world/regionmap.cpp | 10 +- apps/opencs/view/world/table.cpp | 4 +- apps/opencs/view/world/tablesubview.cpp | 4 +- apps/openmw/mwclass/npc.cpp | 8 +- apps/openmw/mwdialogue/dialoguemanagerimp.cpp | 2 +- apps/openmw/mwdialogue/hypertextparser.cpp | 4 +- apps/openmw/mwgui/birth.cpp | 2 +- apps/openmw/mwgui/bookpage.cpp | 4 +- apps/openmw/mwgui/class.cpp | 2 +- apps/openmw/mwgui/companionwindow.cpp | 4 +- apps/openmw/mwgui/containeritemmodel.cpp | 4 +- apps/openmw/mwgui/jailscreen.cpp | 2 +- apps/openmw/mwgui/mainmenu.cpp | 14 +- apps/openmw/mwgui/race.cpp | 2 +- apps/openmw/mwgui/settingswindow.cpp | 2 +- apps/openmw/mwgui/sortfilteritemmodel.cpp | 26 +-- apps/openmw/mwgui/soulgemdialog.cpp | 4 +- apps/openmw/mwgui/spellview.cpp | 10 +- apps/openmw/mwgui/trainingwindow.cpp | 2 +- apps/openmw/mwmechanics/actors.cpp | 2 +- .../mwmechanics/mechanicsmanagerimp.cpp | 2 +- apps/openmw/mwrender/animation.cpp | 16 +- apps/openmw/mwrender/localmap.cpp | 4 +- apps/openmw/mwrender/objectpaging.cpp | 2 +- apps/openmw/mwrender/renderingmanager.cpp | 2 +- apps/openmw/mwrender/sky.cpp | 70 +++--- apps/openmw/mwscript/globalscripts.cpp | 2 +- apps/openmw/mwscript/locals.cpp | 2 +- apps/openmw/mwsound/openal_output.cpp | 4 +- apps/openmw/mwstate/charactermanager.cpp | 2 +- apps/openmw/mwstate/statemanagerimp.cpp | 14 +- apps/openmw/mwworld/cellpreloader.cpp | 2 +- apps/openmw/mwworld/inventorystore.cpp | 2 +- apps/openmw/mwworld/localscripts.cpp | 2 +- apps/openmw/mwworld/projectilemanager.cpp | 2 +- apps/openmw/mwworld/scene.cpp | 4 +- apps/openmw/mwworld/store.cpp | 2 +- components/compiler/scanner.cpp | 2 +- components/esm/aisequence.cpp | 2 +- components/esm/inventorystate.cpp | 2 +- components/esm/locals.cpp | 2 +- components/files/escape.cpp | 2 +- components/nifosg/controller.cpp | 2 +- components/sceneutil/lightmanager.cpp | 2 +- components/sceneutil/mwshadowtechnique.cpp | 18 +- components/sceneutil/statesetupdater.cpp | 4 +- components/sceneutil/unrefqueue.cpp | 2 +- components/sceneutil/visitor.cpp | 8 +- components/shader/shadervisitor.cpp | 2 +- components/terrain/chunkmanager.cpp | 2 +- components/terrain/viewdata.cpp | 2 +- components/vfs/bsaarchive.cpp | 2 +- components/widgets/list.cpp | 2 +- 66 files changed, 273 insertions(+), 277 deletions(-) diff --git a/apps/mwiniimporter/importer.cpp b/apps/mwiniimporter/importer.cpp index 600b4917ac..3297a7b5ee 100644 --- a/apps/mwiniimporter/importer.cpp +++ b/apps/mwiniimporter/importer.cpp @@ -645,7 +645,7 @@ MwIniImporter::MwIniImporter() } for(int i=0; fallback[i]; i++) { - mMergeFallback.push_back(fallback[i]); + mMergeFallback.emplace_back(fallback[i]); } } @@ -910,7 +910,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini, co std::time_t time = lastWriteTime(path, defaultTime); if (time != defaultTime) { - contentFiles.push_back({time, path}); + contentFiles.emplace_back(time, std::move(path)); found = true; break; } diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 0c3d006c4f..37e1ffc9a0 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -229,7 +229,7 @@ void CS::Editor::openFiles (const boost::filesystem::path &savePath, const std:: if(discoveredFiles.empty()) { for (const QString &path : mFileDialog.selectedFilePaths()) - files.push_back(path.toUtf8().constData()); + files.emplace_back(path.toUtf8().constData()); } else { @@ -246,7 +246,7 @@ void CS::Editor::createNewFile (const boost::filesystem::path &savePath) std::vector files; for (const QString &path : mFileDialog.selectedFilePaths()) { - files.push_back(path.toUtf8().constData()); + files.emplace_back(path.toUtf8().constData()); } files.push_back (savePath); diff --git a/apps/opencs/model/doc/loader.cpp b/apps/opencs/model/doc/loader.cpp index 44d6883ef1..69c78bd5e4 100644 --- a/apps/opencs/model/doc/loader.cpp +++ b/apps/opencs/model/doc/loader.cpp @@ -127,7 +127,7 @@ void CSMDoc::Loader::load() void CSMDoc::Loader::loadDocument (CSMDoc::Document *document) { - mDocuments.push_back (std::make_pair (document, Stage())); + mDocuments.emplace_back (document, Stage()); } void CSMDoc::Loader::abortLoading (CSMDoc::Document *document) diff --git a/apps/opencs/model/doc/operation.cpp b/apps/opencs/model/doc/operation.cpp index a27ee9f514..218e13e38e 100644 --- a/apps/opencs/model/doc/operation.cpp +++ b/apps/opencs/model/doc/operation.cpp @@ -57,7 +57,7 @@ void CSMDoc::Operation::run() void CSMDoc::Operation::appendStage (Stage *stage) { - mStages.push_back (std::make_pair (stage, 0)); + mStages.emplace_back (stage, 0); } void CSMDoc::Operation::setDefaultSeverity (Message::Severity severity) diff --git a/apps/opencs/model/prefs/enumsetting.cpp b/apps/opencs/model/prefs/enumsetting.cpp index 226b171735..62cac062a7 100644 --- a/apps/opencs/model/prefs/enumsetting.cpp +++ b/apps/opencs/model/prefs/enumsetting.cpp @@ -35,7 +35,7 @@ CSMPrefs::EnumValues& CSMPrefs::EnumValues::add (const EnumValue& value) CSMPrefs::EnumValues& CSMPrefs::EnumValues::add (const std::string& value, const std::string& tooltip) { - mValues.push_back (EnumValue (value, tooltip)); + mValues.emplace_back(value, tooltip); return *this; } diff --git a/apps/opencs/model/prefs/shortcuteventhandler.cpp b/apps/opencs/model/prefs/shortcuteventhandler.cpp index 07c48fcaa8..a4102e1db9 100644 --- a/apps/opencs/model/prefs/shortcuteventhandler.cpp +++ b/apps/opencs/model/prefs/shortcuteventhandler.cpp @@ -182,7 +182,7 @@ namespace CSMPrefs } else if (pos == lastPos) { - potentials.push_back(std::make_pair(result, shortcut)); + potentials.emplace_back(result, shortcut); } } } diff --git a/apps/opencs/model/world/commanddispatcher.cpp b/apps/opencs/model/world/commanddispatcher.cpp index 2493813a61..36b3ba2e00 100644 --- a/apps/opencs/model/world/commanddispatcher.cpp +++ b/apps/opencs/model/world/commanddispatcher.cpp @@ -127,7 +127,7 @@ std::vector CSMWorld::CommandDispatcher::getExtendedTypes if (mId==UniversalId::Type_Cells) { tables.push_back (mId); - tables.push_back (UniversalId::Type_References); + tables.emplace_back(UniversalId::Type_References); /// \todo add other cell-specific types } diff --git a/apps/opencs/model/world/idtable.cpp b/apps/opencs/model/world/idtable.cpp index bc5a8e69d5..27d60ae98d 100644 --- a/apps/opencs/model/world/idtable.cpp +++ b/apps/opencs/model/world/idtable.cpp @@ -355,7 +355,7 @@ CSMWorld::LandTextureIdTable::ImportResults CSMWorld::LandTextureIdTable::import // If it does not exist or it is in the current plugin, it can be skipped. if (oldRow < 0 || plugin == 0) { - results.recordMapping.push_back(std::make_pair(id, id)); + results.recordMapping.emplace_back(id, id); continue; } @@ -366,7 +366,7 @@ CSMWorld::LandTextureIdTable::ImportResults CSMWorld::LandTextureIdTable::import auto searchIt = reverseLookupMap.find(texture); if (searchIt != reverseLookupMap.end()) { - results.recordMapping.push_back(std::make_pair(id, searchIt->second)); + results.recordMapping.emplace_back(id, searchIt->second); continue; } @@ -381,7 +381,7 @@ CSMWorld::LandTextureIdTable::ImportResults CSMWorld::LandTextureIdTable::import // Id not taken, clone it cloneRecord(id, newId, UniversalId::Type_LandTexture); results.createdRecords.push_back(newId); - results.recordMapping.push_back(std::make_pair(id, newId)); + results.recordMapping.emplace_back(id, newId); reverseLookupMap.emplace(texture, newId); break; } diff --git a/apps/opencs/model/world/refidcollection.cpp b/apps/opencs/model/world/refidcollection.cpp index 3502d63193..535a31dddb 100644 --- a/apps/opencs/model/world/refidcollection.cpp +++ b/apps/opencs/model/world/refidcollection.cpp @@ -40,45 +40,45 @@ CSMWorld::RefIdCollection::RefIdCollection() { BaseColumns baseColumns; - mColumns.push_back (RefIdColumn (Columns::ColumnId_Id, ColumnBase::Display_Id, - ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, false, false)); + mColumns.emplace_back(Columns::ColumnId_Id, ColumnBase::Display_Id, + ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, false, false); baseColumns.mId = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Modification, ColumnBase::Display_RecordState, - ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, true, false)); + mColumns.emplace_back(Columns::ColumnId_Modification, ColumnBase::Display_RecordState, + ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, true, false); baseColumns.mModified = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_RecordType, ColumnBase::Display_RefRecordType, - ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, false, false)); + mColumns.emplace_back(Columns::ColumnId_RecordType, ColumnBase::Display_RefRecordType, + ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, false, false); baseColumns.mType = &mColumns.back(); ModelColumns modelColumns (baseColumns); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Model, ColumnBase::Display_Mesh)); + mColumns.emplace_back(Columns::ColumnId_Model, ColumnBase::Display_Mesh); modelColumns.mModel = &mColumns.back(); NameColumns nameColumns (modelColumns); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Name, ColumnBase::Display_String)); + mColumns.emplace_back(Columns::ColumnId_Name, ColumnBase::Display_String); nameColumns.mName = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Script, ColumnBase::Display_Script)); + mColumns.emplace_back(Columns::ColumnId_Script, ColumnBase::Display_Script); nameColumns.mScript = &mColumns.back(); InventoryColumns inventoryColumns (nameColumns); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Icon, ColumnBase::Display_Icon)); + mColumns.emplace_back(Columns::ColumnId_Icon, ColumnBase::Display_Icon); inventoryColumns.mIcon = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Weight, ColumnBase::Display_Float)); + mColumns.emplace_back(Columns::ColumnId_Weight, ColumnBase::Display_Float); inventoryColumns.mWeight = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_CoinValue, ColumnBase::Display_Integer)); + mColumns.emplace_back(Columns::ColumnId_CoinValue, ColumnBase::Display_Integer); inventoryColumns.mValue = &mColumns.back(); IngredientColumns ingredientColumns (inventoryColumns); - mColumns.push_back (RefIdColumn (Columns::ColumnId_EffectList, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue)); + mColumns.emplace_back(Columns::ColumnId_EffectList, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue); ingredientColumns.mEffects = &mColumns.back(); std::map ingredientEffectsMap; ingredientEffectsMap.insert(std::make_pair(UniversalId::Type_Ingredient, new IngredEffectRefIdAdapter ())); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), ingredientEffectsMap)); + mNestedAdapters.emplace_back(&mColumns.back(), ingredientEffectsMap); mColumns.back().addColumn( new NestedChildColumn (Columns::ColumnId_EffectId, ColumnBase::Display_IngredEffectId)); mColumns.back().addColumn( @@ -88,13 +88,13 @@ CSMWorld::RefIdCollection::RefIdCollection() // nested table PotionColumns potionColumns (inventoryColumns); - mColumns.push_back (RefIdColumn (Columns::ColumnId_EffectList, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue)); + mColumns.emplace_back(Columns::ColumnId_EffectList, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue); potionColumns.mEffects = &mColumns.back(); // see refidadapterimp.hpp std::map effectsMap; effectsMap.insert(std::make_pair(UniversalId::Type_Potion, new EffectsRefIdAdapter (UniversalId::Type_Potion))); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), effectsMap)); + mNestedAdapters.emplace_back(&mColumns.back(), effectsMap); mColumns.back().addColumn( new NestedChildColumn (Columns::ColumnId_EffectId, ColumnBase::Display_EffectId)); mColumns.back().addColumn( @@ -114,67 +114,67 @@ CSMWorld::RefIdCollection::RefIdCollection() EnchantableColumns enchantableColumns (inventoryColumns); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Enchantment, ColumnBase::Display_Enchantment)); + mColumns.emplace_back(Columns::ColumnId_Enchantment, ColumnBase::Display_Enchantment); enchantableColumns.mEnchantment = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_EnchantmentPoints, ColumnBase::Display_Integer)); + mColumns.emplace_back(Columns::ColumnId_EnchantmentPoints, ColumnBase::Display_Integer); enchantableColumns.mEnchantmentPoints = &mColumns.back(); ToolColumns toolsColumns (inventoryColumns); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Quality, ColumnBase::Display_Float)); + mColumns.emplace_back(Columns::ColumnId_Quality, ColumnBase::Display_Float); toolsColumns.mQuality = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Charges, ColumnBase::Display_Integer)); + mColumns.emplace_back(Columns::ColumnId_Charges, ColumnBase::Display_Integer); toolsColumns.mUses = &mColumns.back(); ActorColumns actorsColumns (nameColumns); - mColumns.push_back (RefIdColumn (Columns::ColumnId_AiHello, ColumnBase::Display_UnsignedInteger16)); + mColumns.emplace_back(Columns::ColumnId_AiHello, ColumnBase::Display_UnsignedInteger16); actorsColumns.mHello = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_AiFlee, ColumnBase::Display_UnsignedInteger8)); + mColumns.emplace_back(Columns::ColumnId_AiFlee, ColumnBase::Display_UnsignedInteger8); actorsColumns.mFlee = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_AiFight, ColumnBase::Display_UnsignedInteger8)); + mColumns.emplace_back(Columns::ColumnId_AiFight, ColumnBase::Display_UnsignedInteger8); actorsColumns.mFight = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_AiAlarm, ColumnBase::Display_UnsignedInteger8)); + mColumns.emplace_back(Columns::ColumnId_AiAlarm, ColumnBase::Display_UnsignedInteger8); actorsColumns.mAlarm = &mColumns.back(); // Nested table - mColumns.push_back(RefIdColumn (Columns::ColumnId_ActorInventory, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue)); + mColumns.emplace_back(Columns::ColumnId_ActorInventory, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue); actorsColumns.mInventory = &mColumns.back(); std::map inventoryMap; inventoryMap.insert(std::make_pair(UniversalId::Type_Npc, new NestedInventoryRefIdAdapter (UniversalId::Type_Npc))); inventoryMap.insert(std::make_pair(UniversalId::Type_Creature, new NestedInventoryRefIdAdapter (UniversalId::Type_Creature))); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), inventoryMap)); + mNestedAdapters.emplace_back(&mColumns.back(), inventoryMap); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_InventoryItemId, CSMWorld::ColumnBase::Display_Referenceable)); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_ItemCount, CSMWorld::ColumnBase::Display_Integer)); // Nested table - mColumns.push_back(RefIdColumn (Columns::ColumnId_SpellList, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue)); + mColumns.emplace_back(Columns::ColumnId_SpellList, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue); actorsColumns.mSpells = &mColumns.back(); std::map spellsMap; spellsMap.insert(std::make_pair(UniversalId::Type_Npc, new NestedSpellRefIdAdapter (UniversalId::Type_Npc))); spellsMap.insert(std::make_pair(UniversalId::Type_Creature, new NestedSpellRefIdAdapter (UniversalId::Type_Creature))); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), spellsMap)); + mNestedAdapters.emplace_back(&mColumns.back(), spellsMap); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_SpellId, CSMWorld::ColumnBase::Display_Spell)); // Nested table - mColumns.push_back(RefIdColumn (Columns::ColumnId_NpcDestinations, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue)); + mColumns.emplace_back(Columns::ColumnId_NpcDestinations, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue); actorsColumns.mDestinations = &mColumns.back(); std::map destMap; destMap.insert(std::make_pair(UniversalId::Type_Npc, new NestedTravelRefIdAdapter (UniversalId::Type_Npc))); destMap.insert(std::make_pair(UniversalId::Type_Creature, new NestedTravelRefIdAdapter (UniversalId::Type_Creature))); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), destMap)); + mNestedAdapters.emplace_back(&mColumns.back(), destMap); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_DestinationCell, CSMWorld::ColumnBase::Display_Cell)); mColumns.back().addColumn( @@ -191,15 +191,15 @@ CSMWorld::RefIdCollection::RefIdCollection() new RefIdColumn (Columns::ColumnId_RotZ, CSMWorld::ColumnBase::Display_Double)); // Nested table - mColumns.push_back(RefIdColumn (Columns::ColumnId_AiPackageList, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue)); + mColumns.emplace_back(Columns::ColumnId_AiPackageList, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue); actorsColumns.mAiPackages = &mColumns.back(); std::map aiMap; aiMap.insert(std::make_pair(UniversalId::Type_Npc, new ActorAiRefIdAdapter (UniversalId::Type_Npc))); aiMap.insert(std::make_pair(UniversalId::Type_Creature, new ActorAiRefIdAdapter (UniversalId::Type_Creature))); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), aiMap)); + mNestedAdapters.emplace_back(&mColumns.back(), aiMap); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_AiPackageType, CSMWorld::ColumnBase::Display_AiPackageType)); mColumns.back().addColumn( @@ -270,56 +270,56 @@ CSMWorld::RefIdCollection::RefIdCollection() for (int i=0; sServiceTable[i].mName!=-1; ++i) { - mColumns.push_back (RefIdColumn (sServiceTable[i].mName, ColumnBase::Display_Boolean)); + mColumns.emplace_back(sServiceTable[i].mName, ColumnBase::Display_Boolean); actorsColumns.mServices.insert (std::make_pair (&mColumns.back(), sServiceTable[i].mFlag)); } - mColumns.push_back (RefIdColumn (Columns::ColumnId_AutoCalc, ColumnBase::Display_Boolean, - ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_Refresh)); + mColumns.emplace_back(Columns::ColumnId_AutoCalc, ColumnBase::Display_Boolean, + ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_Refresh); const RefIdColumn *autoCalc = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_ApparatusType, - ColumnBase::Display_ApparatusType)); + mColumns.emplace_back(Columns::ColumnId_ApparatusType, + ColumnBase::Display_ApparatusType); const RefIdColumn *apparatusType = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_ArmorType, ColumnBase::Display_ArmorType)); + mColumns.emplace_back(Columns::ColumnId_ArmorType, ColumnBase::Display_ArmorType); const RefIdColumn *armorType = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Health, ColumnBase::Display_Integer)); + mColumns.emplace_back(Columns::ColumnId_Health, ColumnBase::Display_Integer); const RefIdColumn *health = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_ArmorValue, ColumnBase::Display_Integer)); + mColumns.emplace_back(Columns::ColumnId_ArmorValue, ColumnBase::Display_Integer); const RefIdColumn *armor = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_BookType, ColumnBase::Display_BookType)); + mColumns.emplace_back(Columns::ColumnId_BookType, ColumnBase::Display_BookType); const RefIdColumn *bookType = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Skill, ColumnBase::Display_SkillId)); + mColumns.emplace_back(Columns::ColumnId_Skill, ColumnBase::Display_SkillId); const RefIdColumn *skill = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Text, ColumnBase::Display_LongString)); + mColumns.emplace_back(Columns::ColumnId_Text, ColumnBase::Display_LongString); const RefIdColumn *text = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_ClothingType, ColumnBase::Display_ClothingType)); + mColumns.emplace_back(Columns::ColumnId_ClothingType, ColumnBase::Display_ClothingType); const RefIdColumn *clothingType = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_WeightCapacity, ColumnBase::Display_Float)); + mColumns.emplace_back(Columns::ColumnId_WeightCapacity, ColumnBase::Display_Float); const RefIdColumn *weightCapacity = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_OrganicContainer, ColumnBase::Display_Boolean)); + mColumns.emplace_back(Columns::ColumnId_OrganicContainer, ColumnBase::Display_Boolean); const RefIdColumn *organic = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Respawn, ColumnBase::Display_Boolean)); + mColumns.emplace_back(Columns::ColumnId_Respawn, ColumnBase::Display_Boolean); const RefIdColumn *respawn = &mColumns.back(); // Nested table - mColumns.push_back(RefIdColumn (Columns::ColumnId_ContainerContent, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue)); + mColumns.emplace_back(Columns::ColumnId_ContainerContent, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue); const RefIdColumn *content = &mColumns.back(); std::map contMap; contMap.insert(std::make_pair(UniversalId::Type_Container, new NestedInventoryRefIdAdapter (UniversalId::Type_Container))); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), contMap)); + mNestedAdapters.emplace_back(&mColumns.back(), contMap); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_InventoryItemId, CSMWorld::ColumnBase::Display_Referenceable)); mColumns.back().addColumn( @@ -327,11 +327,11 @@ CSMWorld::RefIdCollection::RefIdCollection() CreatureColumns creatureColumns (actorsColumns); - mColumns.push_back (RefIdColumn (Columns::ColumnId_CreatureType, ColumnBase::Display_CreatureType)); + mColumns.emplace_back(Columns::ColumnId_CreatureType, ColumnBase::Display_CreatureType); creatureColumns.mType = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Scale, ColumnBase::Display_Float)); + mColumns.emplace_back(Columns::ColumnId_Scale, ColumnBase::Display_Float); creatureColumns.mScale = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_ParentCreature, ColumnBase::Display_Creature)); + mColumns.emplace_back(Columns::ColumnId_ParentCreature, ColumnBase::Display_Creature); creatureColumns.mOriginal = &mColumns.back(); static const struct @@ -354,7 +354,7 @@ CSMWorld::RefIdCollection::RefIdCollection() for (int i=0; sCreatureFlagTable[i].mName!=-1; ++i) { - mColumns.push_back (RefIdColumn (sCreatureFlagTable[i].mName, ColumnBase::Display_Boolean)); + mColumns.emplace_back(sCreatureFlagTable[i].mName, ColumnBase::Display_Boolean); creatureColumns.mFlags.insert (std::make_pair (&mColumns.back(), sCreatureFlagTable[i].mFlag)); switch (sCreatureFlagTable[i].mFlag) @@ -363,7 +363,7 @@ CSMWorld::RefIdCollection::RefIdCollection() } } - mColumns.push_back(RefIdColumn(Columns::ColumnId_BloodType, ColumnBase::Display_BloodType)); + mColumns.emplace_back(Columns::ColumnId_BloodType, ColumnBase::Display_BloodType); // For re-use in NPC records. const RefIdColumn *bloodType = &mColumns.back(); creatureColumns.mBloodType = bloodType; @@ -371,24 +371,24 @@ CSMWorld::RefIdCollection::RefIdCollection() creatureColumns.mFlags.insert (std::make_pair (respawn, ESM::Creature::Respawn)); // Nested table - mColumns.push_back(RefIdColumn (Columns::ColumnId_CreatureAttributes, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue)); + mColumns.emplace_back(Columns::ColumnId_CreatureAttributes, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue); creatureColumns.mAttributes = &mColumns.back(); std::map creaAttrMap; creaAttrMap.insert(std::make_pair(UniversalId::Type_Creature, new CreatureAttributesRefIdAdapter())); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), creaAttrMap)); + mNestedAdapters.emplace_back(&mColumns.back(), creaAttrMap); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_Attribute, CSMWorld::ColumnBase::Display_Attribute, false, false)); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_AttributeValue, CSMWorld::ColumnBase::Display_Integer)); // Nested table - mColumns.push_back(RefIdColumn (Columns::ColumnId_CreatureAttack, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue)); + mColumns.emplace_back(Columns::ColumnId_CreatureAttack, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue); creatureColumns.mAttacks = &mColumns.back(); std::map attackMap; attackMap.insert(std::make_pair(UniversalId::Type_Creature, new CreatureAttackRefIdAdapter())); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), attackMap)); + mNestedAdapters.emplace_back(&mColumns.back(), attackMap); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_CreatureAttack, CSMWorld::ColumnBase::Display_Integer, false, false)); mColumns.back().addColumn( @@ -397,12 +397,12 @@ CSMWorld::RefIdCollection::RefIdCollection() new RefIdColumn (Columns::ColumnId_MaxAttack, CSMWorld::ColumnBase::Display_Integer)); // Nested list - mColumns.push_back(RefIdColumn (Columns::ColumnId_CreatureMisc, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_List)); + mColumns.emplace_back(Columns::ColumnId_CreatureMisc, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_List); creatureColumns.mMisc = &mColumns.back(); std::map creaMiscMap; creaMiscMap.insert(std::make_pair(UniversalId::Type_Creature, new CreatureMiscRefIdAdapter())); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), creaMiscMap)); + mNestedAdapters.emplace_back(&mColumns.back(), creaMiscMap); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_Level, CSMWorld::ColumnBase::Display_Integer, ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_Refresh)); @@ -423,27 +423,27 @@ CSMWorld::RefIdCollection::RefIdCollection() mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_Gold, CSMWorld::ColumnBase::Display_Integer)); - mColumns.push_back (RefIdColumn (Columns::ColumnId_OpenSound, ColumnBase::Display_Sound)); + mColumns.emplace_back(Columns::ColumnId_OpenSound, ColumnBase::Display_Sound); const RefIdColumn *openSound = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_CloseSound, ColumnBase::Display_Sound)); + mColumns.emplace_back(Columns::ColumnId_CloseSound, ColumnBase::Display_Sound); const RefIdColumn *closeSound = &mColumns.back(); LightColumns lightColumns (inventoryColumns); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Duration, ColumnBase::Display_Integer)); + mColumns.emplace_back(Columns::ColumnId_Duration, ColumnBase::Display_Integer); lightColumns.mTime = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Radius, ColumnBase::Display_Integer)); + mColumns.emplace_back(Columns::ColumnId_Radius, ColumnBase::Display_Integer); lightColumns.mRadius = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Colour, ColumnBase::Display_Colour)); + mColumns.emplace_back(Columns::ColumnId_Colour, ColumnBase::Display_Colour); lightColumns.mColor = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Sound, ColumnBase::Display_Sound)); + mColumns.emplace_back(Columns::ColumnId_Sound, ColumnBase::Display_Sound); lightColumns.mSound = &mColumns.back(); - mColumns.push_back(RefIdColumn(Columns::ColumnId_EmitterType, ColumnBase::Display_EmitterType)); + mColumns.emplace_back(Columns::ColumnId_EmitterType, ColumnBase::Display_EmitterType); lightColumns.mEmitterType = &mColumns.back(); static const struct @@ -462,31 +462,31 @@ CSMWorld::RefIdCollection::RefIdCollection() for (int i=0; sLightFlagTable[i].mName!=-1; ++i) { - mColumns.push_back (RefIdColumn (sLightFlagTable[i].mName, ColumnBase::Display_Boolean)); + mColumns.emplace_back(sLightFlagTable[i].mName, ColumnBase::Display_Boolean); lightColumns.mFlags.insert (std::make_pair (&mColumns.back(), sLightFlagTable[i].mFlag)); } - mColumns.push_back (RefIdColumn (Columns::ColumnId_IsKey, ColumnBase::Display_Boolean)); + mColumns.emplace_back(Columns::ColumnId_IsKey, ColumnBase::Display_Boolean); const RefIdColumn *key = &mColumns.back(); NpcColumns npcColumns (actorsColumns); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Race, ColumnBase::Display_Race)); + mColumns.emplace_back(Columns::ColumnId_Race, ColumnBase::Display_Race); npcColumns.mRace = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Class, ColumnBase::Display_Class)); + mColumns.emplace_back(Columns::ColumnId_Class, ColumnBase::Display_Class); npcColumns.mClass = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Faction, ColumnBase::Display_Faction)); + mColumns.emplace_back(Columns::ColumnId_Faction, ColumnBase::Display_Faction); npcColumns.mFaction = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::Columnid_Hair, ColumnBase::Display_BodyPart)); + mColumns.emplace_back(Columns::Columnid_Hair, ColumnBase::Display_BodyPart); npcColumns.mHair = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Head, ColumnBase::Display_BodyPart)); + mColumns.emplace_back(Columns::ColumnId_Head, ColumnBase::Display_BodyPart); npcColumns.mHead = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_Gender, ColumnBase::Display_GenderNpc)); + mColumns.emplace_back(Columns::ColumnId_Gender, ColumnBase::Display_GenderNpc); npcColumns.mGender = &mColumns.back(); npcColumns.mFlags.insert (std::make_pair (essential, ESM::NPC::Essential)); @@ -503,36 +503,36 @@ CSMWorld::RefIdCollection::RefIdCollection() // These needs to be driven from the autocalculated setting. // Nested table - mColumns.push_back(RefIdColumn (Columns::ColumnId_NpcAttributes, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue)); + mColumns.emplace_back(Columns::ColumnId_NpcAttributes, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue); npcColumns.mAttributes = &mColumns.back(); std::map attrMap; attrMap.insert(std::make_pair(UniversalId::Type_Npc, new NpcAttributesRefIdAdapter())); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), attrMap)); + mNestedAdapters.emplace_back(&mColumns.back(), attrMap); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_Attribute, CSMWorld::ColumnBase::Display_Attribute, false, false)); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_UChar, CSMWorld::ColumnBase::Display_UnsignedInteger8)); // Nested table - mColumns.push_back(RefIdColumn (Columns::ColumnId_NpcSkills, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue)); + mColumns.emplace_back(Columns::ColumnId_NpcSkills, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue); npcColumns.mSkills = &mColumns.back(); std::map skillsMap; skillsMap.insert(std::make_pair(UniversalId::Type_Npc, new NpcSkillsRefIdAdapter())); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), skillsMap)); + mNestedAdapters.emplace_back(&mColumns.back(), skillsMap); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_Skill, CSMWorld::ColumnBase::Display_SkillId, false, false)); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_UChar, CSMWorld::ColumnBase::Display_UnsignedInteger8)); // Nested list - mColumns.push_back(RefIdColumn (Columns::ColumnId_NpcMisc, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_List)); + mColumns.emplace_back(Columns::ColumnId_NpcMisc, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_List); npcColumns.mMisc = &mColumns.back(); std::map miscMap; miscMap.insert(std::make_pair(UniversalId::Type_Npc, new NpcMiscRefIdAdapter())); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), miscMap)); + mNestedAdapters.emplace_back(&mColumns.back(), miscMap); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_Level, CSMWorld::ColumnBase::Display_SignedInteger16)); mColumns.back().addColumn( @@ -554,15 +554,15 @@ CSMWorld::RefIdCollection::RefIdCollection() WeaponColumns weaponColumns (enchantableColumns); - mColumns.push_back (RefIdColumn (Columns::ColumnId_WeaponType, ColumnBase::Display_WeaponType)); + mColumns.emplace_back(Columns::ColumnId_WeaponType, ColumnBase::Display_WeaponType); weaponColumns.mType = &mColumns.back(); weaponColumns.mHealth = health; - mColumns.push_back (RefIdColumn (Columns::ColumnId_WeaponSpeed, ColumnBase::Display_Float)); + mColumns.emplace_back(Columns::ColumnId_WeaponSpeed, ColumnBase::Display_Float); weaponColumns.mSpeed = &mColumns.back(); - mColumns.push_back (RefIdColumn (Columns::ColumnId_WeaponReach, ColumnBase::Display_Float)); + mColumns.emplace_back(Columns::ColumnId_WeaponReach, ColumnBase::Display_Float); weaponColumns.mReach = &mColumns.back(); for (int i=0; i<3; ++i) @@ -572,8 +572,7 @@ CSMWorld::RefIdCollection::RefIdCollection() for (int j=0; j<2; ++j) { - mColumns.push_back ( - RefIdColumn (Columns::ColumnId_MinChop+i*2+j, ColumnBase::Display_Integer)); + mColumns.emplace_back(Columns::ColumnId_MinChop+i*2+j, ColumnBase::Display_Integer); column[j] = &mColumns.back(); } } @@ -591,19 +590,19 @@ CSMWorld::RefIdCollection::RefIdCollection() for (int i=0; sWeaponFlagTable[i].mName!=-1; ++i) { - mColumns.push_back (RefIdColumn (sWeaponFlagTable[i].mName, ColumnBase::Display_Boolean)); + mColumns.emplace_back(sWeaponFlagTable[i].mName, ColumnBase::Display_Boolean); weaponColumns.mFlags.insert (std::make_pair (&mColumns.back(), sWeaponFlagTable[i].mFlag)); } // Nested table - mColumns.push_back(RefIdColumn (Columns::ColumnId_PartRefList, ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue)); + mColumns.emplace_back(Columns::ColumnId_PartRefList, ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue); const RefIdColumn *partRef = &mColumns.back(); std::map partMap; partMap.insert(std::make_pair(UniversalId::Type_Armor, new BodyPartRefIdAdapter (UniversalId::Type_Armor))); partMap.insert(std::make_pair(UniversalId::Type_Clothing, new BodyPartRefIdAdapter (UniversalId::Type_Clothing))); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), partMap)); + mNestedAdapters.emplace_back(&mColumns.back(), partMap); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_PartRefType, CSMWorld::ColumnBase::Display_PartRefType)); mColumns.back().addColumn( @@ -614,30 +613,30 @@ CSMWorld::RefIdCollection::RefIdCollection() LevListColumns levListColumns (baseColumns); // Nested table - mColumns.push_back(RefIdColumn (Columns::ColumnId_LevelledList, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue)); + mColumns.emplace_back(Columns::ColumnId_LevelledList, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue); levListColumns.mLevList = &mColumns.back(); std::map levListMap; levListMap.insert(std::make_pair(UniversalId::Type_CreatureLevelledList, new NestedLevListRefIdAdapter (UniversalId::Type_CreatureLevelledList))); levListMap.insert(std::make_pair(UniversalId::Type_ItemLevelledList, new NestedLevListRefIdAdapter (UniversalId::Type_ItemLevelledList))); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), levListMap)); + mNestedAdapters.emplace_back(&mColumns.back(), levListMap); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_LevelledItemId, CSMWorld::ColumnBase::Display_Referenceable)); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_LevelledItemLevel, CSMWorld::ColumnBase::Display_Integer)); // Nested list - mColumns.push_back(RefIdColumn (Columns::ColumnId_LevelledList, - ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_List)); + mColumns.emplace_back(Columns::ColumnId_LevelledList, + ColumnBase::Display_NestedHeader, ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_List); levListColumns.mNestedListLevList = &mColumns.back(); std::map nestedListLevListMap; nestedListLevListMap.insert(std::make_pair(UniversalId::Type_CreatureLevelledList, new NestedListLevListRefIdAdapter (UniversalId::Type_CreatureLevelledList))); nestedListLevListMap.insert(std::make_pair(UniversalId::Type_ItemLevelledList, new NestedListLevListRefIdAdapter (UniversalId::Type_ItemLevelledList))); - mNestedAdapters.push_back (std::make_pair(&mColumns.back(), nestedListLevListMap)); + mNestedAdapters.emplace_back(&mColumns.back(), nestedListLevListMap); mColumns.back().addColumn( new RefIdColumn (Columns::ColumnId_LevelledItemTypeEach, CSMWorld::ColumnBase::Display_Boolean)); mColumns.back().addColumn( diff --git a/apps/opencs/view/render/cell.cpp b/apps/opencs/view/render/cell.cpp index 056c50e45f..859974d011 100644 --- a/apps/opencs/view/render/cell.cpp +++ b/apps/opencs/view/render/cell.cpp @@ -553,7 +553,7 @@ std::vector > CSVRender::Cell::getSelection (un result.push_back (iter->second->getTag()); if (mPathgrid && elementMask & Mask_Pathgrid) if (mPathgrid->isSelected()) - result.push_back(mPathgrid->getTag()); + result.emplace_back(mPathgrid->getTag()); return result; } diff --git a/apps/opencs/view/render/worldspacewidget.cpp b/apps/opencs/view/render/worldspacewidget.cpp index 916c349d2a..4535b5e8af 100644 --- a/apps/opencs/view/render/worldspacewidget.cpp +++ b/apps/opencs/view/render/worldspacewidget.cpp @@ -255,8 +255,7 @@ CSVWidget::SceneToolRun *CSVRender::WorldspaceWidget::makeRunTool ( bool default_ = debugProfiles.data (debugProfiles.index (i, defaultColumn)).toInt(); if (state!=CSMWorld::RecordBase::State_Deleted && default_) - profiles.push_back ( - debugProfiles.data (debugProfiles.index (i, idColumn)). + profiles.emplace_back(debugProfiles.data (debugProfiles.index (i, idColumn)). toString().toUtf8().constData()); } diff --git a/apps/opencs/view/world/datadisplaydelegate.cpp b/apps/opencs/view/world/datadisplaydelegate.cpp index f0c364bc28..6da62d4089 100644 --- a/apps/opencs/view/world/datadisplaydelegate.cpp +++ b/apps/opencs/view/world/datadisplaydelegate.cpp @@ -32,7 +32,7 @@ void CSVWorld::DataDisplayDelegate::buildPixmaps () while (it != mIcons.end()) { - mPixmaps.push_back (std::make_pair (it->mValue, it->mIcon.pixmap (mIconSize) ) ); + mPixmaps.emplace_back (it->mValue, it->mIcon.pixmap (mIconSize) ); ++it; } } diff --git a/apps/opencs/view/world/enumdelegate.cpp b/apps/opencs/view/world/enumdelegate.cpp index 8027cec623..3140adc485 100644 --- a/apps/opencs/view/world/enumdelegate.cpp +++ b/apps/opencs/view/world/enumdelegate.cpp @@ -181,5 +181,5 @@ void CSVWorld::EnumDelegateFactory::add (int value, const QString& name) } } - mValues.push_back(std::make_pair (value, name)); + mValues.emplace_back (value, name); } diff --git a/apps/opencs/view/world/regionmap.cpp b/apps/opencs/view/world/regionmap.cpp index af91464b66..d2d4fbd237 100644 --- a/apps/opencs/view/world/regionmap.cpp +++ b/apps/opencs/view/world/regionmap.cpp @@ -345,18 +345,16 @@ std::vector< CSMWorld::UniversalId > CSVWorld::RegionMap::getDraggedRecords() co std::vector ids; for (const QModelIndex& it : selected) { - ids.push_back( - CSMWorld::UniversalId( + ids.emplace_back( CSMWorld::UniversalId::Type_Cell, - model()->data(it, CSMWorld::RegionMap::Role_CellId).toString().toUtf8().constData())); + model()->data(it, CSMWorld::RegionMap::Role_CellId).toString().toUtf8().constData()); } selected = getSelectedCells(false, true); for (const QModelIndex& it : selected) { - ids.push_back( - CSMWorld::UniversalId( + ids.emplace_back( CSMWorld::UniversalId::Type_Cell_Missing, - model()->data(it, CSMWorld::RegionMap::Role_CellId).toString().toUtf8().constData())); + model()->data(it, CSMWorld::RegionMap::Role_CellId).toString().toUtf8().constData()); } return ids; } diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index 9d47e2fe51..e5f4e36c5b 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -452,7 +452,7 @@ std::vector CSVWorld::Table::getSelectedIds() const ++iter) { int row = mProxyModel->mapToSource (mProxyModel->index (iter->row(), 0)).row(); - ids.push_back (mModel->data (mModel->index (row, columnIndex)).toString().toUtf8().constData()); + ids.emplace_back(mModel->data (mModel->index (row, columnIndex)).toString().toUtf8().constData()); } return ids; } @@ -784,7 +784,7 @@ std::vector CSVWorld::Table::getColumnsWithDisplay(CSMWorld::Column if (display == columndisplay) { - titles.push_back(mModel->headerData (i, Qt::Horizontal).toString().toUtf8().constData()); + titles.emplace_back(mModel->headerData (i, Qt::Horizontal).toString().toUtf8().constData()); } } return titles; diff --git a/apps/opencs/view/world/tablesubview.cpp b/apps/opencs/view/world/tablesubview.cpp index b0bae7fdf5..5413f87a6e 100644 --- a/apps/opencs/view/world/tablesubview.cpp +++ b/apps/opencs/view/world/tablesubview.cpp @@ -133,12 +133,12 @@ void CSVWorld::TableSubView::createFilterRequest (std::vector< CSMWorld::Univers std::vector col = mTable->getColumnsWithDisplay(CSMWorld::TableMimeData::convertEnums(type)); if(!col.empty()) { - filterSource.push_back(std::make_pair(it->getId(), col)); + filterSource.emplace_back(it->getId(), col); } if(hasRefIdDisplay && CSMWorld::TableMimeData::isReferencable(type)) { - filterSource.push_back(std::make_pair(it->getId(), refIdColumns)); + filterSource.emplace_back(it->getId(), refIdColumns); } } diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 0187f27275..22d93e3bce 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -431,12 +431,12 @@ namespace MWClass const MWWorld::LiveCellRef *npc = ptr.get(); const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get().search(npc->mBase->mRace); if(race && race->mData.mFlags & ESM::Race::Beast) - models.push_back("meshes\\base_animkna.nif"); + models.emplace_back("meshes\\base_animkna.nif"); // keep these always loaded just in case - models.push_back("meshes/xargonian_swimkna.nif"); - models.push_back("meshes/xbase_anim_female.nif"); - models.push_back("meshes/xbase_anim.nif"); + models.emplace_back("meshes/xargonian_swimkna.nif"); + models.emplace_back("meshes/xbase_anim_female.nif"); + models.emplace_back("meshes/xbase_anim.nif"); if (!npc->mBase->mModel.empty()) models.push_back("meshes/"+npc->mBase->mModel); diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index e3f1796a4c..b392ab8721 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -468,7 +468,7 @@ namespace MWDialogue void DialogueManager::addChoice (const std::string& text, int choice) { mIsInChoice = true; - mChoices.push_back(std::make_pair(text, choice)); + mChoices.emplace_back(text, choice); } const std::vector >& DialogueManager::getChoices() diff --git a/apps/openmw/mwdialogue/hypertextparser.cpp b/apps/openmw/mwdialogue/hypertextparser.cpp index aa748e772e..28e450e2b2 100644 --- a/apps/openmw/mwdialogue/hypertextparser.cpp +++ b/apps/openmw/mwdialogue/hypertextparser.cpp @@ -30,7 +30,7 @@ namespace MWDialogue tokenizeKeywords(text.substr(iteration_pos, pos_begin - iteration_pos), result); std::string link = text.substr(pos_begin + 1, pos_end - pos_begin - 1); - result.push_back(Token(link, Token::ExplicitLink)); + result.emplace_back(link, Token::ExplicitLink); iteration_pos = pos_end + 1; } @@ -65,7 +65,7 @@ namespace MWDialogue for (std::vector::Match>::const_iterator it = matches.begin(); it != matches.end(); ++it) { - tokens.push_back(Token(std::string(it->mBeg, it->mEnd), Token::ImplicitKeyword)); + tokens.emplace_back(std::string(it->mBeg, it->mEnd), Token::ImplicitKeyword); } } diff --git a/apps/openmw/mwgui/birth.cpp b/apps/openmw/mwgui/birth.cpp index 6f6a621adf..41711f5e4e 100644 --- a/apps/openmw/mwgui/birth.cpp +++ b/apps/openmw/mwgui/birth.cpp @@ -147,7 +147,7 @@ namespace MWGui for (const ESM::BirthSign& sign : signs) { - birthSigns.push_back(std::make_pair(sign.mId, &sign)); + birthSigns.emplace_back(sign.mId, &sign); } std::sort(birthSigns.begin(), birthSigns.end(), sortBirthSigns); diff --git a/apps/openmw/mwgui/bookpage.cpp b/apps/openmw/mwgui/bookpage.cpp index 47027c2b7c..f7a86124a1 100644 --- a/apps/openmw/mwgui/bookpage.cpp +++ b/apps/openmw/mwgui/bookpage.cpp @@ -524,9 +524,9 @@ struct TypesetBookImpl::Typesetter : BookTypesetter break; if ( lead != origin ) - mPartialWhitespace.push_back (PartialText (style, lead, origin, space_width)); + mPartialWhitespace.emplace_back(style, lead, origin, space_width); if ( origin != extent ) - mPartialWord.push_back (PartialText (style, origin, extent, word_width)); + mPartialWord.emplace_back(style, origin, extent, word_width); } } diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp index a92ad934cd..cfbf5e5fb5 100644 --- a/apps/openmw/mwgui/class.cpp +++ b/apps/openmw/mwgui/class.cpp @@ -217,7 +217,7 @@ namespace MWGui if (store.get().isDynamic(classInfo.mId)) continue; // custom-made class not relevant for this dialog - items.push_back(std::make_pair(classInfo.mId, classInfo.mName)); + items.emplace_back(classInfo.mId, classInfo.mName); } std::sort(items.begin(), items.end(), sortClasses); diff --git a/apps/openmw/mwgui/companionwindow.cpp b/apps/openmw/mwgui/companionwindow.cpp index b3f6e33398..926456219e 100644 --- a/apps/openmw/mwgui/companionwindow.cpp +++ b/apps/openmw/mwgui/companionwindow.cpp @@ -163,8 +163,8 @@ bool CompanionWindow::exit() if (mModel && mModel->hasProfit(mPtr) && getProfit(mPtr) < 0) { std::vector buttons; - buttons.push_back("#{sCompanionWarningButtonOne}"); - buttons.push_back("#{sCompanionWarningButtonTwo}"); + buttons.emplace_back("#{sCompanionWarningButtonOne}"); + buttons.emplace_back("#{sCompanionWarningButtonTwo}"); mMessageBoxManager->createInteractiveMessageBox("#{sCompanionWarningMessage}", buttons); mMessageBoxManager->eventButtonPressed += MyGUI::newDelegate(this, &CompanionWindow::onMessageBoxButtonClicked); return false; diff --git a/apps/openmw/mwgui/containeritemmodel.cpp b/apps/openmw/mwgui/containeritemmodel.cpp index 31439f3494..56f084bb9d 100644 --- a/apps/openmw/mwgui/containeritemmodel.cpp +++ b/apps/openmw/mwgui/containeritemmodel.cpp @@ -49,14 +49,14 @@ ContainerItemModel::ContainerItemModel(const std::vector& itemSour for(const MWWorld::Ptr& source : itemSources) { MWWorld::ContainerStore& store = source.getClass().getContainerStore(source); - mItemSources.push_back(std::make_pair(source, store.resolveTemporarily())); + mItemSources.emplace_back(source, store.resolveTemporarily()); } } ContainerItemModel::ContainerItemModel (const MWWorld::Ptr& source) : mTrading(false) { MWWorld::ContainerStore& store = source.getClass().getContainerStore(source); - mItemSources.push_back(std::make_pair(source, store.resolveTemporarily())); + mItemSources.emplace_back(source, store.resolveTemporarily()); } bool ContainerItemModel::allowedToUseItems() const diff --git a/apps/openmw/mwgui/jailscreen.cpp b/apps/openmw/mwgui/jailscreen.cpp index 67124884f4..cc793073e3 100644 --- a/apps/openmw/mwgui/jailscreen.cpp +++ b/apps/openmw/mwgui/jailscreen.cpp @@ -123,7 +123,7 @@ namespace MWGui } std::vector buttons; - buttons.push_back("#{sOk}"); + buttons.emplace_back("#{sOk}"); MWBase::Environment::get().getWindowManager()->interactiveMessageBox(message, buttons); } } diff --git a/apps/openmw/mwgui/mainmenu.cpp b/apps/openmw/mwgui/mainmenu.cpp index 4778ee7b09..a5d8f7344d 100644 --- a/apps/openmw/mwgui/mainmenu.cpp +++ b/apps/openmw/mwgui/mainmenu.cpp @@ -231,25 +231,25 @@ namespace MWGui std::vector buttons; if (state==MWBase::StateManager::State_Running) - buttons.push_back("return"); + buttons.emplace_back("return"); - buttons.push_back("newgame"); + buttons.emplace_back("newgame"); if (state==MWBase::StateManager::State_Running && MWBase::Environment::get().getWorld()->getGlobalInt ("chargenstate")==-1 && MWBase::Environment::get().getWindowManager()->isSavingAllowed()) - buttons.push_back("savegame"); + buttons.emplace_back("savegame"); if (MWBase::Environment::get().getStateManager()->characterBegin()!= MWBase::Environment::get().getStateManager()->characterEnd()) - buttons.push_back("loadgame"); + buttons.emplace_back("loadgame"); - buttons.push_back("options"); + buttons.emplace_back("options"); if (state==MWBase::StateManager::State_NoGame) - buttons.push_back("credits"); + buttons.emplace_back("credits"); - buttons.push_back("exitgame"); + buttons.emplace_back("exitgame"); // Create new buttons if needed std::vector allButtons { "return", "newgame", "savegame", "loadgame", "options", "credits", "exitgame"}; diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index cf69ecca38..457594697d 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -358,7 +358,7 @@ namespace MWGui if (!playable) // Only display playable races continue; - items.push_back(std::make_pair(race.mId, race.mName)); + items.emplace_back(race.mId, race.mName); } std::sort(items.begin(), items.end(), sortRaces); diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index aec3396a18..0e3ae6ff8e 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -244,7 +244,7 @@ namespace MWGui { SDL_DisplayMode mode; SDL_GetDisplayMode(screen, i, &mode); - resolutions.push_back(std::make_pair(mode.w, mode.h)); + resolutions.emplace_back(mode.w, mode.h); } std::sort(resolutions.begin(), resolutions.end(), sortResolutions); for (std::pair& resolution : resolutions) diff --git a/apps/openmw/mwgui/sortfilteritemmodel.cpp b/apps/openmw/mwgui/sortfilteritemmodel.cpp index f18cac6810..28b13cdf0d 100644 --- a/apps/openmw/mwgui/sortfilteritemmodel.cpp +++ b/apps/openmw/mwgui/sortfilteritemmodel.cpp @@ -31,18 +31,18 @@ namespace { // this defines the sorting order of types. types that are first in the vector appear before other types. std::vector mapping; - mapping.push_back( typeid(ESM::Weapon).name() ); - mapping.push_back( typeid(ESM::Armor).name() ); - mapping.push_back( typeid(ESM::Clothing).name() ); - mapping.push_back( typeid(ESM::Potion).name() ); - mapping.push_back( typeid(ESM::Ingredient).name() ); - mapping.push_back( typeid(ESM::Apparatus).name() ); - mapping.push_back( typeid(ESM::Book).name() ); - mapping.push_back( typeid(ESM::Light).name() ); - mapping.push_back( typeid(ESM::Miscellaneous).name() ); - mapping.push_back( typeid(ESM::Lockpick).name() ); - mapping.push_back( typeid(ESM::Repair).name() ); - mapping.push_back( typeid(ESM::Probe).name() ); + mapping.emplace_back(typeid(ESM::Weapon).name() ); + mapping.emplace_back(typeid(ESM::Armor).name() ); + mapping.emplace_back(typeid(ESM::Clothing).name() ); + mapping.emplace_back(typeid(ESM::Potion).name() ); + mapping.emplace_back(typeid(ESM::Ingredient).name() ); + mapping.emplace_back(typeid(ESM::Apparatus).name() ); + mapping.emplace_back(typeid(ESM::Book).name() ); + mapping.emplace_back(typeid(ESM::Light).name() ); + mapping.emplace_back(typeid(ESM::Miscellaneous).name() ); + mapping.emplace_back(typeid(ESM::Lockpick).name() ); + mapping.emplace_back(typeid(ESM::Repair).name() ); + mapping.emplace_back(typeid(ESM::Probe).name() ); assert( std::find(mapping.begin(), mapping.end(), type1) != mapping.end() ); assert( std::find(mapping.begin(), mapping.end(), type2) != mapping.end() ); @@ -166,7 +166,7 @@ namespace MWGui void SortFilterItemModel::addDragItem (const MWWorld::Ptr& dragItem, size_t count) { - mDragItems.push_back(std::make_pair(dragItem, count)); + mDragItems.emplace_back(dragItem, count); } void SortFilterItemModel::clearDragItems() diff --git a/apps/openmw/mwgui/soulgemdialog.cpp b/apps/openmw/mwgui/soulgemdialog.cpp index 104c81eab7..345c8b7221 100644 --- a/apps/openmw/mwgui/soulgemdialog.cpp +++ b/apps/openmw/mwgui/soulgemdialog.cpp @@ -12,8 +12,8 @@ namespace MWGui { mSoulgem = soulgem; std::vector buttons; - buttons.push_back("#{sRechargeEnchantment}"); - buttons.push_back("#{sMake Enchantment}"); + buttons.emplace_back("#{sRechargeEnchantment}"); + buttons.emplace_back("#{sMake Enchantment}"); mManager->createInteractiveMessageBox("#{sDoYouWantTo}", buttons); mManager->eventButtonPressed += MyGUI::newDelegate(this, &SoulgemDialog::onButtonPressed); } diff --git a/apps/openmw/mwgui/spellview.cpp b/apps/openmw/mwgui/spellview.cpp index f03c1cedbd..a8b7cb6398 100644 --- a/apps/openmw/mwgui/spellview.cpp +++ b/apps/openmw/mwgui/spellview.cpp @@ -128,10 +128,10 @@ namespace MWGui group.push_back(costChance); Gui::SharedStateButton::createButtonGroup(group); - mLines.push_back(LineInfo(t, costChance, i)); + mLines.emplace_back(t, costChance, i); } else - mLines.push_back(LineInfo(t, (MyGUI::Widget*)nullptr, i)); + mLines.emplace_back(t, (MyGUI::Widget*)nullptr, i); t->setStateSelected(spell.mSelected); } @@ -236,7 +236,7 @@ namespace MWGui MyGUI::IntCoord(0, 0, mScrollView->getWidth(), 18), MyGUI::Align::Left | MyGUI::Align::Top); separator->setNeedMouseFocus(false); - mLines.push_back(LineInfo(separator, (MyGUI::Widget*)nullptr, NoSpellIndex)); + mLines.emplace_back(separator, (MyGUI::Widget*)nullptr, NoSpellIndex); } MyGUI::TextBox* groupWidget = mScrollView->createWidget("SandBrightText", @@ -255,10 +255,10 @@ namespace MWGui groupWidget2->setTextAlign(MyGUI::Align::Right); groupWidget2->setNeedMouseFocus(false); - mLines.push_back(LineInfo(groupWidget, groupWidget2, NoSpellIndex)); + mLines.emplace_back(groupWidget, groupWidget2, NoSpellIndex); } else - mLines.push_back(LineInfo(groupWidget, (MyGUI::Widget*)nullptr, NoSpellIndex)); + mLines.emplace_back(groupWidget, (MyGUI::Widget*)nullptr, NoSpellIndex); } diff --git a/apps/openmw/mwgui/trainingwindow.cpp b/apps/openmw/mwgui/trainingwindow.cpp index da3c7d186c..7fae33bae5 100644 --- a/apps/openmw/mwgui/trainingwindow.cpp +++ b/apps/openmw/mwgui/trainingwindow.cpp @@ -84,7 +84,7 @@ namespace MWGui { float value = getSkillForTraining(actorStats, i); - skills.push_back(std::make_pair(i, value)); + skills.emplace_back(i, value); } std::sort(skills.begin(), skills.end(), sortSkills); diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index ec65990936..5c0d48d5b1 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -199,7 +199,7 @@ namespace MWMechanics if (sourceId != mSpellId) return; - mMagnitudes.push_back(std::make_pair(key, magnitude)); + mMagnitudes.emplace_back(key, magnitude); } std::vector> mMagnitudes; diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 872a66799a..b1db2562b2 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -971,7 +971,7 @@ namespace MWMechanics { const OwnerMap& owners = it->second; for (OwnerMap::const_iterator ownerIt = owners.begin(); ownerIt != owners.end(); ++ownerIt) - result.push_back(std::make_pair(ownerIt->first.first, ownerIt->second)); + result.emplace_back(ownerIt->first.first, ownerIt->second); return result; } } diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 3835e26de8..fafec7dd4a 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -65,7 +65,7 @@ namespace virtual void apply(osg::Node &node) { if (dynamic_cast(&node)) - mToRemove.push_back(&node); + mToRemove.emplace_back(&node); traverse(node); } @@ -73,7 +73,7 @@ namespace virtual void apply(osg::Drawable& drw) { if (osgParticle::ParticleSystem* partsys = dynamic_cast(&drw)) - mToRemove.push_back(partsys); + mToRemove.emplace_back(partsys); } void remove() @@ -277,7 +277,7 @@ namespace if (vfxCallback) { if (vfxCallback->mFinished) - mToRemove.push_back(std::make_pair(group.asNode(), group.getParent(0))); + mToRemove.emplace_back(group.asNode(), group.getParent(0)); else mHasMagicEffects = true; } @@ -330,7 +330,7 @@ namespace { bool toRemove = mEffectId < 0 || vfxCallback->mParams.mEffectId == mEffectId; if (toRemove) - mToRemove.push_back(std::make_pair(group.asNode(), group.getParent(0))); + mToRemove.emplace_back(group.asNode(), group.getParent(0)); else mHasMagicEffects = true; } @@ -431,7 +431,7 @@ namespace node.setStateSet(nullptr); if (node.getNodeMask() == 0x1 && node.getNumParents() == 1) - mToRemove.push_back(std::make_pair(&node, node.getParent(0))); + mToRemove.emplace_back(&node, node.getParent(0)); else traverse(node); } @@ -449,12 +449,12 @@ namespace osg::Group* parentParent = static_cast(*(parent - 1)); if (parentGroup->getNumChildren() == 1 && parentGroup->getDataVariance() == osg::Object::STATIC) { - mToRemove.push_back(std::make_pair(parentGroup, parentParent)); + mToRemove.emplace_back(parentGroup, parentParent); return; } } - mToRemove.push_back(std::make_pair(&node, parentGroup)); + mToRemove.emplace_back(&node, parentGroup); } }; @@ -482,7 +482,7 @@ namespace { osg::Group* parent = static_cast(*(getNodePath().end()-2)); // Not safe to remove in apply(), since the visitor is still iterating the child list - mToRemove.push_back(std::make_pair(&node, parent)); + mToRemove.emplace_back(&node, parent); } } }; diff --git a/apps/openmw/mwrender/localmap.cpp b/apps/openmw/mwrender/localmap.cpp index aaa797ef15..09e1f40014 100644 --- a/apps/openmw/mwrender/localmap.cpp +++ b/apps/openmw/mwrender/localmap.cpp @@ -118,7 +118,7 @@ void LocalMap::saveFogOfWar(MWWorld::CellStore* cell) if (segment.mFogOfWarImage && segment.mHasFogState) { std::unique_ptr fog (new ESM::FogState()); - fog->mFogTextures.push_back(ESM::FogTexture()); + fog->mFogTextures.emplace_back(); segment.saveFogOfWar(fog->mFogTextures.back()); @@ -150,7 +150,7 @@ void LocalMap::saveFogOfWar(MWWorld::CellStore* cell) { const MapSegment& segment = mSegments[std::make_pair(x,y)]; - fog->mFogTextures.push_back(ESM::FogTexture()); + fog->mFogTextures.emplace_back(); // saving even if !segment.mHasFogState so we don't mess up the segmenting // plus, older openmw versions can't deal with empty images diff --git a/apps/openmw/mwrender/objectpaging.cpp b/apps/openmw/mwrender/objectpaging.cpp index c756a3fc7f..f49767d1d8 100644 --- a/apps/openmw/mwrender/objectpaging.cpp +++ b/apps/openmw/mwrender/objectpaging.cpp @@ -596,7 +596,7 @@ namespace MWRender if (numinstances > 0) { // add a ref to the original template, to hint to the cache that it's still being used and should be kept in cache - templateRefs->mObjects.push_back(cnode); + templateRefs->mObjects.emplace_back(cnode); if (pair.second.mNeedCompile) { diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 5c79a4d26e..974b419ede 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -428,7 +428,7 @@ namespace MWRender workItem->mKeyframes.push_back(std::string("meshes/") + basemodels[i] + ".kf"); } - workItem->mTextures.push_back("textures/_land_default.dds"); + workItem->mTextures.emplace_back("textures/_land_default.dds"); mWorkQueue->addWorkItem(workItem); } diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 10fc630bdf..cd7a299f76 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -1911,42 +1911,42 @@ void SkyManager::setWaterHeight(float height) void SkyManager::listAssetsToPreload(std::vector& models, std::vector& textures) { - models.push_back("meshes/sky_atmosphere.nif"); + models.emplace_back("meshes/sky_atmosphere.nif"); if (mSceneManager->getVFS()->exists("meshes/sky_night_02.nif")) - models.push_back("meshes/sky_night_02.nif"); - models.push_back("meshes/sky_night_01.nif"); - models.push_back("meshes/sky_clouds_01.nif"); - - models.push_back("meshes\\ashcloud.nif"); - models.push_back("meshes\\blightcloud.nif"); - models.push_back("meshes\\snow.nif"); - models.push_back("meshes\\blizzard.nif"); - - textures.push_back("textures/tx_mooncircle_full_s.dds"); - textures.push_back("textures/tx_mooncircle_full_m.dds"); - - textures.push_back("textures/tx_masser_new.dds"); - textures.push_back("textures/tx_masser_one_wax.dds"); - textures.push_back("textures/tx_masser_half_wax.dds"); - textures.push_back("textures/tx_masser_three_wax.dds"); - textures.push_back("textures/tx_masser_one_wan.dds"); - textures.push_back("textures/tx_masser_half_wan.dds"); - textures.push_back("textures/tx_masser_three_wan.dds"); - textures.push_back("textures/tx_masser_full.dds"); - - textures.push_back("textures/tx_secunda_new.dds"); - textures.push_back("textures/tx_secunda_one_wax.dds"); - textures.push_back("textures/tx_secunda_half_wax.dds"); - textures.push_back("textures/tx_secunda_three_wax.dds"); - textures.push_back("textures/tx_secunda_one_wan.dds"); - textures.push_back("textures/tx_secunda_half_wan.dds"); - textures.push_back("textures/tx_secunda_three_wan.dds"); - textures.push_back("textures/tx_secunda_full.dds"); - - textures.push_back("textures/tx_sun_05.dds"); - textures.push_back("textures/tx_sun_flash_grey_05.dds"); - - textures.push_back("textures/tx_raindrop_01.dds"); + models.emplace_back("meshes/sky_night_02.nif"); + models.emplace_back("meshes/sky_night_01.nif"); + models.emplace_back("meshes/sky_clouds_01.nif"); + + models.emplace_back("meshes\\ashcloud.nif"); + models.emplace_back("meshes\\blightcloud.nif"); + models.emplace_back("meshes\\snow.nif"); + models.emplace_back("meshes\\blizzard.nif"); + + textures.emplace_back("textures/tx_mooncircle_full_s.dds"); + textures.emplace_back("textures/tx_mooncircle_full_m.dds"); + + textures.emplace_back("textures/tx_masser_new.dds"); + textures.emplace_back("textures/tx_masser_one_wax.dds"); + textures.emplace_back("textures/tx_masser_half_wax.dds"); + textures.emplace_back("textures/tx_masser_three_wax.dds"); + textures.emplace_back("textures/tx_masser_one_wan.dds"); + textures.emplace_back("textures/tx_masser_half_wan.dds"); + textures.emplace_back("textures/tx_masser_three_wan.dds"); + textures.emplace_back("textures/tx_masser_full.dds"); + + textures.emplace_back("textures/tx_secunda_new.dds"); + textures.emplace_back("textures/tx_secunda_one_wax.dds"); + textures.emplace_back("textures/tx_secunda_half_wax.dds"); + textures.emplace_back("textures/tx_secunda_three_wax.dds"); + textures.emplace_back("textures/tx_secunda_one_wan.dds"); + textures.emplace_back("textures/tx_secunda_half_wan.dds"); + textures.emplace_back("textures/tx_secunda_three_wan.dds"); + textures.emplace_back("textures/tx_secunda_full.dds"); + + textures.emplace_back("textures/tx_sun_05.dds"); + textures.emplace_back("textures/tx_sun_flash_grey_05.dds"); + + textures.emplace_back("textures/tx_raindrop_01.dds"); } void SkyManager::setWaterEnabled(bool enabled) diff --git a/apps/openmw/mwscript/globalscripts.cpp b/apps/openmw/mwscript/globalscripts.cpp index 41f153b280..1a7e3ebbc8 100644 --- a/apps/openmw/mwscript/globalscripts.cpp +++ b/apps/openmw/mwscript/globalscripts.cpp @@ -186,7 +186,7 @@ namespace MWScript // make list of global scripts to be added std::vector scripts; - scripts.push_back ("main"); + scripts.emplace_back("main"); for (MWWorld::Store::iterator iter = mStore.get().begin(); diff --git a/apps/openmw/mwscript/locals.cpp b/apps/openmw/mwscript/locals.cpp index 381d73ec86..352dc67b3a 100644 --- a/apps/openmw/mwscript/locals.cpp +++ b/apps/openmw/mwscript/locals.cpp @@ -191,7 +191,7 @@ namespace MWScript case 2: value.setType (ESM::VT_Float); value.setFloat (mFloats.at (i2)); break; } - locals.mVariables.push_back (std::make_pair (names[i2], value)); + locals.mVariables.emplace_back (names[i2], value); } } } diff --git a/apps/openmw/mwsound/openal_output.cpp b/apps/openmw/mwsound/openal_output.cpp index 1606b29797..a7be5a743f 100644 --- a/apps/openmw/mwsound/openal_output.cpp +++ b/apps/openmw/mwsound/openal_output.cpp @@ -579,7 +579,7 @@ std::vector OpenAL_Output::enumerate() devnames = alcGetString(nullptr, ALC_DEVICE_SPECIFIER); while(devnames && *devnames) { - devlist.push_back(devnames); + devlist.emplace_back(devnames); devnames += strlen(devnames)+1; } return devlist; @@ -878,7 +878,7 @@ std::vector OpenAL_Output::enumerateHrtf() for(ALCint i = 0;i < num_hrtf;++i) { const ALCchar *entry = alcGetStringiSOFT(mDevice, ALC_HRTF_SPECIFIER_SOFT, i); - ret.push_back(entry); + ret.emplace_back(entry); } return ret; diff --git a/apps/openmw/mwstate/charactermanager.cpp b/apps/openmw/mwstate/charactermanager.cpp index 856264d03b..b5868c3e5a 100644 --- a/apps/openmw/mwstate/charactermanager.cpp +++ b/apps/openmw/mwstate/charactermanager.cpp @@ -77,7 +77,7 @@ MWState::Character* MWState::CharacterManager::createCharacter(const std::string path = mPath / test.str(); } - mCharacters.push_back (Character (path, mGame)); + mCharacters.emplace_back(path, mGame); return &mCharacters.back(); } diff --git a/apps/openmw/mwstate/statemanagerimp.cpp b/apps/openmw/mwstate/statemanagerimp.cpp index d59704bf1c..f331cea495 100644 --- a/apps/openmw/mwstate/statemanagerimp.cpp +++ b/apps/openmw/mwstate/statemanagerimp.cpp @@ -118,8 +118,8 @@ void MWState::StateManager::askLoadRecent() { MWState::Slot lastSave = *character->begin(); std::vector buttons; - buttons.push_back("#{sYes}"); - buttons.push_back("#{sNo}"); + buttons.emplace_back("#{sYes}"); + buttons.emplace_back("#{sNo}"); std::string tag("%s"); std::string message = MWBase::Environment::get().getWindowManager()->getGameSettingString("sLoadLastSaveMsg", tag); size_t pos = message.find(tag); @@ -165,7 +165,7 @@ void MWState::StateManager::newGame (bool bypass) MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu); std::vector buttons; - buttons.push_back("#{sOk}"); + buttons.emplace_back("#{sOk}"); MWBase::Environment::get().getWindowManager()->interactiveMessageBox(error.str(), buttons); } } @@ -306,7 +306,7 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot Log(Debug::Error) << error.str(); std::vector buttons; - buttons.push_back("#{sOk}"); + buttons.emplace_back("#{sOk}"); MWBase::Environment::get().getWindowManager()->interactiveMessageBox(error.str(), buttons); // If no file was written, clean up the slot @@ -557,7 +557,7 @@ void MWState::StateManager::loadGame (const Character *character, const std::str MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu); std::vector buttons; - buttons.push_back("#{sOk}"); + buttons.emplace_back("#{sOk}"); MWBase::Environment::get().getWindowManager()->interactiveMessageBox(error.str(), buttons); } } @@ -633,8 +633,8 @@ bool MWState::StateManager::verifyProfile(const ESM::SavedGame& profile) const if (notFound) { std::vector buttons; - buttons.push_back("#{sYes}"); - buttons.push_back("#{sNo}"); + buttons.emplace_back("#{sYes}"); + buttons.emplace_back("#{sNo}"); MWBase::Environment::get().getWindowManager()->interactiveMessageBox("#{sMissingMastersMsg}", buttons, true); int selectedButton = MWBase::Environment::get().getWindowManager()->readPressedButton(); if (selectedButton == 1 || selectedButton == -1) diff --git a/apps/openmw/mwworld/cellpreloader.cpp b/apps/openmw/mwworld/cellpreloader.cpp index bee6a957dc..9f719178c0 100644 --- a/apps/openmw/mwworld/cellpreloader.cpp +++ b/apps/openmw/mwworld/cellpreloader.cpp @@ -496,7 +496,7 @@ namespace MWWorld else if (mTerrainViews.size() < positions.size()) { for (unsigned int i=mTerrainViews.size(); icreateView()); + mTerrainViews.emplace_back(mTerrain->createView()); } mTerrainPreloadPositions = positions; diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index cf2b97ce7a..6164c4f146 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -1012,7 +1012,7 @@ void MWWorld::InventoryStore::writeState(ESM::InventoryState &state) const std::vector > params; for (std::vector::const_iterator pIt = it->second.begin(); pIt != it->second.end(); ++pIt) { - params.push_back(std::make_pair(pIt->mRandom, pIt->mMultiplier)); + params.emplace_back(pIt->mRandom, pIt->mMultiplier); } state.mPermanentMagicEffectMagnitudes[it->first] = params; diff --git a/apps/openmw/mwworld/localscripts.cpp b/apps/openmw/mwworld/localscripts.cpp index 8a511030da..42914d4ac0 100644 --- a/apps/openmw/mwworld/localscripts.cpp +++ b/apps/openmw/mwworld/localscripts.cpp @@ -101,7 +101,7 @@ void MWWorld::LocalScripts::add (const std::string& scriptName, const Ptr& ptr) break; } - mScripts.push_back (std::make_pair (scriptName, ptr)); + mScripts.emplace_back (scriptName, ptr); } catch (const std::exception& exception) { diff --git a/apps/openmw/mwworld/projectilemanager.cpp b/apps/openmw/mwworld/projectilemanager.cpp index cc906e9327..6d75ac2df7 100644 --- a/apps/openmw/mwworld/projectilemanager.cpp +++ b/apps/openmw/mwworld/projectilemanager.cpp @@ -81,7 +81,7 @@ namespace continue; if (magicEffect->mBolt.empty()) - projectileIDs.push_back("VFX_DefaultBolt"); + projectileIDs.emplace_back("VFX_DefaultBolt"); else projectileIDs.push_back(magicEffect->mBolt); diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 6843762260..4d31945335 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -563,7 +563,7 @@ namespace MWWorld if (iter==mActiveCells.end()) { refsToLoad += MWBase::Environment::get().getWorld()->getExterior(x, y)->count(); - cellsPositionsToLoad.push_back(std::make_pair(x, y)); + cellsPositionsToLoad.emplace_back(x, y); } } } @@ -1027,7 +1027,7 @@ namespace MWWorld { continue; } - teleportDoors.push_back(MWWorld::ConstPtr(&door, cellStore)); + teleportDoors.emplace_back(&door, cellStore); } } diff --git a/apps/openmw/mwworld/store.cpp b/apps/openmw/mwworld/store.cpp index 4c44175879..f8ec8c7c27 100644 --- a/apps/openmw/mwworld/store.cpp +++ b/apps/openmw/mwworld/store.cpp @@ -352,7 +352,7 @@ namespace MWWorld //========================================================================= Store::Store() { - mStatic.push_back(LandTextureList()); + mStatic.emplace_back(); LandTextureList <exl = mStatic[0]; // More than enough to hold Morrowind.esm. Extra lists for plugins will we // added on-the-fly in a different method. diff --git a/components/compiler/scanner.cpp b/components/compiler/scanner.cpp index 9f2865868b..7f1e5cf2cf 100644 --- a/components/compiler/scanner.cpp +++ b/components/compiler/scanner.cpp @@ -638,7 +638,7 @@ namespace Compiler void Scanner::listKeywords (std::vector& keywords) { for (int i=0; Compiler::sKeywords[i]; ++i) - keywords.push_back (Compiler::sKeywords[i]); + keywords.emplace_back(Compiler::sKeywords[i]); if (mExtensions) mExtensions->listKeywords (keywords); diff --git a/components/esm/aisequence.cpp b/components/esm/aisequence.cpp index 7891299e32..df3c1ca9d0 100644 --- a/components/esm/aisequence.cpp +++ b/components/esm/aisequence.cpp @@ -171,7 +171,7 @@ namespace AiSequence int type; esm.getHT(type); - mPackages.push_back(AiPackageContainer()); + mPackages.emplace_back(); mPackages.back().mType = type; switch (type) diff --git a/components/esm/inventorystate.cpp b/components/esm/inventorystate.cpp index 2392d263f5..980d67f7ef 100644 --- a/components/esm/inventorystate.cpp +++ b/components/esm/inventorystate.cpp @@ -76,7 +76,7 @@ void ESM::InventoryState::load (ESMReader &esm) float rand, multiplier; esm.getHT (rand); esm.getHNT (multiplier, "MULT"); - params.push_back(std::make_pair(rand, multiplier)); + params.emplace_back(rand, multiplier); } mPermanentMagicEffectMagnitudes[id] = params; } diff --git a/components/esm/locals.cpp b/components/esm/locals.cpp index bd51be08f6..4149695fe9 100644 --- a/components/esm/locals.cpp +++ b/components/esm/locals.cpp @@ -12,7 +12,7 @@ void ESM::Locals::load (ESMReader &esm) Variant value; value.read (esm, Variant::Format_Local); - mVariables.push_back (std::make_pair (id, value)); + mVariables.emplace_back (id, value); } } diff --git a/components/files/escape.cpp b/components/files/escape.cpp index 93ae9b8851..8b11504d34 100644 --- a/components/files/escape.cpp +++ b/components/files/escape.cpp @@ -121,7 +121,7 @@ namespace Files EscapeStringVector * eSV = boost::any_cast(&v); for (std::vector::const_iterator it = tokens.begin(); it != tokens.end(); ++it) - eSV->mVector.push_back(EscapeHashString(*it)); + eSV->mVector.emplace_back(*it); } PathContainer EscapePath::toPathContainer(const EscapePathContainer & escapePathContainer) diff --git a/components/nifosg/controller.cpp b/components/nifosg/controller.cpp index 0f4c4a5bdf..9c654b9d1b 100644 --- a/components/nifosg/controller.cpp +++ b/components/nifosg/controller.cpp @@ -180,7 +180,7 @@ GeomMorpherController::GeomMorpherController(const GeomMorpherController ©, GeomMorpherController::GeomMorpherController(const Nif::NiMorphData *data) { for (unsigned int i=0; imMorphs.size(); ++i) - mKeyFrames.push_back(FloatInterpolator(data->mMorphs[i].mKeyFrames)); + mKeyFrames.emplace_back(data->mMorphs[i].mKeyFrames); } void GeomMorpherController::update(osg::NodeVisitor *nv, osg::Drawable *drawable) diff --git a/components/sceneutil/lightmanager.cpp b/components/sceneutil/lightmanager.cpp index 415bdae3a0..83dad78263 100644 --- a/components/sceneutil/lightmanager.cpp +++ b/components/sceneutil/lightmanager.cpp @@ -237,7 +237,7 @@ namespace SceneUtil std::vector > lights; lights.reserve(lightList.size()); for (unsigned int i=0; imLightSource->getLight(frameNum)); + lights.emplace_back(lightList[i]->mLightSource->getLight(frameNum)); // the first light state attribute handles the actual state setting for all lights // it's best to batch these up so that we don't need to touch the modelView matrix more than necessary diff --git a/components/sceneutil/mwshadowtechnique.cpp b/components/sceneutil/mwshadowtechnique.cpp index dc22d4d806..3f080b2863 100644 --- a/components/sceneutil/mwshadowtechnique.cpp +++ b/components/sceneutil/mwshadowtechnique.cpp @@ -1508,7 +1508,7 @@ void MWShadowTechnique::createShaders() { perFrameUniformList.clear(); perFrameUniformList.push_back(baseTextureSampler); - perFrameUniformList.push_back(baseTextureUnit.get()); + perFrameUniformList.emplace_back(baseTextureUnit.get()); perFrameUniformList.push_back(maxDistance); perFrameUniformList.push_back(fadeStart); } @@ -1520,7 +1520,7 @@ void MWShadowTechnique::createShaders() sstr<<"shadowTexture"< shadowTextureSampler = new osg::Uniform(sstr.str().c_str(),(int)(settings->getBaseShadowTextureUnit()+sm_i)); for (auto& perFrameUniformList : _uniforms) - perFrameUniformList.push_back(shadowTextureSampler.get()); + perFrameUniformList.emplace_back(shadowTextureSampler.get()); } { @@ -1528,7 +1528,7 @@ void MWShadowTechnique::createShaders() sstr<<"shadowTextureUnit"< shadowTextureUnit = new osg::Uniform(sstr.str().c_str(),(int)(settings->getBaseShadowTextureUnit()+sm_i)); for (auto& perFrameUniformList : _uniforms) - perFrameUniformList.push_back(shadowTextureUnit.get()); + perFrameUniformList.emplace_back(shadowTextureUnit.get()); } } @@ -2558,12 +2558,12 @@ bool MWShadowTechnique::cropShadowCameraToMainFrustum(Frustum& frustum, osg::Cam yMax = convexHull.max(1); zMin = convexHull.min(2); - planeList.push_back(osg::Plane(0.0, -1.0, 0.0, yMax)); - planeList.push_back(osg::Plane(0.0, 1.0, 0.0, -yMin)); - planeList.push_back(osg::Plane(-1.0, 0.0, 0.0, xMax)); - planeList.push_back(osg::Plane(1.0, 0.0, 0.0, -xMin)); + planeList.emplace_back(0.0, -1.0, 0.0, yMax); + planeList.emplace_back(0.0, 1.0, 0.0, -yMin); + planeList.emplace_back(-1.0, 0.0, 0.0, xMax); + planeList.emplace_back(1.0, 0.0, 0.0, -xMin); // In view space, the light is at the most positive value, and we want to cull stuff beyond the minimum value. - planeList.push_back(osg::Plane(0.0, 0.0, 1.0, -zMin)); + planeList.emplace_back(0.0, 0.0, 1.0, -zMin); // Don't add a zMax culling plane - we still want those objects, but don't care about their depth buffer value. } @@ -3192,7 +3192,7 @@ void SceneUtil::MWShadowTechnique::DebugHUD::addAnotherShadowMap() mDebugCameras[shadowMapNumber]->setClearColor(osg::Vec4(1.0, 1.0, 0.0, 1.0)); mDebugCameras[shadowMapNumber]->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); - mDebugGeometry.push_back(osg::createTexturedQuadGeometry(osg::Vec3(-1, -1, 0), osg::Vec3(2, 0, 0), osg::Vec3(0, 2, 0))); + mDebugGeometry.emplace_back(osg::createTexturedQuadGeometry(osg::Vec3(-1, -1, 0), osg::Vec3(2, 0, 0), osg::Vec3(0, 2, 0))); mDebugGeometry[shadowMapNumber]->setCullingActive(false); mDebugCameras[shadowMapNumber]->addChild(mDebugGeometry[shadowMapNumber]); osg::ref_ptr stateSet = mDebugGeometry[shadowMapNumber]->getOrCreateStateSet(); diff --git a/components/sceneutil/statesetupdater.cpp b/components/sceneutil/statesetupdater.cpp index 9fb9ba496c..5d7dbd7559 100644 --- a/components/sceneutil/statesetupdater.cpp +++ b/components/sceneutil/statesetupdater.cpp @@ -73,7 +73,7 @@ namespace SceneUtil : StateSetUpdater(copy, copyop) { for (unsigned int i=0; imObjects.push_back(obj); + mWorkItem->mObjects.emplace_back(obj); } void UnrefQueue::flush(SceneUtil::WorkQueue *workQueue) diff --git a/components/sceneutil/visitor.cpp b/components/sceneutil/visitor.cpp index 876ea920fa..00d18ffcb8 100644 --- a/components/sceneutil/visitor.cpp +++ b/components/sceneutil/visitor.cpp @@ -101,7 +101,7 @@ namespace SceneUtil node.setStateSet(nullptr); if (node.getNodeMask() == 0x1 && node.getNumParents() == 1) - mToRemove.push_back(std::make_pair(&node, node.getParent(0))); + mToRemove.emplace_back(&node, node.getParent(0)); else traverse(node); } @@ -120,12 +120,12 @@ namespace SceneUtil osg::Group* parentParent = static_cast(*(parent - 1)); if (parentGroup->getNumChildren() == 1 && parentGroup->getDataVariance() == osg::Object::STATIC) { - mToRemove.push_back(std::make_pair(parentGroup, parentParent)); + mToRemove.emplace_back(parentGroup, parentParent); return; } } - mToRemove.push_back(std::make_pair(&node, parentGroup)); + mToRemove.emplace_back(&node, parentGroup); } void RemoveTriBipVisitor::apply(osg::Drawable& drw) @@ -150,7 +150,7 @@ namespace SceneUtil { osg::Group* parent = static_cast(*(getNodePath().end()-2)); // Not safe to remove in apply(), since the visitor is still iterating the child list - mToRemove.push_back(std::make_pair(&node, parent)); + mToRemove.emplace_back(&node, parent); } } } diff --git a/components/shader/shadervisitor.cpp b/components/shader/shadervisitor.cpp index c30307f29d..0eab2fd89c 100644 --- a/components/shader/shadervisitor.cpp +++ b/components/shader/shadervisitor.cpp @@ -48,7 +48,7 @@ namespace Shader , mDefaultVsTemplate(defaultVsTemplate) , mDefaultFsTemplate(defaultFsTemplate) { - mRequirements.push_back(ShaderRequirements()); + mRequirements.emplace_back(); } void ShaderVisitor::setForceShaders(bool force) diff --git a/components/terrain/chunkmanager.cpp b/components/terrain/chunkmanager.cpp index 87966b47cc..041414a87a 100644 --- a/components/terrain/chunkmanager.cpp +++ b/components/terrain/chunkmanager.cpp @@ -112,7 +112,7 @@ void ChunkManager::createCompositeMapGeometry(float chunkSize, const osg::Vec2f& geom->setStateSet(*it); - compositeMap.mDrawables.push_back(geom); + compositeMap.mDrawables.emplace_back(geom); } } } diff --git a/components/terrain/viewdata.cpp b/components/terrain/viewdata.cpp index c24252b7d5..e4d043ffc4 100644 --- a/components/terrain/viewdata.cpp +++ b/components/terrain/viewdata.cpp @@ -192,7 +192,7 @@ ViewData *ViewDataMap::createOrReuseView() } else { - mViewVector.push_back(ViewData()); + mViewVector.emplace_back(); vd = &mViewVector.back(); } mUsedViews.push_back(vd); diff --git a/components/vfs/bsaarchive.cpp b/components/vfs/bsaarchive.cpp index 9646b62afa..ac65c58a1c 100644 --- a/components/vfs/bsaarchive.cpp +++ b/components/vfs/bsaarchive.cpp @@ -21,7 +21,7 @@ BsaArchive::BsaArchive(const std::string &filename) const Bsa::BSAFile::FileList &filelist = mFile->getList(); for(Bsa::BSAFile::FileList::const_iterator it = filelist.begin();it != filelist.end();++it) { - mResources.push_back(BsaArchiveFile(&*it, mFile.get())); + mResources.emplace_back(&*it, mFile.get()); } } diff --git a/components/widgets/list.cpp b/components/widgets/list.cpp index 73e01675a7..bf24acf7e1 100644 --- a/components/widgets/list.cpp +++ b/components/widgets/list.cpp @@ -34,7 +34,7 @@ namespace Gui void MWList::addSeparator() { - mItems.push_back(""); + mItems.emplace_back(""); } void MWList::adjustSize()