Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 29, 2015, 6:55:25 PM (6 years ago)
Author:
landauf
Message:

these two classes used pointers to weakptrs - why? just use normal weakptrs, that makes more sense

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/modules/pickup/PickupManager.cc

    r10478 r10559  
    9696
    9797        // Destroying all the WeakPointers that are still there.
    98         for(std::map<uint32_t, WeakPtr<Pickupable>*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
    99             delete it->second;
    10098        this->pickups_.clear();
    10199
     
    288286            // Add the Pickupable to the indexes_ and pickups_ lists.
    289287            this->indexes_[pickup] = index;
    290             this->pickups_[index] = new WeakPtr<Pickupable>(pickup);
     288            this->pickups_[index] = pickup;
    291289        }
    292290        else // If it was dropped, it is removed from the required lists.
     
    296294            index = it->second;
    297295
    298             // Remove the Pickupable form the indexes_ and pickups_ list.
    299             WeakPtr<Pickupable>* ptr = this->pickups_[index];
     296            // Remove the Pickupable from the indexes_ and pickups_ list.
    300297            this->indexes_.erase(it);
    301298            this->pickups_.erase(index);
    302             delete ptr;
    303299        }
    304300
     
    402398            if(this->pickups_.empty())
    403399                return;
    404             Pickupable* pickupable = this->pickups_.find(pickup)->second->get();
     400            Pickupable* pickupable = this->pickups_.find(pickup)->second;
    405401            if(pickupable != NULL)
    406402                pickupable->drop();
     
    445441            if(this->pickups_.empty())
    446442                return;
    447             Pickupable* pickupable = this->pickups_.find(pickup)->second->get();
     443            Pickupable* pickupable = this->pickups_.find(pickup)->second;
    448444            if(pickupable != NULL)
    449445                pickupable->setUsed(use);
Note: See TracChangeset for help on using the changeset viewer.