Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7368 in orxonox.OLD for trunk


Ignore:
Timestamp:
Apr 25, 2006, 11:37:59 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: some renamings, and GameWorldData now has lists for what EntityLists should be drawed/ticked/collided(not yet implemented).

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell_command.h

    r7225 r7368  
    8282    static const char* paramToString(long parameter);
    8383
    84   protected:
    85     MultiType*                       defaultValue;                         //!< Default Values.
    86 
    8784  private:
    8885    ShellCommandClass*               shellClass;                           //!< A Pointer to the Shell-Class this Command belongs to.
  • trunk/src/story_entities/game_world.cc

    r7339 r7368  
    2323#include "state.h"
    2424#include "class_list.h"
    25 #include "substring.h"
    2625
    2726#include "util/loading/game_loader.h"
    2827
    29 #include "p_node.h"
    30 #include "world_entity.h"
    3128#include "player.h"
    3229#include "camera.h"
     
    3532#include "test_entity.h"
    3633#include "terrain.h"
    37 #include "md2Model.h"
    38 #include "world_entities/projectiles/projectile.h"
    39 #include "npcs/npc_test1.h"
    4034#include "playable.h"
    4135
     
    4337
    4438#include "util/loading/factory.h"
     39#include "util/loading/load_param.h"
    4540#include "fast_factory.h"
    46 #include "util/loading/load_param.h"
    4741#include "shell_command.h"
    4842
  • trunk/src/story_entities/game_world.h

    r7339 r7368  
    2828class GameWorld : public StoryEntity
    2929{
    30 
    3130  public:
    3231    GameWorld ();
  • trunk/src/story_entities/game_world_data.h

    r7287 r7368  
    1010#include "data_tank.h"
    1111#include "error.h"
    12 
     12#include "object_manager.h"
    1313
    1414class Camera;
     
    1616class Terrain;
    1717class WorldEntity;
    18 class ObjectManager;
    1918
    2019class GLMenuImageScreen;
     
    3231class GameWorldData : public DataTank
    3332{
    34 
    3533  public:
    3634    GameWorldData();
     
    5553
    5654  public:
    57     GLMenuImageScreen*  glmis;                       //!< The Level-Loader Display
     55    GLMenuImageScreen*            glmis;          //!< The Level-Loader Display
    5856
    59     Camera*             localCamera;                 //!< The current camera
    60     Player*             localPlayer;                 //!< The player, you fly through the level.
    61     WorldEntity*        sky;                         //!< The environmental sky of orxonox
    62     Terrain*            terrain;                     //!< The terrain - ground
     57    Camera*                       localCamera;    //!< The current camera
     58    Player*                       localPlayer;    //!< The player, you fly through the level.
     59    WorldEntity*                  sky;            //!< The environmental sky of orxonox
     60    Terrain*                      terrain;        //!< The terrain - ground
    6361
    64     OggPlayer*          music;                       //!< Reference to the SoundEngine's music player (OggPlayer)
    65     ObjectManager*      objectManager;               //!< Reference to the objects manager
     62    OggPlayer*                    music;          //!< Reference to the SoundEngine's music player (OggPlayer)
     63    ObjectManager*                objectManager;  //!< Reference to the objects manager
    6664
    67     GameRules*          gameRule;                   //!< Reference to the game rules of this game
     65    GameRules*                    gameRule;       //!< Reference to the game rules of this game
     66
     67    std::list<OM_LIST>            tickLists;      //!< The Lists in the GameWorld that should be ticked.
     68    std::list<OM_LIST>            drawLists;      //!< The Lists in the GameWorld, that should be drawn.
    6869};
    6970
  • trunk/src/util/object_manager.cc

    r7221 r7368  
    105105
    106106/**
    107  * returns a new List with a list of WorldEntities of distance Radius from center
    108  */
    109 std::list<WorldEntity*>* ObjectManager::distanceFromObject(const PNode& center, float radius, ClassID classID)
     107 * @returns a new List with a list of WorldEntities of distance Radius from center
     108 */
     109void ObjectManager::distanceFromObject(EntityList& entities, const PNode& center, float radius, ClassID classID)
    110110{
    111111  const std::list<BaseObject*>* objectList = ClassList::getList(classID);
    112112  if (objectList != NULL)
    113113  {
    114     std::list<WorldEntity*>* newList = new std::list<WorldEntity*>;
    115114
    116115    list<BaseObject*>::const_iterator node;
    117116    for (node = objectList->begin(); node != objectList->end(); node++)
    118117      if ((dynamic_cast<PNode*>(*node)->getAbsCoor() - center.getAbsCoor()).len() < radius)
    119         newList->push_back(dynamic_cast<WorldEntity*>(*node));
    120     return newList;
    121   }
    122   return NULL;
     118        entities.push_back(dynamic_cast<WorldEntity*>(*node));
     119  }
    123120}
    124121
  • trunk/src/util/object_manager.h

    r7221 r7368  
    6767
    6868//! A powerfull handler for the Object (WorldEntities) in the World.
    69 class ObjectManager : public BaseObject {
     69class ObjectManager : public BaseObject
     70{
     71public:
     72  typedef std::list<WorldEntity*> EntityList;      //!< A type definition to make it easy to use EntityLists.
    7073
    71  public:
    72    ObjectManager();
    73    virtual ~ObjectManager();
     74  ObjectManager();
     75  virtual ~ObjectManager();
    7476
    7577  void flush();
     
    7981
    8082
    81   std::list<WorldEntity*>& getObjectList(OM_LIST listNumber) { return this->objectLists[listNumber]; }
    82   const std::list<WorldEntity*>& getObjectList(OM_LIST listNumber) const { return this->objectLists[listNumber]; }
     83  /** @returns the List (listnumber) of objects. @param listNumber the List to get. */
     84  EntityList& getObjectList(OM_LIST listNumber) { return this->objectLists[listNumber]; }
     85  /** @returns a constant LIST of Objects. @param listNumber the objectList to returns */
     86  const EntityList& getObjectList(OM_LIST listNumber) const { return this->objectLists[listNumber]; }
    8387
    84   static std::list<WorldEntity*>* distanceFromObject(const PNode& center, float radius, ClassID classID);
     88  static void distanceFromObject(EntityList& entities, const PNode& center, float radius, ClassID classID);
    8589
    8690  void debug(OM_LIST omList, unsigned int level = 0) const;
     
    9094  static const char* OMListToString(OM_LIST omList);
    9195
    92  private:
    93   const std::list<BaseObject>*            pNodeList;
     96private:
     97  const std::list<BaseObject>*            pNodeList;                //!< The List of PNodes.
    9498
    95 
    96   std::list<WorldEntity*>                 objectLists[OM_SIZE];
     99  EntityList                              objectLists[OM_SIZE];     //!< The ObjectLists.
    97100
    98101  static const char*                      objectManagerListNames[]; //!< Names of all the lists
  • trunk/src/world_entities/projectiles/bomb.cc

    r7193 r7368  
    183183void Bomb::detonate(float size)
    184184{
    185   std::list<WorldEntity*>* detonationList = ObjectManager::distanceFromObject(*this, size, CL_NPC);
    186   if (detonationList != NULL)
    187   {
    188     while( !detonationList->empty() )
     185  ObjectManager::EntityList detonationList;
     186  ObjectManager::distanceFromObject(detonationList, *this, size, CL_NPC);
     187    while( !detonationList.empty() )
    189188    {
    190       detonationList->front()->collidesWith(this, Vector(0,0,0));
    191       detonationList->pop_front();
     189      detonationList.front()->collidesWith(this, Vector(0,0,0));
     190      detonationList.pop_front();
    192191    }
    193     delete detonationList;
    194   }
    195192}
Note: See TracChangeset for help on using the changeset viewer.