build system revision
[carveJwlIkooP6JGAAIwe30JlM.git] / world.c
diff --git a/world.c b/world.c
index 22c3c2c63be1017518454612ccbf169adee2829d..9ff62bcb3df1b3471462542c21cda5ea53b82d51 100644 (file)
--- a/world.c
+++ b/world.c
@@ -7,6 +7,8 @@
 
 #include "world.h"
 #include "network.h"
+#include "vg/vg_loader.h"
+#include "vg/vg_mem.h"
 
 static world_instance *world_current_instance(void){
    return &world_static.instances[ world_static.active_instance ];
@@ -41,15 +43,24 @@ static void world_switch_instance( u32 index ){
       return;
    }
 
+   if( skaterift.demo_mode ){
+      if( world_static.instance_addons[index]->flags & ADDON_REG_PREMIUM ){
+         vg_error( "Can't switch to a premium world in the demo version\n" );
+         return;
+      }
+   }
+
    world_instance *current = 
       &world_static.instances[ world_static.active_instance ];
 
-   if( index != world_static.active_instance )
+   if( index != world_static.active_instance ){
       v3_copy( localplayer.rb.co, current->player_co );
+      skaterift_autosave(1);
+   }
+
    v3_copy( new->player_co, localplayer.rb.co );
 
    world_static.active_instance = index;
-
    player__reset();
 }
 
@@ -64,7 +75,9 @@ static int skaterift_switch_instance_cmd( int argc, const char *argv[] ){
 static void skaterift_world_get_save_path( enum world_purpose which, 
                                            char buf[128] ){
    addon_reg *reg = world_static.instance_addons[ which ];
-   assert( reg );
+
+   if( !reg )
+      vg_fatal_error( "Looking up addon for world without one\n" );
 
    char id[76];
    addon_alias_uid( &reg->alias, id );
@@ -82,7 +95,6 @@ static void skaterift_world_get_save_path( enum world_purpose which,
 #include "world_water.c"
 #include "world_audio.c"
 #include "world_routes.c"
-#include "world_traffic.c"
 
 static void world_update( world_instance *world, v3f pos ){
    world_render.sky_time += world_render.sky_rate * vg.time_delta;
@@ -92,7 +104,7 @@ static void world_update( world_instance *world, v3f pos ){
 
    world_routes_update_timer_texts( world );
    world_routes_update( world );
-   world_traffic_update( world, pos );
+   ent_traffic_update( world, pos );
    world_sfd_update( world, pos );
    world_volumes_update( world, pos );
 }