TODO about preupdate call style
[carveJwlIkooP6JGAAIwe30JlM.git] / ent_challenge.c
index 9499d0fed8e7b0e6ce9f51fcd1cf0a161d373c55..861edbd6f60e10f9bac4b8ed9c12e093c9fee37a 100644 (file)
@@ -46,15 +46,18 @@ entity_call_result ent_challenge_call( world_instance *world, ent_call *call )
       return k_entity_call_result_unhandled;
 }
 
-void ent_challenge_preupdate( ent_challenge *challenge, int active )
+void ent_challenge_preupdate( ent_focus_context *ctx )
 {
-   world_instance *world = world_current_instance();
+   world_instance *world = ctx->world;
+   ent_challenge *challenge = mdl_arritm( &world->ent_challenge, ctx->index );
 
    /* maximum distance from active challenge */
-   if( !active ){
+   if( !ctx->active )
+   {
       f32 min_dist2 = 999999.9f;
 
-      if( mdl_entity_id_type( challenge->first ) == k_ent_objective ){
+      if( mdl_entity_id_type( challenge->first ) == k_ent_objective )
+      {
          u32 next = challenge->first;
          while( mdl_entity_id_type(next) == k_ent_objective ){
             u32 index = mdl_entity_id_id( next );