- Timestamp:
- Feb 2, 2006, 10:55:43 PM (19 years ago)
- Location:
- trunk/src/story_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/game_world.cc
r6989 r6992 88 88 89 89 this->dataXML = NULL; 90 this->path = NULL;91 90 } 92 91 … … 111 110 { 112 111 StoryEntity::loadParams(root); 113 114 LoadParam(root, "path", this, GameWorld, setPath)115 .describe("The Filename of this GameWorld (relative from the data-dir)");116 112 117 113 PRINTF(4)("Loaded GameWorld specific stuff\n"); … … 145 141 PRINTF(0)("Loading the GameWorld\n"); 146 142 147 PRINTF(3)("> Loading world: '%s'\n", get Path());143 PRINTF(3)("> Loading world: '%s'\n", getLoadFile()); 148 144 TiXmlElement* element; 149 145 GameLoader* loader = GameLoader::getInstance(); 150 146 151 if( get Path() == NULL)147 if( getLoadFile() == NULL) 152 148 { 153 149 PRINTF(1)("GameWorld has no path specified for loading\n"); … … 155 151 } 156 152 157 TiXmlDocument* XMLDoc = new TiXmlDocument( get Path());153 TiXmlDocument* XMLDoc = new TiXmlDocument( getLoadFile()); 158 154 // load the xml world file for further loading 159 155 if( !XMLDoc->LoadFile()) 160 156 { 161 PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->get Path(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());157 PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getLoadFile(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol()); 162 158 delete XMLDoc; 163 159 return (ErrorMessage){213,"XML File parsing error","GameWorld::load()"}; … … 444 440 } 445 441 446 447 /**448 * sets the track path of this world449 * @param name the name of the path450 */451 void GameWorld::setPath( const char* name)452 {453 if (this->path)454 delete this->path;455 if (ResourceManager::isFile(name))456 {457 this->path = new char[strlen(name)+1];458 strcpy(this->path, name);459 }460 else461 {462 this->path = new char[strlen(ResourceManager::getInstance()->getDataDir()) + strlen(name) +1];463 sprintf(this->path, "%s%s", ResourceManager::getInstance()->getDataDir(), name);464 }465 }466 467 468 442 /** 469 443 * shows the loading screen -
trunk/src/story_entities/game_world.h
r6989 r6992 47 47 inline void setSpeed(float speed) { this->speed = speed; }; 48 48 /** returns the track path of this world @returns the track path */ 49 const char* getPath() { return this->path; }50 void setPath( const char* name);51 49 52 50 /** toggles the PNode visibility in the world (drawn as boxes) */ … … 81 79 GameWorldData* dataTank; //!< reference to the GameWorld Data Tank 82 80 TiXmlElement* dataXML; //!< The XML-Element this World has been loaded with. 83 char* path; //!< The file from which this world is loaded84 81 85 82 bool showPNodes; //!< if the PNodes should be visible. -
trunk/src/story_entities/simple_game_menu.cc
r6991 r6992 243 243 EventHandler::getInstance()->unsubscribe(this, ES_MENU); 244 244 245 std::vector<ImageEntity*>::iterator it;246 245 std::vector<MenuLayer>::iterator mit; 247 246 for(mit = this->menuLayers.begin(); mit != this->menuLayers.end(); mit++) -
trunk/src/story_entities/story_entity.cc
r6878 r6992 22 22 #include "story_entity.h" 23 23 24 #include "resource_manager.h" 24 25 #include "load_param.h" 25 26 … … 39 40 this->isRunning = false; 40 41 42 this->loadFile = NULL; 41 43 this->storyID = -1; 42 44 this->description = NULL; … … 66 68 .describe("A Unique Identifier for this StoryEntity"); 67 69 70 LoadParam(root, "path", this, StoryEntity, setLoadFile) 71 .describe("DEPRICATED FORM OF file. The Filename of this StoryEntity (relative from the data-dir)"); 72 73 LoadParam(root, "file", this, StoryEntity, setLoadFile) 74 .describe("The Filename of this StoryEntity (relative from the data-dir)"); 75 68 76 LoadParam(root, "nextid", this, StoryEntity, setNextStoryID) 69 77 .describe("Sets the ID of the next StoryEntity"); … … 86 94 87 95 /** 96 * sets the track path of this world 97 * @param name the name of the path 98 */ 99 void StoryEntity::setLoadFile(const char* fileName) 100 { 101 if (this->loadFile) 102 delete this->loadFile; 103 if (ResourceManager::isFile(fileName)) 104 { 105 this->loadFile = new char[strlen(fileName)+1]; 106 strcpy(this->loadFile, fileName); 107 } 108 else 109 this->loadFile = ResourceManager::getFullName(fileName); 110 } 111 112 113 /** 88 114 * sets the descroption of this StoryEntity 89 115 * @param name name … … 101 127 } 102 128 129 /** 130 * sets the id of the next story entity: StoryEntities can choose their following entity themselfs. 131 * the entity id defined here will be startet after this entity ends. this can be convenient if you 132 * want to have a non linear story with switches. 133 * @param nextStoryID the story id of the next StoryEntity 134 */ 135 void StoryEntity::setNextStoryID(int nextStoryID) 136 { 137 this->nextStoryID = nextStoryID; 138 } 103 139 104 140 /** -
trunk/src/story_entities/story_entity.h
r6853 r6992 60 60 /** sets the story id of the current entity, this enables it to be identified in a global context. @returns the story id */ 61 61 inline int getStoryID() { return this->storyID; } 62 /** sets the id of the next story entity: StoryEntities can choose their following entity themselfs. 63 * the entity id defined here will be startet after this entity ends. this can be convenient if you 64 * want to have a non linear story with switches. 65 * @param nextStoryID the story id of the next StoryEntity */ 66 inline void setNextStoryID(int nextStoryID) { this->nextStoryID = nextStoryID; } 62 63 void setLoadFile( const char* fileName); 64 /** @returns the Filename this StoryEntity was loaded with */ 65 const char* getLoadFile() const { return this->loadFile; } 66 67 void setNextStoryID(int nextStoryID); 67 68 /** gets the story id of the current entity @returns story id */ 68 inline int getNextStoryID() { return this->nextStoryID; }69 inline int getNextStoryID() const { return this->nextStoryID; } 69 70 inline void setDescription(const char* description); 70 71 /** @returns the description of this StoryEntity */ 71 72 inline const char* getDescription() { return this->description; } 73 74 75 72 76 /** toggle the menu visibility: SimpleMenu specific */ 73 77 inline void addToGameMenu(int toggle) { this->bMenuEntry = (bool)toggle; } … … 90 94 91 95 private: 92 int storyID; //!< this is the number of this entity, identifying it in a list/tree... 93 int nextStoryID; //!< if this entity has finished, this entity shall be called 94 char* description; //!< the description of the StoryEntity 95 char* menuItemImage; //!< the item image of the StoryEntity 96 char* menuScreenshoot; //!< the screenshoot of the StoryEntity 97 bool bMenuEntry; //!< If true, this GameWorld apears in the SimpleMenu: SimpleMenu specific 96 int storyID; //!< this is the number of this entity, identifying it in a list/tree... 97 int nextStoryID; //!< if this entity has finished, this entity shall be called 98 char* loadFile; //!< The file from which this world is loaded 99 100 char* description; //!< the description of the StoryEntity 101 char* menuItemImage; //!< the item image of the StoryEntity 102 char* menuScreenshoot; //!< the screenshoot of the StoryEntity 103 bool bMenuEntry; //!< If true, this GameWorld apears in the SimpleMenu: SimpleMenu specific 98 104 }; 99 105
Note: See TracChangeset
for help on using the changeset viewer.