Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 13, 2010, 10:39:54 PM (15 years ago)
Author:
dafrick
Message:

Resolved bug, that caused orxonox to crash whenever a level with pickups was loaded twice in one session.
Also some more debug/info output, commenting and cleanup.

Location:
code/trunk/src/orxonox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/interfaces/Pickupable.cc

    r6540 r6725  
    4646        Constructor. Registers the objects and initializes its member variables.
    4747    */
    48     Pickupable::Pickupable() : used_(false), pickedUp_(false)
     48    Pickupable::Pickupable() : pickupIdentifier_(NULL), used_(false), pickedUp_(false)
    4949    {       
    5050        RegisterRootObject(Pickupable);
     
    6969            this->setCarrier(NULL);
    7070        }
     71       
     72        if(this->pickupIdentifier_ != NULL)
     73            this->pickupIdentifier_->destroy();
    7174    }
    7275   
  • code/trunk/src/orxonox/pickup/PickupIdentifier.cc

    r6540 r6725  
    4848        RegisterRootObject(PickupIdentifier);
    4949       
     50        if(pickup == NULL)
     51            COUT(1) << "Error, PickupIdentifier was created without a valid Pickupable." << std::endl;
     52       
    5053        this->pickup_ = pickup;
    5154    }
     
    5356    PickupIdentifier::~PickupIdentifier()
    5457    {
    55        
     58
    5659    }
    5760   
     
    6669    int PickupIdentifier::compare(const PickupIdentifier* identifier) const
    6770    {
     71        if(identifier == NULL)
     72        {
     73            return 1;
     74            COUT(1) << "Error in PickupIdentifier::compare: Input Identifier is NULL." << std::endl;
     75        }
     76       
     77        if(identifier->pickup_ == NULL && this->pickup_ == NULL)
     78        {
     79            return 0;
     80            COUT(1) << "Error in PickupIdentifier::compare: Pickup stored by Identifier is NULL." << std::endl;
     81        }
     82       
     83        if(identifier->pickup_ == NULL)
     84        {
     85            return 1;
     86            COUT(1) << "Error in PickupIdentifier::compare: Pickup stored by Identifier is NULL." << std::endl;
     87        }
     88       
     89        if(this->pickup_ == NULL)
     90        {
     91            return -1;
     92            COUT(1) << "Error in PickupIdentifier::compare: Pickup stored by Identifier is NULL." << std::endl;
     93        }
     94       
    6895        //! If the classIdentifiers are not the same (meaning the PickupIdentifiers identify different classes), the obviously the two Pickupables identified by the PickupIdentifiers cannot be the same. An ordering is established through the alphabetical ordering of the respective classnames.
    6996        if(!identifier->pickup_->getIdentifier()->isExactlyA(this->pickup_->getIdentifier()))
     
    91118        }
    92119           
    93         return false;
     120        return 0;
    94121    }
    95122   
Note: See TracChangeset for help on using the changeset viewer.