diff --git a/Runtime/CMemoryCardSys.cpp b/Runtime/CMemoryCardSys.cpp index a01ccbe7a..a3de34a70 100644 --- a/Runtime/CMemoryCardSys.cpp +++ b/Runtime/CMemoryCardSys.cpp @@ -30,12 +30,12 @@ bool CSaveWorldIntermediate::InitializePump() { x4_strgId = wld.IGetStringTableAssetId(); x8_savwId = wld.IGetSaveWorldAssetId(); - u32 areaCount = wld.IGetAreaCount(); + const u32 areaCount = wld.IGetAreaCount(); xc_areaIds.reserve(areaCount); for (u32 i = 0; i < areaCount; ++i) { const IGameArea* area = wld.IGetAreaAlways(i); - xc_areaIds.push_back(area->IGetAreaId()); + xc_areaIds.emplace_back(area->IGetAreaId()); } CAssetId mlvlId = wld.IGetWorldAssetId(); diff --git a/Runtime/CSaveWorld.cpp b/Runtime/CSaveWorld.cpp index abd25053e..4edc5ccf4 100644 --- a/Runtime/CSaveWorld.cpp +++ b/Runtime/CSaveWorld.cpp @@ -14,13 +14,13 @@ CSaveWorld::CSaveWorld(CInputStream& in) { const u32 cinematicCount = in.readUint32Big(); x4_cinematics.reserve(cinematicCount); for (u32 i = 0; i < cinematicCount; ++i) { - x4_cinematics.push_back(in.readUint32Big()); + x4_cinematics.emplace_back(in.readUint32Big()); } const u32 relayCount = in.readUint32Big(); x14_relays.reserve(relayCount); for (u32 i = 0; i < relayCount; ++i) { - x14_relays.push_back(in.readUint32Big()); + x14_relays.emplace_back(in.readUint32Big()); } } @@ -35,7 +35,7 @@ CSaveWorld::CSaveWorld(CInputStream& in) { const u32 doorCount = in.readUint32Big(); x34_doors.reserve(doorCount); for (u32 i = 0; i < doorCount; ++i) { - x34_doors.push_back(in.readUint32Big()); + x34_doors.emplace_back(in.readUint32Big()); } if (version <= 0) { diff --git a/Runtime/GuiSys/CHudDecoInterface.cpp b/Runtime/GuiSys/CHudDecoInterface.cpp index c173b7187..5a7156584 100644 --- a/Runtime/GuiSys/CHudDecoInterface.cpp +++ b/Runtime/GuiSys/CHudDecoInterface.cpp @@ -475,7 +475,7 @@ CHudDecoInterfaceThermal::CHudDecoInterfaceThermal(CGuiFrame& selHud) { if (CGuiWidget* w = selHud.FindWidget("basewidget_lock")) { for (CGuiWidget* c = static_cast(w->GetChildObject()); c; c = static_cast(c->GetNextSibling())) { - x84_lockonWidgets.push_back({c, c->GetLocalTransform()}); + x84_lockonWidgets.emplace_back(c, c->GetLocalTransform()); c->SetLocalTransform(c->GetLocalTransform() * zeus::CTransform::Scale(x68_lockonScale)); } } diff --git a/Runtime/GuiSys/CRasterFont.cpp b/Runtime/GuiSys/CRasterFont.cpp index 3f9af601d..4f2c5f894 100644 --- a/Runtime/GuiSys/CRasterFont.cpp +++ b/Runtime/GuiSys/CRasterFont.cpp @@ -64,8 +64,8 @@ CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store) { baseline = in.readByte(); kernStart = in.readInt16Big(); } - xc_glyphs.push_back(std::make_pair( - chr, CGlyph(a, b, c, startU, startV, endU, endV, cellWidth, cellHeight, baseline, kernStart, layer))); + xc_glyphs.emplace_back( + chr, CGlyph(a, b, c, startU, startV, endU, endV, cellWidth, cellHeight, baseline, kernStart, layer)); } std::sort(xc_glyphs.begin(), xc_glyphs.end(), [=](auto& a, auto& b) -> bool { return a.first < b.first; }); diff --git a/Runtime/GuiSys/CTextParser.cpp b/Runtime/GuiSys/CTextParser.cpp index f1852f15a..952e8b35d 100644 --- a/Runtime/GuiSys/CTextParser.cpp +++ b/Runtime/GuiSys/CTextParser.cpp @@ -188,7 +188,7 @@ CFontImageDef CTextParser::GetImage(const char16_t* str, int len, texs.reserve(commaCount - 1); do { AdvanceCommaPos(); - texs.push_back(x0_store.GetObj({SBIG('TXTR'), GetAssetIdFromString(&iterable[tokenPos], len, txtrMap)})); + texs.emplace_back(x0_store.GetObj({SBIG('TXTR'), GetAssetIdFromString(&iterable[tokenPos], len, txtrMap)})); AdvanceTokenPos(); } while (commaPos != iterable.size()); @@ -211,7 +211,7 @@ CFontImageDef CTextParser::GetImage(const char16_t* str, int len, texs.reserve(commaCount - 3); do { AdvanceCommaPos(); - texs.push_back(x0_store.GetObj({SBIG('TXTR'), GetAssetIdFromString(&iterable[tokenPos], len, txtrMap)})); + texs.emplace_back(x0_store.GetObj({SBIG('TXTR'), GetAssetIdFromString(&iterable[tokenPos], len, txtrMap)})); AdvanceTokenPos(); } while (commaPos != iterable.size()); diff --git a/Runtime/GuiSys/CTextRenderBuffer.cpp b/Runtime/GuiSys/CTextRenderBuffer.cpp index 2688855fe..2888b5867 100644 --- a/Runtime/GuiSys/CTextRenderBuffer.cpp +++ b/Runtime/GuiSys/CTextRenderBuffer.cpp @@ -174,7 +174,7 @@ void CTextRenderBuffer::AddImage(const zeus::CVector2i& offset, const CFontImage if (x0_mode == EMode::AllocTally) m_primitiveMarks.push_back({Command::ImageRender, m_imagesCount++, 0}); else - m_images.push_back({image, offset}); + m_images.emplace_back(image, offset); } void CTextRenderBuffer::AddCharacter(const zeus::CVector2i& offset, char16_t ch, const zeus::CColor& color) { @@ -209,7 +209,7 @@ void CTextRenderBuffer::AddFontChange(const TToken& font) { } m_activeFontCh = m_fontCharacters.size(); - m_fontCharacters.push_back({font}); + m_fontCharacters.emplace_back(font); } bool CTextRenderBuffer::HasSpaceAvailable(const zeus::CVector2i& origin, const zeus::CVector2i& extent) const { diff --git a/Runtime/Particle/CColorElement.cpp b/Runtime/Particle/CColorElement.cpp index 2e94b01e4..05489c698 100644 --- a/Runtime/Particle/CColorElement.cpp +++ b/Runtime/Particle/CColorElement.cpp @@ -19,10 +19,11 @@ CCEKeyframeEmitter::CCEKeyframeEmitter(CInputStream& in) { x10_loopEnd = in.readUint32Big(); x14_loopStart = in.readUint32Big(); - u32 count = in.readUint32Big(); + const u32 count = in.readUint32Big(); x18_keys.reserve(count); - for (u32 i = 0; i < count; ++i) - x18_keys.push_back(in.readVec4fBig()); + for (u32 i = 0; i < count; ++i) { + x18_keys.emplace_back(in.readVec4fBig()); + } } bool CCEKeyframeEmitter::GetValue(int frame, zeus::CColor& valOut) const { diff --git a/Runtime/Particle/CParticleElectric.cpp b/Runtime/Particle/CParticleElectric.cpp index b560439cb..c15d7cb61 100644 --- a/Runtime/Particle/CParticleElectric.cpp +++ b/Runtime/Particle/CParticleElectric.cpp @@ -333,7 +333,7 @@ void CParticleElectric::CreateNewParticles(int count) { if (CIntElement* slif = x1c_elecDesc->x4_SLIF.get()) slif->GetValue(x28_currentFrame, lifetime); - x3e8_electricManagers.push_back(CParticleElectricManager(allocIdx, lifetime, x28_currentFrame)); + x3e8_electricManagers.emplace_back(allocIdx, lifetime, x28_currentFrame); CParticleElectricManager& elec = x3e8_electricManagers.back(); CParticleGlobals::instance()->SetParticleLifetime(elec.xc_endFrame - elec.x8_startFrame); int frame = x28_currentFrame - elec.x8_startFrame; diff --git a/Runtime/Particle/CVectorElement.cpp b/Runtime/Particle/CVectorElement.cpp index 807f4ce02..27fd0531d 100644 --- a/Runtime/Particle/CVectorElement.cpp +++ b/Runtime/Particle/CVectorElement.cpp @@ -19,10 +19,11 @@ CVEKeyframeEmitter::CVEKeyframeEmitter(CInputStream& in) { x10_loopEnd = in.readUint32Big(); x14_loopStart = in.readUint32Big(); - u32 count = in.readUint32Big(); + const u32 count = in.readUint32Big(); x18_keys.reserve(count); - for (u32 i = 0; i < count; ++i) - x18_keys.push_back(in.readVec3fBig()); + for (u32 i = 0; i < count; ++i) { + x18_keys.emplace_back(in.readVec3fBig()); + } } bool CVEKeyframeEmitter::GetValue(int frame, zeus::CVector3f& valOut) const { diff --git a/Runtime/World/CGameArea.cpp b/Runtime/World/CGameArea.cpp index 8172d8bc0..674eeda5b 100644 --- a/Runtime/World/CGameArea.cpp +++ b/Runtime/World/CGameArea.cpp @@ -353,28 +353,31 @@ CGameArea::CGameArea(CInputStream& in, int idx, int mlvlVersion) : x4_selfIdx(id else x88_areaId = -1; - u32 attachedCount = in.readUint32Big(); + const u32 attachedCount = in.readUint32Big(); x8c_attachedAreaIndices.reserve(attachedCount); - for (u32 i = 0; i < attachedCount; ++i) - x8c_attachedAreaIndices.push_back(in.readUint16Big()); + for (u32 i = 0; i < attachedCount; ++i) { + x8c_attachedAreaIndices.emplace_back(in.readUint16Big()); + } x9c_deps1 = ::urde::ReadDependencyList(in); xac_deps2 = ::urde::ReadDependencyList(in); - zeus::CAABox aabb = x6c_aabb.getTransformedAABox(xc_transform); + const zeus::CAABox aabb = x6c_aabb.getTransformedAABox(xc_transform); x6c_aabb = aabb; if (mlvlVersion > 13) { - u32 depCount = in.readUint32Big(); + const u32 depCount = in.readUint32Big(); xbc_layerDepOffsets.reserve(depCount); - for (u32 i = 0; i < depCount; ++i) - xbc_layerDepOffsets.push_back(in.readUint32Big()); + for (u32 i = 0; i < depCount; ++i) { + xbc_layerDepOffsets.emplace_back(in.readUint32Big()); + } } - u32 dockCount = in.readUint32Big(); + const u32 dockCount = in.readUint32Big(); xcc_docks.reserve(dockCount); - for (u32 i = 0; i < dockCount; ++i) - xcc_docks.push_back({in, xc_transform}); + for (u32 i = 0; i < dockCount; ++i) { + xcc_docks.emplace_back(in, xc_transform); + } ClearTokenList(); diff --git a/Runtime/World/CScriptPickupGenerator.cpp b/Runtime/World/CScriptPickupGenerator.cpp index ed7d72add..684384f66 100644 --- a/Runtime/World/CScriptPickupGenerator.cpp +++ b/Runtime/World/CScriptPickupGenerator.cpp @@ -89,10 +89,10 @@ float CScriptPickupGenerator::GetPickupTemplates(CStateManager& mgr, doAlways = true; break; } - bool thirtyPercTest = mgr.GetActiveRandom()->Float() < 0.3f; + const bool thirtyPercTest = mgr.GetActiveRandom()->Float() < 0.3f; if ((doAlways || (doThirtyPerc && thirtyPercTest)) && possibility > 0.f) { totalPossibility += possibility * multiplier; - idsOut.push_back(std::make_pair(possibility, conn.x8_objId)); + idsOut.emplace_back(possibility, conn.x8_objId); } } } diff --git a/Runtime/World/CScriptSpecialFunction.cpp b/Runtime/World/CScriptSpecialFunction.cpp index d1fa1b38b..84d4aae21 100644 --- a/Runtime/World/CScriptSpecialFunction.cpp +++ b/Runtime/World/CScriptSpecialFunction.cpp @@ -254,7 +254,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId auto search = mgr.GetIdListForScript(conn.x8_objId); for (auto it = search.first; it != search.second; ++it) { if (TCastToPtr act = mgr.ObjectById(it->second)) { - x198_ringControllers.push_back(SRingController(it->second, 0.f, false)); + x198_ringControllers.emplace_back(it->second, 0.f, false); act->RemoveMaterial(EMaterialTypes::Occluder, mgr); } } diff --git a/Runtime/World/CScriptTrigger.cpp b/Runtime/World/CScriptTrigger.cpp index bd84015e6..cdb7d8af9 100644 --- a/Runtime/World/CScriptTrigger.cpp +++ b/Runtime/World/CScriptTrigger.cpp @@ -242,7 +242,7 @@ void CScriptTrigger::Touch(CActor& act, CStateManager& mgr) { } if (True(testFlags & x12c_flags)) { - xe8_inhabitants.push_back(act.GetUniqueId()); + xe8_inhabitants.emplace_back(act.GetUniqueId()); InhabitantAdded(act, mgr); if (pl) {