Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6517 in orxonox.OLD


Ignore:
Timestamp:
Jan 17, 2006, 11:13:05 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: each BaseObject saves its TiXmlElement as a TiXmlNode*.
This will be good for
1.) sync in network
2.) saving entitites

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/lang/base_object.cc

    r6498 r6517  
    3232 * @param root the element to load from
    3333 */
    34 BaseObject::BaseObject(const TiXmlElement* root)
     34BaseObject::BaseObject()
    3535{
    3636  this->className = "BaseObject";
     
    3939  this->objectName = NULL;
    4040  this->classList = NULL;
    41 
    42   if (root)
    43     this->loadParams(root);
     41  this->xmlElem = NULL;
    4442
    4543//  ClassList::addToClassList(this, this->classID, "BaseObject");
     
    5654  if (this->objectName)
    5755    delete[] this->objectName;
     56  if (this->xmlElem != NULL)
     57    delete this->xmlElem;
    5858}
    5959
     
    6464void BaseObject::loadParams(const TiXmlElement* root)
    6565{
     66  // all loadParams should sometime arrive here.
     67  assert (root != NULL);
     68
     69  if (this->xmlElem != NULL)
     70    delete this->xmlElem;
     71  this->xmlElem = root->Clone();
    6672  // name setup
    6773  LoadParam(root, "name", this, BaseObject, setName)
  • trunk/src/lib/lang/base_object.h

    r6512 r6517  
    1818#include "stdincl.h"
    1919
     20class TiXmlNode;
    2021class TiXmlElement;
    2122class ClassList;
     
    2526
    2627 public:
    27   BaseObject (const TiXmlElement* root = NULL);
     28  BaseObject ();
    2829  virtual ~BaseObject ();
    2930
     
    4950  int       writeState(const byte* data, int length, int sender);
    5051  int       readState(byte* data, int maxLength );
     52
    5153 protected:
    5254  void setClassID(ClassID classID, const char* className);
    5355
    54   private:
     56 private:
    5557    const char*        className;        //!< the name of the class
    5658    long               classID;          //!< this is the id from the class_id.h enumeration
     
    5860
    5961    ClassList*         classList;        //!< Pointer to the ClassList this Object is inside of
     62
     63    TiXmlNode*         xmlElem;          //!< The XML Element with wich this Object was loaded(saved).
    6064};
    6165
  • trunk/src/world_entities/space_ships/space_ship.cc

    r6512 r6517  
    123123  PRINTF(4)("SPACESHIP INIT\n");
    124124
    125   EventHandler::getInstance()->grabEvents(true);
     125//  EventHandler::getInstance()->grabEvents(true);
    126126
    127127  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
  • trunk/src/world_entities/weapons/cannon.cc

    r6512 r6517  
    5555{
    5656  this->init();
    57   this->loadParams(root);
     57  if (root != NULL)
     58    this->loadParams(root);
    5859}
    5960
Note: See TracChangeset for help on using the changeset viewer.