[Orxonox-commit 6669] r11305 - in code/branches/HUD_HS16/src/modules: overlays/hud pickup

patricwi at orxonox.net patricwi at orxonox.net
Mon Nov 21 16:18:45 CET 2016


Author: patricwi
Date: 2016-11-21 16:18:45 +0100 (Mon, 21 Nov 2016)
New Revision: 11305

Modified:
   code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.cc
   code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.h
   code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc
   code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.h
   code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc
   code/branches/HUD_HS16/src/modules/pickup/PickupManager.h
Log:
linker error

Modified: code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.cc
===================================================================
--- code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.cc	2016-11-21 15:10:07 UTC (rev 11304)
+++ code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.cc	2016-11-21 15:18:45 UTC (rev 11305)
@@ -64,12 +64,12 @@
         }
     }
 
-    void initializeMaterial(const std::string& s)
+    void HUDPickupItem::initializeMaterial(const std::string& s)
     {
         overlayElement_->setMaterialName(s);
     }
 
-    void printHello()
+    void HUDPickupItem::printHello()
     {
         orxout() << "lets say hello" << endl;
     }

Modified: code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.h
===================================================================
--- code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.h	2016-11-21 15:10:07 UTC (rev 11304)
+++ code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupItem.h	2016-11-21 15:18:45 UTC (rev 11305)
@@ -52,4 +52,4 @@
     };
 }
 
-#endif /* _HUDWeapon_H__ */
\ No newline at end of file
+#endif
\ No newline at end of file

Modified: code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc
===================================================================
--- code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc	2016-11-21 15:10:07 UTC (rev 11304)
+++ code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc	2016-11-21 15:18:45 UTC (rev 11305)
@@ -36,6 +36,7 @@
 #include "HUDPickupSystem.h"
 #include "pickup/Pickup.h"
 #include "HUDPickupItem.h"
+#include "pickup/PickupManager.h"
 
 namespace orxonox
 {
@@ -52,6 +53,7 @@
         orxout() << "hello here is the HUDPickupSystem" << endl;
         this->background_->addChild(overlayElement_);
 
+        PickupManager::getInstance().setPickupSystem(this);
     }
 
     HUDPickupSystem::~HUDPickupSystem()
@@ -64,12 +66,12 @@
 
    //TODO: XMLPort
 
-    void HUDPickupSystem::updatePickupList(std::vector<WeakPtr<Pickup>> picks)
+    void HUDPickupSystem::updatePickupList(std::vector<Pickupable*> picks)
     {
-        for(Pickup* p : picks)
+        for(Pickupable* p : picks)
         {
             HUDPickupItem* item = new HUDPickupItem(this->getContext());
-            // item->initializeMaterial(p->getRepresentationName());
+            item->initializeMaterial(((Pickup*)p)->getRepresentationName());
             item->printHello();
         }
     }

Modified: code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.h
===================================================================
--- code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.h	2016-11-21 15:10:07 UTC (rev 11304)
+++ code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.h	2016-11-21 15:18:45 UTC (rev 11305)
@@ -25,6 +25,11 @@
  *      ...
  *
  */
+
+
+#ifndef _HUDPickupSystem_H__
+#define _HUDPickupSystem_H__
+
 #include "overlays/OverlaysPrereqs.h"
 
 #include <map>
@@ -57,8 +62,8 @@
         // virtual void changedName() override;
         // virtual void positionChanged() override;
         // virtual void sizeChanged() override;
+        void updatePickupList(std::vector<Pickupable*> picks);    
     private:
-        void updatePickupList(std::vector<WeakPtr<Pickup>> picks);
         void createPickupList();
         void destroyAll();
 
@@ -67,4 +72,6 @@
 
         std::vector<PickupRepresentation> pickupRepresentations_;
     };
-}
\ No newline at end of file
+}
+
+#endif
\ No newline at end of file

Modified: code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc
===================================================================
--- code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc	2016-11-21 15:10:07 UTC (rev 11304)
+++ code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc	2016-11-21 15:18:45 UTC (rev 11305)
@@ -50,7 +50,7 @@
 
 #include "CollectiblePickup.h"
 #include "PickupRepresentation.h"
-// #include "overlays/hud/HUDPickupSystem.h"
+#include "overlays/hud/HUDPickupSystem.h"
 
 namespace orxonox
 {
@@ -69,7 +69,6 @@
 
     SetConsoleCommand("useUnusePickup", &PickupManager::useUnusePickup).addShortcut().setActive(true);
 
-   // SetConsoleCommand("HumanController", "fire",           &HumanController::fire          ).addShortcut().keybindMode(KeybindMode::OnHold);
     /**
     @brief
         Constructor. Registers the PickupManager and creates the default PickupRepresentation.
@@ -83,6 +82,11 @@
         orxout(internal_info, context::pickups) << "PickupManager created." << endl;
     }
 
+    void PickupManager::setPickupSystem(HUDPickupSystem* system)
+    {
+        pickupSystem=system;
+    }
+
     /**
     @brief
         Destructor.
@@ -294,11 +298,20 @@
             this->indexes_[pickup] = index;
             this->pickups_[index] = pickup;
 
-            //  //Add pickup keybinding
-            // if( KeyBinderManager::exists() )
-            //     addKeyBindingForNewPickup(pickup, index);
-            // else
-            //     orxout() << "Could not create new keybinding because KeyBinderManager doesn't exist." << endl;
+            //TODO
+            std::vector<Pickupable*> picks;
+
+            PickupManager& manager = PickupManager::getInstance();
+            
+            Pickupable* pickup = nullptr;
+
+            for(uint32_t i = 0; i!=10; i++)
+            {
+                pickup=manager.pickups_.find(i)->second;
+                picks.push_back(pickup);
+            }
+            // pickupSystem->updatePickupList(picks);
+            
         }
         else // If it was dropped, it is removed from the required lists.
         {
@@ -306,13 +319,7 @@
             std::map<Pickupable*, uint32_t>::iterator it = this->indexes_.find(pickup);
             index = it->second;
 
-            // //Remove pickup keybinding
-            // if( KeyBinderManager::exists() )
-            //       removeKeyBindingForOldPickup(pickup, index);
-            // else
-            //     orxout() << "Could not delete old keybinding because KeyBinderManager doesn't exist." << endl;
-
-            // Remove the Pickupable from the indexes_ and pickups_ list.
+            
             this->indexes_.erase(pickup);
             this->pickups_.find(index)->second=nullptr; //set to null, so that can be identified as free slot by getPickupIndex()
         }
@@ -342,40 +349,6 @@
 
     }
 
-    //PRECONDITION: KeyBinderManager exists, pickup is not NULL, 0 < index < 9
-    //FUNCTION: Adds a keybinding for the new pickup using its index and sets a console command
-    // void PickupManager::addKeyBindingForNewPickup(Pickupable* pickup, uint32_t index)
-    // {
-    //     std::string name="Keys.KeyNumpad";
-    //     std::string binding="useOrUnusePickup";
-
-    //     name.append(std::to_string(index));
-    //     binding.append(std::to_string(index));
-
-    //     SetConsoleCommand(binding, &PickupManager::useUnusePickup(pickup, index));
-    //     KeyBinderManager::getInstance().getCurrent()->setBinding(binding, name, true); 
-
-    //     orxout() << "Keybinding for item " << index << " has been added on keybinding " << name << endl;
-
-
-    // }
-
-    //PRECONDITION: KeyBinderManager exists, pickup is not NULL, 0 < index < 9
-    //FUNCTION: Removes the keybinding of the pickup using its index
-    // void PickupManager::removeKeyBindingForOldPickup(Pickupable* pickup, uint32_t index)
-    // {
-    //     std::string name="Keys.KeyNumpad";
-    //     std::string binding="";
-
-    //     name.append(std::to_string(index));
-
-    //     SetConsoleCommand(binding, nullptr);
-    //     KeyBinderManager::getInstance().getCurrent()->setBinding("", name, true); 
-
-    //     orxout() << "Keybinding for item " << index << " has been removed on keybinding " << name << endl;
-
-    // }
-
     //This function is called by the command line or by the key binding
     //it uses or unuses the pickup, depending on its current state
     void PickupManager::useUnusePickup(uint32_t index) 

Modified: code/branches/HUD_HS16/src/modules/pickup/PickupManager.h
===================================================================
--- code/branches/HUD_HS16/src/modules/pickup/PickupManager.h	2016-11-21 15:10:07 UTC (rev 11304)
+++ code/branches/HUD_HS16/src/modules/pickup/PickupManager.h	2016-11-21 15:18:45 UTC (rev 11305)
@@ -44,6 +44,7 @@
 
 #include "util/Singleton.h"
 #include "interfaces/PickupListener.h"
+#include "overlays/hud/HUDPickupSystem.h"
 
 namespace orxonox // tolua_export
 { // tolua_export
@@ -147,8 +148,10 @@
 
             static void dropPickupNetworked(uint32_t pickup); //!< Helper method to drop the input pickup on the server.
             static void usePickupNetworked(uint32_t pickup, bool use); //!< Helper method to use (or unuse) the input Pickupable on the server.
+            void setPickupSystem(HUDPickupSystem* system);
 
         private:
+            HUDPickupSystem* pickupSystem;
             static PickupManager* singletonPtr_s;
             static const std::string guiName_s; //!< The name of the PickupInventory
             bool guiLoaded_; //!< Whether the PickupInventory GUI has been loaded, yet.




More information about the Orxonox-commit mailing list