Fixed bug where asset properties on new instances are created with the wrong length

This commit is contained in:
Aruki 2017-05-14 21:30:50 -06:00
parent 43a3558383
commit f9f6d1f963
2 changed files with 10 additions and 1 deletions

View File

@ -94,6 +94,12 @@ bool IProperty::MatchesDefault()
else return pkValue->Matches(pkDefault);
}
// ************ TAssetProperty ************
TAssetProperty::TAssetProperty(IPropertyTemplate *pTemp, CScriptObject *pInstance, CPropertyStruct *pParent)
: TTypedProperty(pTemp, pInstance, pParent, CAssetID::InvalidID( pTemp->Game() ))
{
}
// ************ CPropertyStruct ************
void CPropertyStruct::Copy(const IProperty *pkProp)
{

View File

@ -150,7 +150,10 @@ public:
class TAssetProperty : public TTypedProperty<CAssetID, eAssetProperty, CAssetValue>
{
public:
IMPLEMENT_PROPERTY_CTORS(TAssetProperty, CAssetID)
TAssetProperty(IPropertyTemplate *pTemp, CScriptObject *pInstance, CPropertyStruct *pParent); // Can't be in the header because needs to check the template to set the correct ID length
TAssetProperty(IPropertyTemplate *pTemp, CScriptObject *pInstance, CPropertyStruct *pParent, CAssetID v)
: TTypedProperty(pTemp, pInstance, pParent, v) {}
IMPLEMENT_PROPERTY_CLONE(TAssetProperty)
virtual bool MatchesDefault() { return !Get().IsValid(); }
virtual bool ShouldCook() { return true; }