X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=entity.c;h=ae506bd68fdc04fc39807abafc9cd1d5afaadb76;hb=f01a25e33a54c92e4d6bca0889b76f33af5e51eb;hp=557ba799a792d2e61e96f8fa3591b67ed72a4b78;hpb=1a194c3888293733939b2dd944251ae1b6c398ce;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/entity.c b/entity.c index 557ba79..ae506bd 100644 --- a/entity.c +++ b/entity.c @@ -12,11 +12,10 @@ #include "ent_glider.h" #include "ent_npc.h" -typedef void (*fn_entity_call_handler)( world_instance *, ent_call *); - void entity_call( world_instance *world, ent_call *call ) { - u32 type = mdl_entity_id_type( call->id ); + u32 type = mdl_entity_id_type( call->id ), + index = mdl_entity_id_id( call->id ); fn_entity_call_handler table[] = { [k_ent_volume] = ent_volume_call, @@ -41,12 +40,19 @@ void entity_call( world_instance *world, ent_call *call ) fn_entity_call_handler fn = table[ type ]; - if( !fn ){ - vg_error( "call to entity type: %u is undefined\n", type ); + if( !fn ) + { + vg_error( "Entity type %u does not have a call handler, " + "but was called anyway\n", type ); return; } - fn( world, call ); + enum entity_call_result res = fn( world, call ); + + if( res == k_entity_call_result_unhandled ) + { + vg_warn( "Call to entity %u#%u was unhandled.\n", type, index ); + } } ent_marker *ent_find_marker( mdl_context *mdl, mdl_array_ptr *arr,