From 46e93a11bf4ff9b5cb9289f62a91ed943d5166ba Mon Sep 17 00:00:00 2001 From: Build Date: Wed, 4 Apr 2018 14:22:25 +0200 Subject: [PATCH] !XX Fix compilation error caused by unchecked auto-resolve. Copied from Perforce Change: 1674095 --- .../ParticleSystem/Features/ParamModImpl.h | 55 ++++++++-------------- 1 file changed, 19 insertions(+), 36 deletions(-) diff --git a/Code/CryEngine/Cry3DEngine/ParticleSystem/Features/ParamModImpl.h b/Code/CryEngine/Cry3DEngine/ParticleSystem/Features/ParamModImpl.h index 424394039..2039d85d4 100644 --- a/Code/CryEngine/Cry3DEngine/ParticleSystem/Features/ParamModImpl.h +++ b/Code/CryEngine/Cry3DEngine/ParticleSystem/Features/ParamModImpl.h @@ -1,11 +1,4 @@ -// Copyright 2001-2018 Crytek GmbH / Crytek Group. All rights reserved. - -// ------------------------------------------------------------------------- -// Created: 25/03/2015 by Filipe amim -// Description: -// ------------------------------------------------------------------------- -// -//////////////////////////////////////////////////////////////////////////// +// Copyright 2001-2018 Crytek GmbH / Crytek Group. All rights reserved. #include #include "ParamMod.h" @@ -29,8 +22,7 @@ void CParamMod::AddToComponent(CParticleComponent* pCompon { m_modInit.clear(); m_modUpdate.clear(); - auto it = std::remove_if(m_modifiers.begin(), m_modifiers.end(), [](const PModifier& ptr) { return !ptr; }); - m_modifiers.erase(it, m_modifiers.end()); + stl::find_and_erase_all(m_modifiers, nullptr); if (Context().GetDomain() == EMD_PerParticle) pComponent->InitParticles.add(pFeature); @@ -43,14 +35,14 @@ void CParamMod::AddToComponent(CParticleComponent* pCompon } template -void CParamMod::AddToComponent(CParticleComponent* pComponent, CParticleFeature* pFeature, EParticleDataType dataType) +void CParamMod::AddToComponent(CParticleComponent* pComponent, CParticleFeature* pFeature, TDataType dataType) { AddToComponent(pComponent, pFeature); pComponent->AddParticleData(dataType); if (dataType.info().hasInit && !m_modUpdate.empty()) { - pComponent->AddParticleData(InitType(dataType)); + pComponent->AddParticleData(dataType.InitType()); if (Context().GetDomain() == EMD_PerParticle) pComponent->UpdateParticles.add(pFeature); } @@ -79,7 +71,7 @@ void CParamMod::Serialize(Serialization::IArchive& ar) } template -void CParamMod::InitParticles(const SUpdateContext& context, EParticleDataType dataType) const +void CParamMod::InitParticles(const SUpdateContext& context, TDataType dataType) const { CRY_PFX2_PROFILE_DETAIL; @@ -87,52 +79,43 @@ void CParamMod::InitParticles(const SUpdateContext& contex if (container.GetMaxParticles() == 0 || !container.HasData(dataType)) return; - TIOStream dataStream = container.GetTIOStream(dataType); - SUpdateRange spawnRange = container.GetSpawnedRange(); - - dataStream.Fill(spawnRange, m_baseValue); - - for (auto & pModifier : m_modInit) - pModifier->Modify(context, spawnRange, dataStream, dataType, EMD_PerParticle); + TIOStream stream = container.IOStream(dataType); + ModifyInit(context, stream, context.GetSpawnedRange(), dataType); if (dataType.info().hasInit) - container.CopyData(InitType(dataType), dataType, spawnRange); + container.CopyData(dataType.InitType(), dataType, context.GetSpawnedRange()); } template -void CParamMod::Update(const SUpdateContext& context, EParticleDataType dataType) const +void CParamMod::Update(const SUpdateContext& context, TDataType dataType) const { CParticleContainer& container = context.m_container; if (container.GetMaxParticles() == 0 || !container.HasData(dataType)) return; - TIOStream stream = container.GetTIOStream(dataType); - for (auto& pModifier : m_modUpdate) - pModifier->Modify(context, context.m_updateRange, stream, dataType, EMD_PerParticle); + CRY_PFX2_ASSERT(context.GetUpdateRange().m_end <= container.GetNumParticles()); + TIOStream stream = container.IOStream(dataType); + ModifyUpdate(context, stream, context.GetUpdateRange(), dataType); } template -void CParamMod::ModifyInit(const SUpdateContext& context, TType* data, SUpdateRange range) const +void CParamMod::ModifyInit(const SUpdateContext& context, TIOStream& stream, SUpdateRange range, TDataType dataType) const { CRY_PFX2_PROFILE_DETAIL; - TIOStream dataStream(data); - - dataStream.Fill(range, m_baseValue); + stream.Fill(range, m_baseValue); const EModDomain domain = Context().GetDomain(); for (auto& pModifier : m_modInit) - pModifier->Modify(context, range, dataStream, EParticleDataType(), domain); + pModifier->Modify(context, range, stream, dataType, domain); } template -void CParamMod::ModifyUpdate(const SUpdateContext& context, TType* data, SUpdateRange range) const +void CParamMod::ModifyUpdate(const SUpdateContext& context, TIOStream& stream, SUpdateRange range, TDataType dataType) const { CRY_PFX2_PROFILE_DETAIL; - TIOStream dataStream(data); - const EModDomain domain = Context().GetDomain(); for (auto& pModifier : m_modUpdate) - pModifier->Modify(context, range, dataStream, EParticleDataType(), domain); + pModifier->Modify(context, range, stream, dataType, domain); } template @@ -146,14 +129,14 @@ TRange CParamMod::GetValues(const SUpda for (auto & pMod : m_modInit) { if (pMod->GetDomain() >= domain) - pMod->Modify(context, range, stream, EParticleDataType(), domain); + pMod->Modify(context, range, stream, TDataType(), domain); else minmax = minmax * pMod->GetMinMax(); } for (auto& pMod : m_modUpdate) { if (updating && pMod->GetDomain() >= domain) - pMod->Modify(context, range, stream, EParticleDataType(), domain); + pMod->Modify(context, range, stream, TDataType(), domain); else minmax = minmax * pMod->GetMinMax(); } -- 2.11.4.GIT