Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 18, 2005, 11:27:40 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/movie_player: merged the trunk back into the movie_player
merged with command:
svn merge -r 4014:HEAD ../trunk/ movie_player/
no conflicts

File:
1 edited

Legend:

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

    r4010 r4217  
    2525#include "command_node.h"
    2626#include "vector.h"
     27#include "resource_manager.h"
    2728#include "factory.h"
    2829
     
    3637
    3738
    38 GameLoader::GameLoader () {}
     39GameLoader::GameLoader ()
     40{
     41  first = NULL;
     42}
    3943
    4044
     
    7074   this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
    7175*/
    72 ErrorMessage GameLoader::loadCampaign(char* name)
     76ErrorMessage GameLoader::loadCampaign(const char* name)
    7377{
    7478  ErrorMessage errorCode;
    75  
    76   this->currentCampaign = this->fileToCampaign(name);
     79  char* campaignName = ResourceManager::getFullName(name);
     80  if (campaignName)
     81    {
     82      this->currentCampaign = this->fileToCampaign(campaignName);
     83      delete campaignName;
     84    }
    7785}
    7886
     
    159167   this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns
    160168*/
    161 Campaign* GameLoader::fileToCampaign(char *name)
     169Campaign* GameLoader::fileToCampaign(const char *name)
    162170{
    163171  /* do not entirely load the campaign. just the current world
     
    168176  if( name == NULL)
    169177    {
    170       PRINTF0("No filename specified for loading");
     178      PRINTF(2)("No filename specified for loading");
    171179      return NULL;
    172180    }
     
    177185    {
    178186      // report an error
    179       PRINTF0("Error loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
     187      PRINTF(1)("Could not load XML File %s: %s @ %d:%d\n", name, XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
    180188      delete XMLDoc;
    181189      return NULL;
     
    189197    {
    190198      // report an error
    191       PRINTF(0)("Specified XML File is not an orxonox campaign file (Campaign element missing)\n");
     199      PRINTF(2)("Specified XML File is not an orxonox campaign file (Campaign element missing)\n");
    192200      delete XMLDoc;
    193201      return NULL;
     
    211219bool GameLoader::worldCommand (Command* cmd)
    212220{
    213   if( !strcmp( cmd->cmd, "up_world"))
     221  if( !strcmp( cmd->cmd, CONFIG_NAME_NEXT_WORLD))
    214222    {
    215223      if( !cmd->bUp)
     
    219227      return true;
    220228    }
    221   else if( !strcmp( cmd->cmd, "down_world"))
     229  else if( !strcmp( cmd->cmd, CONFIG_NAME_PREV_WORLD))
    222230    {
    223231      if( !cmd->bUp)
     
    227235      return true;
    228236    }
    229   else if( !strcmp( cmd->cmd, "pause"))
     237  else if( !strcmp( cmd->cmd, CONFIG_NAME_PAUSE))
    230238    {
    231239      if( !cmd->bUp)
     
    238246      return true;
    239247    }
    240   else if( !strcmp( cmd->cmd, "quit"))
     248  else if( !strcmp( cmd->cmd, CONFIG_NAME_QUIT))
    241249    {
    242250      if( !cmd->bUp) this->stop();
     
    276284        assert( factory != NULL);
    277285       
    278         PRINTF0("Registered factory for '%s'\n", factory->getClassname());
     286        PRINTF(4)("Registered factory for '%s'\n", factory->getFactoryName());
    279287       
    280288        if( first == NULL) first = factory;
     
    288296BaseObject* GameLoader::fabricate( TiXmlElement* element)
    289297{
    290         assert( element != NULL);
    291        
    292         if( first == NULL)
    293         {
    294                 PRINTF0("GameLoader does not know any factories, fabricate() failed\n");
    295                 return NULL;
    296         }
    297        
    298         if( element->Value() != NULL)
    299         {
    300                 PRINTF0("Attempting fabrication of a '%s'\n", element->Value());
    301                 BaseObject* b = first->fabricate( element);
    302                 if( b == NULL) PRINTF0("Failed to fabricate a '%s'\n", element->Value());
    303                 else PRINTF0("Successfully fabricated a '%s'\n", element->Value());
    304                 return b;
    305         }
    306        
    307         PRINTF0("Fabricate failed, TiXmlElement did not contain a value\n");
    308        
    309         return NULL;
    310 }
     298  assert( element != NULL);
     299       
     300  if( first == NULL)
     301    {
     302      PRINTF(1)("GameLoader does not know any factories, fabricate() failed\n");
     303      return NULL;
     304    }
     305       
     306  if( element->Value() != NULL)
     307    {
     308      PRINTF(4)("Attempting fabrication of a '%s'\n", element->Value());
     309      BaseObject* b = first->fabricate( element);
     310      if( b == NULL)
     311        PRINTF(2)("Failed to fabricate a '%s'\n", element->Value());
     312      else
     313        PRINTF(4)("Successfully fabricated a '%s'\n", element->Value());
     314      return b;
     315    }
     316       
     317  PRINTF(2)("Fabricate failed, TiXmlElement did not contain a value\n");
     318       
     319  return NULL;
     320}
Note: See TracChangeset for help on using the changeset viewer.