Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 28, 2005, 2:25:08 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/ll2trunktemp: some small modifications, testing, why 2 instances of fabricate are deleted, and not just the first one

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/ll2trunktemp/src/game_loader.cc

    r3989 r4003  
    166166 
    167167  if( name == NULL)
    168   {
    169                 PRINTF0("No filename specified for loading");
    170                 return NULL;
    171   }
     168    {
     169      PRINTF0("No filename specified for loading");
     170      return NULL;
     171    }
    172172 
    173         TiXmlDocument* XMLDoc = new TiXmlDocument( name);
    174         // load the campaign document
    175         if( !XMLDoc->LoadFile())
    176         {
    177                 // report an error
    178                 PRINTF0("Error loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
    179                 delete XMLDoc;
    180                 return NULL;
    181         }
    182        
    183         // check basic validity
    184         TiXmlElement* root = XMLDoc->RootElement();
    185         assert( root != NULL);
    186        
    187         if( strcmp( root->Value(), "Campaign"))
    188         {
    189                 // report an error
    190                 PRINTF0("Specified XML File is not an orxonox campaign file (Campaign element missing)\n");
    191                 delete XMLDoc;
    192                 return NULL;
    193         }
    194        
    195         // construct campaign
    196         Campaign* c = new Campaign( root);
    197        
    198         // free the XML data
    199         delete XMLDoc;
    200        
    201         return c;
     173  TiXmlDocument* XMLDoc = new TiXmlDocument( name);
     174  // load the campaign document
     175  if( !XMLDoc->LoadFile())
     176    {
     177      // report an error
     178      PRINTF0("Error loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
     179      delete XMLDoc;
     180      return NULL;
     181    }
     182       
     183  // check basic validity
     184  TiXmlElement* root = XMLDoc->RootElement();
     185  assert( root != NULL);
     186       
     187  if( strcmp( root->Value(), "Campaign"))
     188    {
     189      // report an error
     190      PRINTF0("Specified XML File is not an orxonox campaign file (Campaign element missing)\n");
     191      delete XMLDoc;
     192      return NULL;
     193    }
     194       
     195  // construct campaign
     196  Campaign* c = new Campaign( root);
     197       
     198  // free the XML data
     199  delete XMLDoc;
     200       
     201  return c;
    202202}
    203203
Note: See TracChangeset for help on using the changeset viewer.