mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-07-02 03:13:38 +00:00
CDamageableTriggerExtra: Make use of unique_ptr
Safer lifetime management.
This commit is contained in:
parent
81560138c0
commit
3dd325f708
@ -31,15 +31,12 @@ CDamageableTriggerExtra::CDamageableTriggerExtra(CScriptObject *pInstance, CScen
|
||||
}
|
||||
}
|
||||
|
||||
CDamageableTriggerExtra::~CDamageableTriggerExtra()
|
||||
{
|
||||
delete mpMat;
|
||||
}
|
||||
CDamageableTriggerExtra::~CDamageableTriggerExtra() = default;
|
||||
|
||||
void CDamageableTriggerExtra::CreateMaterial()
|
||||
{
|
||||
ASSERT(!mpMat);
|
||||
mpMat = new CMaterial(mGame, EVertexAttribute::Position | EVertexAttribute::Normal | EVertexAttribute::Tex0);
|
||||
mpMat = std::make_unique<CMaterial>(mGame, EVertexAttribute::Position | EVertexAttribute::Normal | EVertexAttribute::Tex0);
|
||||
|
||||
// Most values/TEV setup were found from the executable + from graphics debuggers
|
||||
// Animation parameters are estimates from eyeballing the values ingame
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "CScriptExtra.h"
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
||||
class CDamageableTriggerExtra : public CScriptExtra
|
||||
{
|
||||
@ -24,7 +25,7 @@ private:
|
||||
TEnumRef<ERenderSide> mRenderSide;
|
||||
std::array<CAssetRef, 3> mTextureAssets;
|
||||
|
||||
CMaterial* mpMat = nullptr;
|
||||
std::unique_ptr<CMaterial> mpMat;
|
||||
std::array<CTexture*, 3> mpTextures{};
|
||||
CVector2f mCoordScale;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user