Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 20, 2005, 1:37:47 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/levelLoader: loading through Functors.
This should make our lives much more simple, if they are implemented real good.
This will take some time, and i would like you to comment on this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/levelLoader/src/world_entities/world_entity.cc

    r4115 r4233  
    2323#include "vector.h"
    2424
    25 //#include "stdincl.h"
    26 //#include "collision.h"
     25#include "load_param.h"
    2726
    2827using namespace std;
     
    5150    {
    5251      PRINTF(2)("WorldEntity is missing a proper 'name'\n");
    53       string = "Unknown";
    54       temp = new char[strlen(string + 2)];
    55       strcpy( temp, string);
    56       this->setName( temp);
     52      this->setName("unknown");
    5753    }
    5854  else
    5955    {
    60       temp = new char[strlen(string + 2)];
    61       strcpy( temp, string);
    62       this->setName( temp);
     56      LoadParam<WorldEntity> (string, this, &WorldEntity::setName);
    6357    }
    6458  // Model Loading     
     
    6660  string = grabParameter( root, "model");
    6761  if( string != NULL)
    68     this->model = (Model*)ResourceManager::getInstance()->load(string, OBJ, RP_CAMPAIGN);
     62    LoadParam<WorldEntity>(string, this, &WorldEntity::loadModel);
    6963  else
    7064    {
     
    8781  if (this->model)
    8882    ResourceManager::getInstance()->unload(this->model);
     83}
     84
     85/**
     86   \brief loads a Model onto a WorldEntity
     87   \param fileName the name of the model to load
     88*/
     89void WorldEntity::loadModel(const char* fileName)
     90{
     91  this->model = (Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN);
    8992}
    9093
Note: See TracChangeset for help on using the changeset viewer.