Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 11, 2005, 6:44:55 PM (20 years ago)
Author:
chris
Message:

orxonox/branches/levelloader: Implemented loadability of worlds and campaigns from files. Theoretically any Story_Entity and World_Entity can now be loaded from the files if somebody adjusts the classes to be loadable. System still needs testing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/levelloader/src/story_entities/campaign.cc

    r3501 r3503  
    2121#include "camera.h"
    2222#include "story_entity.h"
     23#include "factory.h"
    2324
    2425using namespace std;
     
    3637{
    3738        TiXMLElement* element;
     39        char string;
     40        int id;
    3841       
    3942        assert( root != NULL);
     
    4447 
    4548  // grab all the necessary parameters
    46  
     49        string = grabParameter( root, "identifier");
     50        if( string == NULL || if( sscanf(string, "%d", &id) != 1))
     51        {
     52                PRINTF(ERR)("Campaign is missing a proper 'identifier'\n");
     53                setStoryId( -1);
     54        }
     55        else setStoryId( id);
     56       
    4757  // find WorldList
    4858  element = root->FirstChildElement( "WorldList");
    4959 
    50   // load Worlds
     60  // load Worlds/Subcampaigns/Whatever
    5161        while( element != NULL)
    5262        {
    53                 StoryEntity created = loader->fabricate( element);
     63                StoryEntity* created = (StoryEntity*) loader->fabricate( element);
    5464                if( created != NULL) addEntity( created);
    5565                element = element->nextSiblingElement();
Note: See TracChangeset for help on using the changeset viewer.