X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_load.c;h=4f5f8f4628fe242a7da595018420f1191690f24d;hb=badfa88dd109bbae5628f58504402f4707569f73;hp=493b89d9cb759147c931ce75b4881a631bc5584f;hpb=342fcbf6fda017bdd38d56ce0fa7c9e59e589f3b;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_load.c b/world_load.c index 493b89d..4f5f8f4 100644 --- a/world_load.c +++ b/world_load.c @@ -4,6 +4,7 @@ #include "world_load.h" #include "world_routes.h" #include "world_gate.h" +#include "ent_skateshop.h" /* * load the .mdl file located in path (relative to exe), it will load into the @@ -130,21 +131,21 @@ static void skaterift_world_changer_thread( void *data ) char worlds[3][4096]; u32 i=0; - DIR *dir = opendir( folder.buffer ); - if( !dir ){ + vg_dir dir; + if( !vg_dir_open(&dir, folder.buffer) ){ vg_error( "opendir('%s') failed\n", folder.buffer ); vg_async_call( async_skaterift_world_loaded, NULL, 0 ); return; } - struct dirent *entry; - while( (entry = readdir(dir)) ){ - if( entry->d_type == DT_REG ){ - if( entry->d_name[0] == '.' ) continue; + while( vg_dir_next_entry(&dir) ){ + if( vg_dir_entry_type(&dir) == k_vg_entry_type_file ){ + const char *d_name = vg_dir_entry_name(&dir); + if( d_name[0] == '.' ) continue; vg_str file = folder; vg_strcat( &file, "/" ); - vg_strcat( &file, entry->d_name ); + vg_strcat( &file, d_name ); if( !vg_strgood( &file ) ) continue; char *ext = vg_strch( &file, '.' ); @@ -159,7 +160,7 @@ static void skaterift_world_changer_thread( void *data ) strcpy( worlds[i++], file.buffer ); } } - closedir(dir); + vg_dir_close(&dir); if( i == 0 ){ vg_warn( "There are no .mdl files in the map folder.\n" );