X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_load.c;h=f907a2bda23d58ca0b7885826a21a1c4ee18e5c8;hb=9c0893a71497912deecdcd84dff9afbeac32f8f4;hp=455d30d7856abb0ae43d9763c745a37a4874e6a5;hpb=7e1fe6c7931ba4492aa10ac5eebc316b74fb5dac;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_load.c b/world_load.c index 455d30d..f907a2b 100644 --- a/world_load.c +++ b/world_load.c @@ -80,11 +80,9 @@ static void world_instance_load_mdl( u32 instance_id, const char *path ){ world->info.timezone = 0.0f; } - time_t t; - struct tm *tm; - time( &t ); - tm = gmtime( &t ); - world->time = (float)tm->tm_min/20.0f + (world->info.timezone/24.0f); + time_t seconds = time(NULL) % ((u32)k_day_length*60); + world->time = ((f64)(seconds)/(k_day_length*60.0)); + world->time += (world->info.timezone/24.0); /* process resources from pack */ world_gen_load_surfaces( world ); @@ -97,6 +95,18 @@ static void world_instance_load_mdl( u32 instance_id, const char *path ){ world_gen_compute_light_indices( world ); mdl_close( meta ); + /* allocate leaderboard buffers */ + u32 bs = mdl_arrcount(&world->ent_route)*sizeof(struct leaderboard_cache); + world->leaderboard_cache = vg_linear_alloc( heap, bs ); + + for( u32 i=0; ient_route ); i ++ ){ + struct leaderboard_cache *board = &world->leaderboard_cache[i]; + board->data = vg_linear_alloc( heap, NETWORK_LEADERBOARD_MAX_SIZE ); + board->status = k_request_status_client_error; + board->cache_time = 0.0; + board->data_len = 0; + } + vg_async_call( async_world_postprocess, world, 0 ); vg_async_stall(); }