Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 14, 2005, 9:58:58 AM (19 years ago)
Author:
chris
Message:

orxonox/branches/levelloader: First incarnation of a debugworld loaded from a XML-File in place, compilability in place, all necessary basic loading constuctors in place. Unfortunately the code still generates interferences with the old hardcoded debugworld resulting in SegFault crash.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/levelloader/src/world_entities/player.cc

    r3499 r3542  
    2222
    2323using namespace std;
     24
     25CREATE_FACTORY(Player);
    2426
    2527/**
     
    5961
    6062/**
     63   \brief creates a new Player from Xml Data
     64   \param root the xml element containing player data
     65   
     66   \todo add more parameters to load
     67*/
     68Player::Player(TiXmlElement* root)
     69{
     70        char* temp;
     71        const char* string;
     72        string = grabParameter( root, "name");
     73        if( string == NULL)
     74        {
     75                PRINTF(1)("Player is missing a proper 'name'\n");
     76                string = "Unknown";
     77                temp = new char[strlen(string + 2)];
     78                strcpy( temp, string);
     79                this->setName( temp);
     80        }
     81        else
     82        {
     83                temp = new char[strlen(string + 2)];
     84                strcpy( temp, string);
     85                this->setName( temp);
     86        }
     87       
     88        this->model = NULL;
     89        string = grabParameter( root, "model");
     90        if( string != NULL)
     91                this->model = new OBJModel( string);
     92        else
     93        {
     94                PRINTF(1)("Player is missing a proper 'model'\n");
     95                this->model = new OBJModel( "../data/models/reaplow.obj");
     96        }
     97        if( this->model == NULL)
     98        {
     99                PRINTF(1)("Player model '%s' could not be loaded\n", string);
     100        }
     101}
     102
     103/**
    61104   \brief destructs the player
    62105*/
Note: See TracChangeset for help on using the changeset viewer.