This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 356 for ps


Ignore:
Timestamp:
06/02/04 18:06:19 (21 years ago)
Author:
Simon Brenner
Message:

Converted to VFS enumeration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/source/simulation/BaseEntityCollection.cpp

    r325 r356  
    44#include "ObjectManager.h"
    55#include "Model.h"
    6 #include "io.h"
    76
    87void CBaseEntityCollection::loadTemplates()
    98{
    10     _finddata_t file;
    11     intptr_t handle;
    12 
     9    Handle handle;
     10    vfsDirEnt dent;
     11   
    1312    CStr pathname = "mods/official/entities/templates/";
    14     CStr filespec = pathname + "*.xml";
    15    
    16     handle = _findfirst( filespec, &file );
    17     if( handle != -1 )
    18     {   
    19         do
     13    handle=vfs_open_dir("entities/templates/");
     14    if (handle > 0)
     15    {
     16        while (vfs_next_dirent(handle, &dent, ".xml"))
    2017        {
    2118            CBaseEntity newTemplate;
    22             if( newTemplate.loadXML( pathname + file.name ) )
     19            if( newTemplate.loadXML( pathname + dent.name ) )
     20            {
    2321                addTemplate( newTemplate );
     22                LOG(NORMAL, "CBaseEntityCollection::loadTemplates(): Loaded template \"%s%s\"", pathname.c_str(), dent.name);
     23            }
     24            else
     25                LOG(ERROR, "CBaseEntityCollection::loadTemplates(): Couldn't load template \"%s%s\"", pathname.c_str(), dent.name);
     26
    2427        }
    25         while( !_findnext( handle, &file ) );
    26 
    27         _findclose(handle);
     28        vfs_close_dir(handle);
    2829    }
    29 
     30    else
     31    {
     32        LOG(ERROR, "CBaseEntityCollection::loadTemplates(): Failed to enumerate entity template directory\n");
     33        return;
     34    }
     35   
    3036    // He's so annoyingly slow...
    3137    CBaseEntity* dude = getTemplate( "Prometheus Dude" );
    3238    dude->m_speed *= 10.0f;
    33 
    3439}
    3540
Note: See TracChangeset for help on using the changeset viewer.