Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 28, 2016, 7:21:35 PM (7 years ago)
Author:
patricwi
Message:

linker problem solved, visuals work as long as only 1 item is picked up.

File:
1 edited

Legend:

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

    r11305 r11314  
    8383    }
    8484
    85     void PickupManager::setPickupSystem(HUDPickupSystem* system)
    86     {
    87         pickupSystem=system;
    88     }
    89 
    9085    /**
    9186    @brief
     
    271266        assert(pickup);
    272267
     268        if(!pickupSystem)
     269        {
     270            for (HUDPickupSystem* hud : ObjectList<HUDPickupSystem>())
     271                pickupSystem = hud;
     272        }
     273        assert(pickupSystem); //pickupSystem HAS to be there!
     274
    273275        if(!GameMode::isMaster()) // If this is neither standalone nor the server.
    274276            return;
     
    299301            this->pickups_[index] = pickup;
    300302
    301             //TODO
    302             std::vector<Pickupable*> picks;
    303 
    304             PickupManager& manager = PickupManager::getInstance();
    305            
    306             Pickupable* pickup = nullptr;
    307 
    308             for(uint32_t i = 0; i!=10; i++)
    309             {
    310                 pickup=manager.pickups_.find(i)->second;
    311                 picks.push_back(pickup);
    312             }
    313             // pickupSystem->updatePickupList(picks);
     303            orxout() << "the pickup is: " << pickup << endl;
     304
     305            this->picks.push_back(pickup);
     306
     307            pickupSystem->updatePickupList(picks);
    314308           
    315309        }
     
    320314            index = it->second;
    321315
    322            
    323316            this->indexes_.erase(pickup);
    324317            this->pickups_.find(index)->second=nullptr; //set to null, so that can be identified as free slot by getPickupIndex()
     318
     319
     320            this->picks.erase(std::remove(this->picks.begin(), this->picks.end(), pickup), this->picks.end()); //remove pickup from vector
     321
     322            pickupSystem->removePickup(pickup);
     323            pickupSystem->updatePickupList(picks);
    325324        }
    326325
Note: See TracChangeset for help on using the changeset viewer.