Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/story_entities/story_entity.h @ 6372

Last change on this file since 6372 was 6372, checked in by patrick, 18 years ago

network: more cleanup in the StoryEntity, thightening the interface and function renames

File size: 2.8 KB
Line 
1/*!
2 * @file story_entity.h
3  *  holds the base class of everything that is playable - that is part of the story
4*/
5
6
7#ifndef _STORY_ENTITY_H
8#define _STORY_ENTITY_H
9
10#include "base_object.h"
11#include "story_def.h"
12#include "error.h"
13
14//! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc...
15class StoryEntity : public BaseObject {
16
17 public:
18  StoryEntity ();
19  virtual ~StoryEntity ();
20
21  /* initialisation and loading */
22  /** initializes a Story Entity to the needed values */
23  virtual ErrorMessage init() {};
24  /** called to load the data into the story entity */
25  virtual ErrorMessage loadData() {};
26
27  /* running, stopping and pausing */
28  /** called shortly before starting the Entity */
29  virtual ErrorMessage preStart() {};
30  /** starts the Entity. Starts the main cycle */
31  virtual ErrorMessage start() = 0;
32  /** pauses the Entity. call to resume required to get it running again */
33  virtual ErrorMessage pause() = 0;
34  /** resumes the Entity after a stop/pause or suspend. */
35  virtual ErrorMessage resume() = 0;
36  /** suspends the Entity detaches all mayor functions  (optional) */
37  virtual ErrorMessage suspend() {};
38  /** rewinds to the beginning/last checkpoint */
39  virtual ErrorMessage rewind() {};
40  /** leaves the Entity. Ends it */
41  virtual ErrorMessage preStop() {};
42  /**  Stops the entity. */
43  virtual ErrorMessage stop() = 0;
44
45
46  /** sets the story id of the current entity, this enables it to be identified in a global context.  @param storyID the story id */
47  inline void setStoryID(int storyID) { this->storyID = storyID; }
48  /** sets the story id of the current entity, this enables it to be identified in a  global context. @returns  the story id  */
49  inline int getStoryID() { this->storyID = storyID; }
50  /**  sets the id of the next story entity: StoryEntities can choose their following entity themselfs.
51   * the entity id defined here  will be startet after this entity ends. this can be convenient if you
52   * want to have a non linear story with switches.
53   * @param nextStoryID the story id of the next StoryEntity   */
54  inline void setNextStoryID(int nextStoryID) { this->nextStoryID = nextStoryID; }
55  /**  gets the story id of the current entity @returns story id */
56  inline int getNextStoryID() { return this->nextStoryID; }
57
58
59
60  protected:
61    bool isInit;         //!< if the entity is initialized, this has to be true.
62    bool readyToRun;     //!< If the entity is ready to run -> post-check.
63    bool isPaused;       //!< is true if the entity is paused
64    bool isSuspended;    //!< if the Entity is suspended.
65
66 private:
67    int storyID;           //!< this is the number of this entity, identifying it in a list/tree...
68    int nextStoryID;       //!< if this entity has finished, this entity shall be called
69};
70
71#endif /* _STORY_ENTITY_H */
Note: See TracBrowser for help on using the repository browser.