mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-07-04 12:15:58 +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()
|
CDamageableTriggerExtra::~CDamageableTriggerExtra() = default;
|
||||||
{
|
|
||||||
delete mpMat;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CDamageableTriggerExtra::CreateMaterial()
|
void CDamageableTriggerExtra::CreateMaterial()
|
||||||
{
|
{
|
||||||
ASSERT(!mpMat);
|
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
|
// Most values/TEV setup were found from the executable + from graphics debuggers
|
||||||
// Animation parameters are estimates from eyeballing the values ingame
|
// Animation parameters are estimates from eyeballing the values ingame
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "CScriptExtra.h"
|
#include "CScriptExtra.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class CDamageableTriggerExtra : public CScriptExtra
|
class CDamageableTriggerExtra : public CScriptExtra
|
||||||
{
|
{
|
||||||
@ -24,7 +25,7 @@ private:
|
|||||||
TEnumRef<ERenderSide> mRenderSide;
|
TEnumRef<ERenderSide> mRenderSide;
|
||||||
std::array<CAssetRef, 3> mTextureAssets;
|
std::array<CAssetRef, 3> mTextureAssets;
|
||||||
|
|
||||||
CMaterial* mpMat = nullptr;
|
std::unique_ptr<CMaterial> mpMat;
|
||||||
std::array<CTexture*, 3> mpTextures{};
|
std::array<CTexture*, 3> mpTextures{};
|
||||||
CVector2f mCoordScale;
|
CVector2f mCoordScale;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user