From: Brendan Hansen Date: Sun, 27 Feb 2022 04:42:45 +0000 (-0600) Subject: small 'bugfix' X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=4cda535f2f4ebec746f93b5c28fb98d0df6da9b5;p=bar-game.git small 'bugfix' --- diff --git a/src/entity/manager.onyx b/src/entity/manager.onyx index e6e7d1c..f648ce6 100644 --- a/src/entity/manager.onyx +++ b/src/entity/manager.onyx @@ -16,8 +16,8 @@ Entity_ID :: #distinct u32 } #local Component_Vtable :: struct { - init : (^Component) -> void = null_proc; - update: (^Component, ^Entity, f32) -> void = null_proc; + init : (rawptr) -> void = null_proc; + update: (rawptr, ^Entity, f32) -> void = null_proc; } Component :: struct { @@ -204,8 +204,8 @@ entity_manager_create_component :: (use this: ^Entity_Manager, component_type: t } comp.vtable = component_vtables->get(comp.type); - if comp.vtable.init != null_proc { - comp.vtable.init(comp); + if comp.init != null_proc { + comp->init(); } return comp; @@ -230,10 +230,8 @@ entity_manager_update :: (use this: ^Entity_Manager, dt: f32) { for entities { for^ entry: it.components.entries { comp := entry.value; - - @CompilerBug // comp->update(it, dt); should be legal here, but it says 'update' is not a member of '^Component'. - if comp.vtable.update != null_proc { - comp.vtable.update(comp, it, dt); + if comp.update != null_proc { + comp->update(it, dt); } } }