Use DukValue for scripted entity id_get

This commit is contained in:
ζeh Matt 2022-02-16 19:51:50 +02:00
parent 512348a81d
commit cd261fc7b2
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
1 changed files with 7 additions and 2 deletions

View File

@ -38,10 +38,15 @@ namespace OpenRCT2::Scripting
}
private:
int32_t id_get() const
DukValue id_get() const
{
auto ctx = GetContext()->GetScriptEngine().GetContext();
auto entity = GetEntity();
return entity != nullptr ? entity->sprite_index.ToUnderlying() : EntityId::GetNull().ToUnderlying();
if (entity == nullptr)
return ToDuk(ctx, nullptr);
return ToDuk(ctx, entity->sprite_index.ToUnderlying());
}
std::string type_get() const