Use emplace_back instead of push_back

pull/3018/head
Andrei Kortunov 4 years ago
parent bf45bd5802
commit 065ed5138e

@ -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;
}

@ -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<boost::filesystem::path> files;
for (const QString &path : mFileDialog.selectedFilePaths()) {
files.push_back(path.toUtf8().constData());
files.emplace_back(path.toUtf8().constData());
}
files.push_back (savePath);

@ -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)

@ -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)

@ -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;
}

@ -182,7 +182,7 @@ namespace CSMPrefs
}
else if (pos == lastPos)
{
potentials.push_back(std::make_pair(result, shortcut));
potentials.emplace_back(result, shortcut);
}
}
}

@ -127,7 +127,7 @@ std::vector<CSMWorld::UniversalId> 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
}

@ -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;
}

@ -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<UniversalId::Type, NestedRefIdAdapterBase*> 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<UniversalId::Type, NestedRefIdAdapterBase*> effectsMap;
effectsMap.insert(std::make_pair(UniversalId::Type_Potion,
new EffectsRefIdAdapter<ESM::Potion> (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<UniversalId::Type, NestedRefIdAdapterBase*> inventoryMap;
inventoryMap.insert(std::make_pair(UniversalId::Type_Npc,
new NestedInventoryRefIdAdapter<ESM::NPC> (UniversalId::Type_Npc)));
inventoryMap.insert(std::make_pair(UniversalId::Type_Creature,
new NestedInventoryRefIdAdapter<ESM::Creature> (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<UniversalId::Type, NestedRefIdAdapterBase*> spellsMap;
spellsMap.insert(std::make_pair(UniversalId::Type_Npc,
new NestedSpellRefIdAdapter<ESM::NPC> (UniversalId::Type_Npc)));
spellsMap.insert(std::make_pair(UniversalId::Type_Creature,
new NestedSpellRefIdAdapter<ESM::Creature> (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<UniversalId::Type, NestedRefIdAdapterBase*> destMap;
destMap.insert(std::make_pair(UniversalId::Type_Npc,
new NestedTravelRefIdAdapter<ESM::NPC> (UniversalId::Type_Npc)));
destMap.insert(std::make_pair(UniversalId::Type_Creature,
new NestedTravelRefIdAdapter<ESM::Creature> (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<UniversalId::Type, NestedRefIdAdapterBase*> aiMap;
aiMap.insert(std::make_pair(UniversalId::Type_Npc,
new ActorAiRefIdAdapter<ESM::NPC> (UniversalId::Type_Npc)));
aiMap.insert(std::make_pair(UniversalId::Type_Creature,
new ActorAiRefIdAdapter<ESM::Creature> (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<UniversalId::Type, NestedRefIdAdapterBase*> contMap;
contMap.insert(std::make_pair(UniversalId::Type_Container,
new NestedInventoryRefIdAdapter<ESM::Container> (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<UniversalId::Type, NestedRefIdAdapterBase*> 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<UniversalId::Type, NestedRefIdAdapterBase*> 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<UniversalId::Type, NestedRefIdAdapterBase*> 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<UniversalId::Type, NestedRefIdAdapterBase*> 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<UniversalId::Type, NestedRefIdAdapterBase*> 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<UniversalId::Type, NestedRefIdAdapterBase*> 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<UniversalId::Type, NestedRefIdAdapterBase*> partMap;
partMap.insert(std::make_pair(UniversalId::Type_Armor,
new BodyPartRefIdAdapter<ESM::Armor> (UniversalId::Type_Armor)));
partMap.insert(std::make_pair(UniversalId::Type_Clothing,
new BodyPartRefIdAdapter<ESM::Clothing> (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<UniversalId::Type, NestedRefIdAdapterBase*> levListMap;
levListMap.insert(std::make_pair(UniversalId::Type_CreatureLevelledList,
new NestedLevListRefIdAdapter<ESM::CreatureLevList> (UniversalId::Type_CreatureLevelledList)));
levListMap.insert(std::make_pair(UniversalId::Type_ItemLevelledList,
new NestedLevListRefIdAdapter<ESM::ItemLevList> (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<UniversalId::Type, NestedRefIdAdapterBase*> nestedListLevListMap;
nestedListLevListMap.insert(std::make_pair(UniversalId::Type_CreatureLevelledList,
new NestedListLevListRefIdAdapter<ESM::CreatureLevList> (UniversalId::Type_CreatureLevelledList)));
nestedListLevListMap.insert(std::make_pair(UniversalId::Type_ItemLevelledList,
new NestedListLevListRefIdAdapter<ESM::ItemLevList> (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(

@ -553,7 +553,7 @@ std::vector<osg::ref_ptr<CSVRender::TagBase> > 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;
}

@ -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());
}

@ -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;
}
}

@ -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);
}

@ -345,18 +345,16 @@ std::vector< CSMWorld::UniversalId > CSVWorld::RegionMap::getDraggedRecords() co
std::vector<CSMWorld::UniversalId> 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;
}

@ -452,7 +452,7 @@ std::vector<std::string> 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<std::string> 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;

@ -133,12 +133,12 @@ void CSVWorld::TableSubView::createFilterRequest (std::vector< CSMWorld::Univers
std::vector<std::string> 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);
}
}

@ -431,12 +431,12 @@ namespace MWClass
const MWWorld::LiveCellRef<ESM::NPC> *npc = ptr.get<ESM::NPC>();
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().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);

@ -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<std::pair<std::string, int> >& DialogueManager::getChoices()

@ -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<KeywordSearch<std::string, int /*unused*/>::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);
}
}

@ -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);

@ -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);
}
}

@ -217,7 +217,7 @@ namespace MWGui
if (store.get<ESM::Class>().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);

@ -163,8 +163,8 @@ bool CompanionWindow::exit()
if (mModel && mModel->hasProfit(mPtr) && getProfit(mPtr) < 0)
{
std::vector<std::string> 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;

@ -49,14 +49,14 @@ ContainerItemModel::ContainerItemModel(const std::vector<MWWorld::Ptr>& 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

@ -123,7 +123,7 @@ namespace MWGui
}
std::vector<std::string> buttons;
buttons.push_back("#{sOk}");
buttons.emplace_back("#{sOk}");
MWBase::Environment::get().getWindowManager()->interactiveMessageBox(message, buttons);
}
}

@ -231,25 +231,25 @@ namespace MWGui
std::vector<std::string> 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<std::string> allButtons { "return", "newgame", "savegame", "loadgame", "options", "credits", "exitgame"};

@ -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);

@ -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<int, int>& resolution : resolutions)

@ -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<std::string> 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()

@ -12,8 +12,8 @@ namespace MWGui
{
mSoulgem = soulgem;
std::vector<std::string> 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);
}

@ -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<Gui::TextBox>("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);
}

@ -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);

@ -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<std::pair<MWMechanics::EffectKey, float>> mMagnitudes;

@ -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;
}
}

@ -65,7 +65,7 @@ namespace
virtual void apply(osg::Node &node)
{
if (dynamic_cast<osgParticle::ParticleProcessor*>(&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<osgParticle::ParticleSystem*>(&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<osg::Group*>(*(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<osg::Group*>(*(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);
}
}
};

@ -118,7 +118,7 @@ void LocalMap::saveFogOfWar(MWWorld::CellStore* cell)
if (segment.mFogOfWarImage && segment.mHasFogState)
{
std::unique_ptr<ESM::FogState> 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

@ -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)
{

@ -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);
}

@ -1911,42 +1911,42 @@ void SkyManager::setWaterHeight(float height)
void SkyManager::listAssetsToPreload(std::vector<std::string>& models, std::vector<std::string>& 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)

@ -186,7 +186,7 @@ namespace MWScript
// make list of global scripts to be added
std::vector<std::string> scripts;
scripts.push_back ("main");
scripts.emplace_back("main");
for (MWWorld::Store<ESM::StartScript>::iterator iter =
mStore.get<ESM::StartScript>().begin();

@ -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);
}
}
}

@ -579,7 +579,7 @@ std::vector<std::string> 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<std::string> 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;

@ -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();
}

@ -118,8 +118,8 @@ void MWState::StateManager::askLoadRecent()
{
MWState::Slot lastSave = *character->begin();
std::vector<std::string> 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<std::string> 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<std::string> 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<std::string> 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<std::string> 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)

@ -496,7 +496,7 @@ namespace MWWorld
else if (mTerrainViews.size() < positions.size())
{
for (unsigned int i=mTerrainViews.size(); i<positions.size(); ++i)
mTerrainViews.push_back(mTerrain->createView());
mTerrainViews.emplace_back(mTerrain->createView());
}
mTerrainPreloadPositions = positions;

@ -1012,7 +1012,7 @@ void MWWorld::InventoryStore::writeState(ESM::InventoryState &state) const
std::vector<std::pair<float, float> > params;
for (std::vector<EffectParams>::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;

@ -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)
{

@ -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);

@ -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);
}
}

@ -352,7 +352,7 @@ namespace MWWorld
//=========================================================================
Store<ESM::LandTexture>::Store()
{
mStatic.push_back(LandTextureList());
mStatic.emplace_back();
LandTextureList &ltexl = mStatic[0];
// More than enough to hold Morrowind.esm. Extra lists for plugins will we
// added on-the-fly in a different method.

@ -638,7 +638,7 @@ namespace Compiler
void Scanner::listKeywords (std::vector<std::string>& 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);

@ -171,7 +171,7 @@ namespace AiSequence
int type;
esm.getHT(type);
mPackages.push_back(AiPackageContainer());
mPackages.emplace_back();
mPackages.back().mType = type;
switch (type)

@ -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;
}

@ -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);
}
}

@ -121,7 +121,7 @@ namespace Files
EscapeStringVector * eSV = boost::any_cast<EscapeStringVector>(&v);
for (std::vector<std::string>::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)

@ -180,7 +180,7 @@ GeomMorpherController::GeomMorpherController(const GeomMorpherController &copy,
GeomMorpherController::GeomMorpherController(const Nif::NiMorphData *data)
{
for (unsigned int i=0; i<data->mMorphs.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)

@ -237,7 +237,7 @@ namespace SceneUtil
std::vector<osg::ref_ptr<osg::Light> > lights;
lights.reserve(lightList.size());
for (unsigned int i=0; i<lightList.size();++i)
lights.push_back(lightList[i]->mLightSource->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

@ -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"<<sm_i;
osg::ref_ptr<osg::Uniform> 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"<<sm_i;
osg::ref_ptr<osg::Uniform> 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<osg::StateSet> stateSet = mDebugGeometry[shadowMapNumber]->getOrCreateStateSet();

@ -73,7 +73,7 @@ namespace SceneUtil
: StateSetUpdater(copy, copyop)
{
for (unsigned int i=0; i<copy.mCtrls.size(); ++i)
mCtrls.push_back(osg::clone(copy.mCtrls[i].get(), copyop));
mCtrls.emplace_back(osg::clone(copy.mCtrls[i].get(), copyop));
}
unsigned int CompositeStateSetUpdater::getNumControllers()
@ -88,7 +88,7 @@ namespace SceneUtil
void CompositeStateSetUpdater::addController(StateSetUpdater *ctrl)
{
mCtrls.push_back(ctrl);
mCtrls.emplace_back(ctrl);
}
}

@ -18,7 +18,7 @@ namespace SceneUtil
void UnrefQueue::push(const osg::Referenced *obj)
{
mWorkItem->mObjects.push_back(obj);
mWorkItem->mObjects.emplace_back(obj);
}
void UnrefQueue::flush(SceneUtil::WorkQueue *workQueue)

@ -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<osg::Group*>(*(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<osg::Group*>(*(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);
}
}
}

@ -48,7 +48,7 @@ namespace Shader
, mDefaultVsTemplate(defaultVsTemplate)
, mDefaultFsTemplate(defaultFsTemplate)
{
mRequirements.push_back(ShaderRequirements());
mRequirements.emplace_back();
}
void ShaderVisitor::setForceShaders(bool force)

@ -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);
}
}
}

@ -192,7 +192,7 @@ ViewData *ViewDataMap::createOrReuseView()
}
else
{
mViewVector.push_back(ViewData());
mViewVector.emplace_back();
vd = &mViewVector.back();
}
mUsedViews.push_back(vd);

@ -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());
}
}

@ -34,7 +34,7 @@ namespace Gui
void MWList::addSeparator()
{
mItems.push_back("");
mItems.emplace_back("");
}
void MWList::adjustSize()

Loading…
Cancel
Save