Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4253 in orxonox.OLD for orxonox/branches/levelLoader/src


Ignore:
Timestamp:
May 21, 2005, 11:58:49 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/levelLoader: constifization

Location:
orxonox/branches/levelLoader/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/levelLoader/src/glmenu/glmenu_imagescreen.cc

    r4242 r4253  
    3838   \param root The Element to load the GLMenu from
    3939*/
    40 GLMenuImageScreen::GLMenuImageScreen (TiXmlElement* root)
     40GLMenuImageScreen::GLMenuImageScreen(const TiXmlElement* root)
    4141{
    4242  this->init();
    43   this->load(root);
    44 
     43  this->loadParams(root);
    4544}
    4645
     
    5655   \li ElementCount: INT: how many elements will be loaded
    5756*/
    58 void GLMenuImageScreen::load(TiXmlElement* root)
     57void GLMenuImageScreen::loadParams(const TiXmlElement* root)
    5958{
    6059  LoadParam<GLMenuImageScreen>(root, "BackgroundImage", this, &GLMenuImageScreen::setBackgroundImage);
  • orxonox/branches/levelLoader/src/glmenu/glmenu_imagescreen.h

    r4241 r4253  
    1717 public:
    1818  GLMenuImageScreen ();
    19   GLMenuImageScreen (TiXmlElement* root);
    20   void load(TiXmlElement* root);
     19  GLMenuImageScreen (const TiXmlElement* root);
     20  void loadParams(const TiXmlElement* root);
    2121  virtual ~GLMenuImageScreen ();
    2222
  • orxonox/branches/levelLoader/src/story_entities/world.cc

    r4248 r4253  
    121121CREATE_FACTORY(World);
    122122
    123 World::World( TiXmlElement* root)
     123World::World(const TiXmlElement* root)
    124124{
    125125  this->constuctorInit("", -1);
    126126  this->path = NULL;
    127   const char *string;
    128   char *name;
    129   int id;
    130  
    131   PRINTF0("Creating a World\n");
    132  
    133   // identifier
    134   string = grabParameter( root, "identifier");
    135   if( string == NULL || sscanf(string, "%d", &id) != 1)
    136     {
    137       PRINTF0("World is missing a proper 'identifier'\n");
    138       this->setStoryID( -1);
    139     }
    140   else setStoryID( id);
    141 
    142   // next id
    143   string = grabParameter( root, "nextid");
    144   if( string == NULL || sscanf(string, "%d", &id) != 1)
    145     {
    146       PRINTF0("World is missing a proper 'nextid'\n");
    147       this->setStoryID( -1);
    148     }
    149   else setNextStoryID( id);
    150  
    151 
    152   // path
    153   string = grabParameter( root, "path");
    154   if( string == NULL)
    155     {
    156       PRINTF0("World is missing a proper 'path'\n");
    157       this->setPath( NULL);
    158     }
    159   else
    160     {
    161       name = new char[strlen(string + 2)];
    162       strcpy( name, string);
    163       this->setPath( name);
    164     }
     127 
     128  this->loadParams(root);
    165129}
    166130
     
    234198  this->debugWorldNr = worldID;
    235199  this->entities = new tList<WorldEntity>();
     200}
     201
     202void World::loadParams(const TiXmlElement* root)
     203{
     204  const char *string;
     205  char *name;
     206  int id;
     207
     208  PRINTF0("Creating a World\n");
     209 
     210  // identifier
     211  string = grabParameter( root, "identifier");
     212  if( string == NULL || sscanf(string, "%d", &id) != 1)
     213    {
     214      PRINTF0("World is missing a proper 'identifier'\n");
     215      this->setStoryID( -1);
     216    }
     217  else setStoryID( id);
     218
     219  // next id
     220  string = grabParameter( root, "nextid");
     221  if( string == NULL || sscanf(string, "%d", &id) != 1)
     222    {
     223      PRINTF0("World is missing a proper 'nextid'\n");
     224      this->setStoryID( -1);
     225    }
     226  else setNextStoryID( id);
     227 
     228
     229  // path
     230  string = grabParameter( root, "path");
     231  if( string == NULL)
     232    {
     233      PRINTF0("World is missing a proper 'path'\n");
     234      this->setPath( NULL);
     235    }
     236  else
     237    {
     238      name = new char[strlen(string + 2)];
     239      strcpy( name, string);
     240      this->setPath( name);
     241    }
    236242}
    237243
     
    332338  else
    333339    {
    334       this->glmis->load(element);
     340      this->glmis->loadParams(element);
    335341      this->glmis->draw();
    336342    }
  • orxonox/branches/levelLoader/src/story_entities/world.h

    r4239 r4253  
    5656  World (char* name);
    5757  World (int worldID);
    58   World (TiXmlElement* root);
     58  World (const TiXmlElement* root = NULL);
    5959  virtual ~World ();
     60
     61  void loadParams(const TiXmlElement* root);
    6062
    6163  double getGameTime();
  • orxonox/branches/levelLoader/src/util/loading/factory.cc

    r4250 r4253  
    6565   \brief generates the associated object from data
    6666*/
    67 BaseObject* Factory::fabricate( TiXmlElement* data)
     67BaseObject* Factory::fabricate(const TiXmlElement* data)
    6868{
    6969  return NULL;
  • orxonox/branches/levelLoader/src/util/loading/factory.h

    r4252 r4253  
    4646 
    4747
    48   virtual BaseObject* fabricate( TiXmlElement* root);
     48  virtual BaseObject* fabricate(const TiXmlElement* root);
    4949  void initialize();
    5050  void registerFactory( Factory* factory);
     
    6767 
    6868  private:
    69   BaseObject* fabricate( TiXmlElement* root);
     69  BaseObject* fabricate(const TiXmlElement* root);
    7070};
    7171
     
    8282
    8383template<class T>
    84 BaseObject* tFactory<T>::fabricate( TiXmlElement* root)
     84BaseObject* tFactory<T>::fabricate(const TiXmlElement* root)
    8585{
    8686  if(!strcmp(root->Value(), getFactoryName()))
  • orxonox/branches/levelLoader/src/util/loading/load_param.h

    r4252 r4253  
    157157
    158158#define CREATE_LOAD_DOC(CLASS_NAME) \
    159 
    160 /*  void documentLoadClass(void) \
     159  void documentLoadClass##CLASS_NAME(void) \
    161160    { \
    162161      if(LoadClassDescription::parametersDescription) \
    163162        { \
    164163          CLASS_NAME docuClass; \
    165           docuClass.load(NULL); \
    166         } \
    167     } \
    168   documentLoadClass();
    169 */
     164          docuClass.loadParams(NULL); \
     165        } \
     166    }
     167//  documentLoadClass();
     168
    170169
    171170class LoadParamDescription
  • orxonox/branches/levelLoader/src/world_entities/player.cc

    r4114 r4253  
    8080   \todo add more parameters to load
    8181*/
    82 Player::Player(TiXmlElement* root) : WorldEntity(root)
     82Player::Player(const TiXmlElement* root) : WorldEntity(root)
    8383{
    8484  this->weapons = new tList<Weapon>();
  • orxonox/branches/levelLoader/src/world_entities/player.h

    r4010 r4253  
    2222 public:
    2323  Player();
    24   Player(TiXmlElement* root);
     24  Player(const TiXmlElement* root);
    2525  virtual ~Player();
    2626
  • orxonox/branches/levelLoader/src/world_entities/skybox.cc

    r4251 r4253  
    4545}
    4646
    47 SkyBox::SkyBox(TiXmlElement* root) : WorldEntity(root)
     47SkyBox::SkyBox(const TiXmlElement* root) : WorldEntity(root)
    4848{
    4949  this->preInit();
    5050
    51   this->load(root);
     51  this->loadParams(root);
    5252
    5353  this->postInit();
    5454}
    5555
    56 void SkyBox::load(TiXmlElement* root)
     56void SkyBox::loadParams(const TiXmlElement* root)
    5757{
    5858  LoadParam<SkyBox>(root, "Materialset", this, &SkyBox::setTexture);
  • orxonox/branches/levelLoader/src/world_entities/skybox.h

    r4251 r4253  
    2222 public:
    2323  SkyBox(const char* fileName = NULL);
    24   SkyBox(TiXmlElement* root);
     24  SkyBox(const TiXmlElement* root);
    2525
    2626  virtual ~SkyBox();
    2727
    28   void load(TiXmlElement* root);
     28  void loadParams(const TiXmlElement* root);
    2929
    3030  void preInit(void);
  • orxonox/branches/levelLoader/src/world_entities/world_entity.cc

    r4251 r4253  
    2828   \brief Loads the WordEntity-specific Part of any derived Class
    2929*/
    30 WorldEntity::WorldEntity(TiXmlElement* root)
     30WorldEntity::WorldEntity(const TiXmlElement* root)
    3131{
    3232  this->setClassName ("WorldEntity");
     
    3434
    3535  if (root)
    36     this->load(root);
     36    this->loadParams(root);
    3737
    3838  this->bDraw = true;
    3939}
    4040
    41 void WorldEntity::load(TiXmlElement* root)
     41void WorldEntity::loadParams(const TiXmlElement* root)
    4242{
    4343  // name setup
  • orxonox/branches/levelLoader/src/world_entities/world_entity.h

    r4251 r4253  
    2323
    2424 public:
    25   WorldEntity(TiXmlElement* root = NULL);
     25  WorldEntity(const TiXmlElement* root = NULL);
    2626  virtual ~WorldEntity ();
    2727
    28   void load(TiXmlElement* root);
     28  void loadParams(const TiXmlElement* root);
    2929  void loadModel(const char* fileName);
    3030
Note: See TracChangeset for help on using the changeset viewer.