Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9783 in orxonox.OLD for branches


Ignore:
Timestamp:
Sep 21, 2006, 7:10:42 PM (18 years ago)
Author:
bensch
Message:

orxonox/new_class_id: more implementation on Resources

Location:
branches/new_class_id/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/coord/p_node.cc

    r9770 r9783  
    8080  PRINTF(4)("delete %s::%s\n", this->getClassCName(), this->getCName());
    8181  // remove the Node, delete it's children (if required).
     82  PNode* last = NULL;
     83  this->debugNode(0);
     84
    8285  while(!this->children.empty())
    8386  {
    8487    PNode* deleteNode = this->children.front();
     88    if (deleteNode == last)
     89    {
     90      PRINTF(1)("Node same as last that was tried to be deleted. FORCE delete of %p\n", deleteNode);
     91      delete deleteNode;
     92      continue;
     93    }
    8594    if ((this->parentMode & PNODE_PROHIBIT_CHILD_DELETE) ||
    8695        (deleteNode->parentMode & PNODE_PROHIBIT_DELETE_WITH_PARENT))
     
    108117      delete deleteNode;
    109118    }
     119    last = deleteNode;
    110120  }
    111121
     
    913923  int childNodeCount = 0;
    914924  this->countChildNodes(childNodeCount);
    915 
     925  printf("%p:", this);
    916926  PRINT(0)("PNode(%s::%s) - absCoord: (%0.2f, %0.2f, %0.2f), relCoord(%0.2f, %0.2f, %0.2f), direction(%0.2f, %0.2f, %0.2f) - %s - %d childs\n",
    917927           this->getClassCName(),
  • branches/new_class_id/src/lib/util/loading/resource.cc

    r9718 r9783  
    3737  // delete what has to be deleted here
    3838}
     39
     40
     41
     42
     43
     44
     45
     46
     47void Resource::KeepLevel::setKeepLevelName(unsigned int level, const std::string& name)
     48{
     49  if (_keepLevelName.size() <= level)
     50    _keepLevelName.resize(level+1);
     51  _keepLevelName[level] = name;
     52}
  • branches/new_class_id/src/lib/util/loading/resource.h

    r9758 r9783  
    2424  {
    2525  public:
    26     void setKeepLevelName(unsigned int level, const std::string& name)
    27     {
    28       if (_keepLevelName.size() <= level)
    29         _keepLevelName.resize(level+1);
    30       _keepLevelName[level] = name;
    31     }
     26    void setKeepLevelName(unsigned int level, const std::string& name);
    3227  private:
    3328    std::vector<std::string>     _keepLevelName;
    3429  };
    3530
    36 
     31protected:
    3732  class Type
    3833  {
    3934  public:
    40     Type(const ClassID& classID) : _classID(classID) { };
     35    Type(const ClassID& classID) : _id(-1), _classID(classID) { };
    4136
    4237    void addExtension(const std::string& extension);
    4338
     39    const ClassID& storedClassID() const { return _classID; };
     40    int id() const { return _id; };
     41    const std::vector<std::string>& resourcePaths() const { return _resourcePaths; };
     42
     43
     44    void setID(int id);
     45
    4446  private:
     47    int                           _id;
    4548    const ClassID&                _classID;
    4649    std::vector<std::string>      _resourcePaths;
     
    4952  };
    5053
     54  class Pointer {};
    5155
    5256
     
    5559  virtual ~Resource();
    5660
    57   virtual bool load(std::string& fileName, const MultiType& param1, const MultiType& param2);
     61  bool loadResource(std::string& fileName, Resource::Pointer* ptr);
    5862  virtual bool reload();
    5963  virtual bool unload();
    6064
    6165
     66
    6267private:
     68  std::string              _loadString;             //!< An identifier, to match when loading a File.
    6369  std::string              _fileName;
    6470  MultiType                _parameters[3];          //!< The Parameters given to this Resource.
  • branches/new_class_id/src/world_entities/projectiles/projectile.cc

    r9715 r9783  
    149149{
    150150  if (this->target == NULL)
    151     this->target = new PNode(target, PNODE_PARENT_MODE_DEFAULT | PNODE_REPARENT_ON_PARENTS_REMOVE);
     151    this->target = new PNode(target, PNODE_REPARENT_ON_PARENTS_REMOVE | PNODE_REPARENT_TO_NULL | PNODE_PROHIBIT_DELETE_WITH_PARENT);
    152152  else
    153153    this->target->setParent(target);
Note: See TracChangeset for help on using the changeset viewer.