Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 6, 2018, 3:16:00 AM (7 years ago)
Author:
landauf
Message:

[HUD_HS16] fixed wrong dependency between overlays and pickup module: pickup should NOT depend on overlays; instead overlays should use pickup.

also reverted all changes from HUD_HS16 in PickupManager for several reasons:

  • calling HUDPickupSystem is not necessary anymore due to the fixed dependencies
  • adding a console command is not necessary because there is already a full GUI for this purpose (press F4)
  • limiting the number of pickups to 10 is a bad idea because PickupManager manages pickups for ALL players in the game
Location:
code/trunk/src/modules/overlays
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/overlays/CMakeLists.txt

    r11056 r11704  
    1616  LINK_LIBRARIES
    1717    orxonox
     18    pickup
    1819    weapons
    1920  SOURCE_FILES ${OVERLAYS_SRC_FILES}
  • code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc

    r11703 r11704  
    3838#include "HUDPickupSystem.h"
    3939#include "HUDPickupItem.h"
    40 #include "pickup/Pickup.h"
    4140#include "pickup/PickupManager.h"
    4241
     
    6665    }
    6766   
    68     void HUDPickupSystem::sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_)
     67    void HUDPickupSystem::tick(float dt)
    6968    {
     69        SUPER(HUDPickupSystem, tick, dt);
     70
    7071        //hide all pickup symbols in HUD and delete from local map
    71        
    7272        for(HUDPickupItem* item : items_)
    7373        {
     
    8484        const float y = 0.075f;
    8585
    86         for(Pickupable* pickup:p)
     86        int numPickups = PickupManager::getInstance().getNumPickups();
     87        for (int index = 0; index < numPickups; ++index)
    8788        {
    88             int index = indexes_.find(pickup)->second;
    8989            int row = index / 5;
    9090            int column = index % 5;
    9191
     92            const PickupInventoryContainer* container = PickupManager::getInstance().popPickup();
     93
    9294            HUDPickupItem* item = new HUDPickupItem(this->getContext());
    93             item->initializeMaterial(this->getIcon(((Pickup*)pickup)->getRepresentationName()), offsetX+column*x, offsetY+row*y);
     95            item->initializeMaterial(this->getIcon(container->representationName), offsetX+column*x, offsetY+row*y);
    9496            item->setOverlayGroup(this->getOverlayGroup());
    9597            items_.push_back(item);
  • code/trunk/src/modules/overlays/hud/HUDPickupSystem.h

    r11702 r11704  
    3737#include "util/OgreForwardRefs.h"
    3838#include "overlays/OrxonoxOverlay.h"
     39#include "tools/interfaces/Tickable.h"
    3940
    4041namespace orxonox
    4142{
    42     class _OverlaysExport HUDPickupSystem : public OrxonoxOverlay
     43    class _OverlaysExport HUDPickupSystem : public OrxonoxOverlay, public Tickable
    4344    {
    4445    public:
     
    4647        virtual ~HUDPickupSystem();
    4748
    48         void sizeChanged();
    49         void sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_);
     49        virtual void tick(float dt) override;
     50        virtual void sizeChanged() override;
    5051
    5152    private:
Note: See TracChangeset for help on using the changeset viewer.