1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

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

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