projects
/
csRadar.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed instance loading forget to append basepath.. other path fixes (windows)
[csRadar.git]
/
vmf.h
diff --git
a/vmf.h
b/vmf.h
index 4fbe023c568867a5ba5cb6ab0a4ae90c581dbe99..740a3749da0af94070dabd7da5077aaae7ac8197 100644
(file)
--- a/
vmf.h
+++ b/
vmf.h
@@
-695,15
+695,24
@@
u32 vmf_init_subvmf( vmf_map *map, const char *subvmf );
void vmf_load_all_instances( vmf_map *map, vdf_node *vmf )
{
void vmf_load_all_instances( vmf_map *map, vdf_node *vmf )
{
+ char nextvmf[ 512 ];
+ const char *base = kv_get( vmf, "csr_path", "" );
+
vdf_foreach( vmf, "entity", ent )
{
if( !strcmp( kv_get( ent, "classname", "" ), "func_instance" ))
{
// Entity is in use if file is specified, if not just ignore the entity.
vdf_foreach( vmf, "entity", ent )
{
if( !strcmp( kv_get( ent, "classname", "" ), "func_instance" ))
{
// Entity is in use if file is specified, if not just ignore the entity.
- const char *path = kv_get( ent, "file", "" );
- if( strcmp( path, "" ) )
+ const char *path = kv_get( ent, "file", NULL );
+
+ if( path )
{
{
- if( (ent->user1 = vmf_init_subvmf( map, path )))
+ // Make relative path real
+ strcpy( nextvmf, base );
+ csr_downlvl( nextvmf );
+ strcat( nextvmf, path );
+
+ if( (ent->user1 = vmf_init_subvmf( map, nextvmf )))
{
ent->user1 --;
ent->user = VMF_FLAG_IS_INSTANCE;
{
ent->user1 --;
ent->user = VMF_FLAG_IS_INSTANCE;
@@
-744,7
+753,9
@@
u32 vmf_init_subvmf( vmf_map *map, const char *subvmf )
strcpy( inst->name, subvmf );
if( (inst->root = vdf_open_file( subvmf )) )
strcpy( inst->name, subvmf );
if( (inst->root = vdf_open_file( subvmf )) )
- {
+ {
+ vdf_kv_append( inst->root, "csr_path", subvmf );
+
// Recursive load other instances
vmf_load_all_instances( map, inst->root );
return id+1;
// Recursive load other instances
vmf_load_all_instances( map, inst->root );
return id+1;
@@
-767,6
+778,8
@@
vmf_map *vmf_init( const char *path )
return NULL;
}
return NULL;
}
+ vdf_kv_append( map->root, "csr_path", path );
+
// Prepare instances
vmf_load_all_instances( map, map->root );
// Prepare instances
vmf_load_all_instances( map, map->root );