Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3238 in orxonox.OLD for orxonox/branches/nico/src/world.h


Ignore:
Timestamp:
Dec 20, 2004, 2:42:54 AM (21 years ago)
Author:
bensch
Message:

orxonox/branches: updated branches: buerli, nico, sound. And moved bezierTrack to old.bezierTrack. Conflicts resolved in a usefull order.
Conflics mostly resolved in favor of trunk
merge.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/nico/src/world.h

    r2822 r3238  
    44*/
    55
    6 #ifndef WORLD_H
    7 #define WORLD_H
     6#ifndef _WORLD_H
     7#define _WORLD_H
    88
    99#include "stdincl.h"
     
    2222  World (char* name);
    2323  World (int worldID);
    24   ~World ();
     24  virtual ~World ();
    2525
    2626  template<typename T>
    27     T* spawn(Location* loc, WorldEntity* owner);        // template to be able to spawn any derivation of WorldEntity
     27    T* spawn (Location* loc, WorldEntity* owner);       // template to be able to spawn any derivation of WorldEntity
    2828  template<typename T>
    29     T* spawn(Placement* plc, WorldEntity* owner);
     29    T* spawn (Placement* plc, WorldEntity* owner);
    3030 
    31   virtual Error init();
    32   virtual Error start();
    33   virtual Error stop();
    34   virtual Error pause();
    35   virtual Error resume();
     31  virtual ErrorMessage init ();
     32  virtual ErrorMessage start ();
     33  virtual ErrorMessage stop ();
     34  virtual ErrorMessage pause ();
     35  virtual ErrorMessage resume ();
    3636
    37   virtual void load();
     37  virtual void load ();
     38  virtual void destroy ();
    3839
    39   void time_slice (Uint32 deltaT);
     40  void timeSlice (Uint32 deltaT);
    4041  void collide ();
    4142  void draw ();
    4243  void update ();       // maps Locations to Placements
    43   void calc_camera_pos (Location* loc, Placement* plc);
     44  void calcCameraPos (Location* loc, Placement* plc);
    4445       
    4546  void unload ();
     47  bool command (Command* cmd);
    4648 
    47   void setTrackLen(Uint32 tracklen);
    48   int getTrackLen();
    49   bool system_command (Command* cmd);
    50   Camera* getCamera();
     49  void setTrackLen (Uint32 tracklen);
     50  int getTrackLen ();
     51  //bool system_command (Command* cmd);
     52  Camera* getCamera ();
    5153
    52   void spawn(WorldEntity* entity);
    53   void spawn(WorldEntity* entity, Location* loc);
    54   void spawn(WorldEntity* entity, Placement* plc);
     54  void spawn (WorldEntity* entity);
     55  void spawn (WorldEntity* entity, Location* loc);
     56  void spawn (WorldEntity* entity, Placement* plc);
    5557
    5658  tList<WorldEntity>* entities;
     
    7476  WorldEntity* localPlayer;
    7577 
    76   void mainLoop();
    77   void synchronize();
    78   void handle_input();
    79   void time_slice();
    80   void collision();
    81   void display();
    82   void debug();
     78  void mainLoop ();
     79  void synchronize ();
     80  void handleInput ();
     81  void timeSlice ();
     82  void collision ();
     83  void display ();
     84  void debug ();
    8385};
    8486
    85 /**
    86     \brief spawn a new WorldEntity at a Location
    87     \param loc: the Location where the Entity should be spawned
    88     \param owner: a pointer to the parent of the Entity
    89     \return a pointer to the new WorldEntity or NULL if there was an error
    90    
    91     You can use this function to spawn any derivation of WorldEntity you want, just specify the desired
    92     class within the template specification brackets. Do not attempt to spawn any classes that have NOT been
    93     derived from WorldEntity, you won't even be able to compile the code. Note that this version of spawn()
    94     works with both free and bound WorldEntities.
    95 */
    96 template<typename T> T* World::spawn(Location* loc = NULL, WorldEntity* owner = NULL)
    97 {
    98   Location zeroloc;
    99   T* entity = new T();
    100   entities->add ((WorldEntity*)entity, LIST_ADD_NEXT);
    101   if( loc == NULL)
    102     {
    103       zeroloc.dist = 0;
    104       zeroloc.part = 0;
    105       zeroloc.pos = Vector();
    106       zeroloc.rot = Quaternion();
    107       loc = &zeroloc;
    108     }
    109   entity->init (loc, owner);
    110   if (entity->bFree)
    111     {
    112       track[loc->part].map_coords( loc, entity->get_placement());
    113     }
    114   entity->post_spawn ();
    115   return entity;
    116 }
    117 
    118 /**
    119     \brief spawn a new WorldEntity at a Placement
    120     \param lplc: the placement where the Entity should be spawned
    121     \param owner: a pointer to the parent of the Entity
    122     \return a pointer to the new WorldEntity or NULL if there was an error
    123    
    124     You can use this function to spawn any FREE derivation of WorldEntity you want, just specify the desired
    125     class within the template specification brackets. Do not attempt to spawn any classes that have NOT been
    126     derived from WorldEntity, you won't even be able to compile the code. Note that this version of spawn()
    127     works with free WorldEntities only, you will provoke an error message if you try to spawn a bound Entity with
    128     a Placement.
    129 */
    130 template<typename T> T* World::spawn(Placement* plc, WorldEntity* owner = NULL)
    131 {
    132   T* entity = new T();
    133   entities->add ((WorldEntity*)entity, LIST_ADD_NEXT);
    134   entity->init (plc, owner);
    135   if (!entity->bFree)
    136     {
    137       printf("Can't spawn unfree entity with placement\n");
    138       entities->remove( (WorldEntity*)entity, LIST_FIND_FW);
    139       return NULL;
    140     }
    141   entity->post_spawn ();
    142   return entity;
    143 }
    144 
    145 #endif
     87#endif /* _WORLD_H */
Note: See TracChangeset for help on using the changeset viewer.