wrong world display
[carveJwlIkooP6JGAAIwe30JlM.git] / ent_region.c
index 720cb3c72a2ac369ce5099cded5e41f08c1b3892..4d835b8ff632e89f6dff158b5118c659eb88aaea 100644 (file)
@@ -1,5 +1,16 @@
 #include "ent_region.h"
 #include "gui.h"
+#include "network_common.h"
+#include "network.h"
+
+static u32 region_spark_colour( u32 flags ){
+   if( flags & k_ent_route_flag_achieve_gold )
+      return 0xff8ce0fa;
+   else if( flags & k_ent_route_flag_achieve_silver )
+      return 0xffc2c2c2;
+   else 
+      return 0x00;
+}
 
 static void ent_region_call( world_instance *world, ent_call *call ){
    ent_region *region = 
@@ -29,12 +40,21 @@ static void ent_region_call( world_instance *world, ent_call *call ){
 
       gui_location_print_ccmd( 1, (const char *[]){
             mdl_pstr(&world->meta,region->pstr_title)} );
+
+      vg_strncpy( mdl_pstr(&world->meta,region->pstr_title), 
+                  global_ent_region.location, NETWORK_REGION_MAX,
+                  k_strncpy_always_add_null );
+      global_ent_region.flags = region->flags;
+      network_send_region();
+
+      localplayer.effect_data.spark.colour = region_spark_colour(region->flags);
    }
    else if( call->function == 1 ){ /* leave */
       for( u32 i=0; i<mdl_arrcount(&world->ent_route); i ++ ){
          ent_route *route = mdl_arritm( &world->ent_route, i );
          route->flags |= k_ent_route_flag_out_of_zone;
       }
+      localplayer.effect_data.spark.colour = 0x00;
    }
 }