[Orxonox-commit 7083] r11700 - in code/trunk: . src/modules/overlays/hud src/modules/pickup src/orxonox/interfaces
landauf at orxonox.net
landauf at orxonox.net
Sat Jan 6 00:15:27 CET 2018
Author: landauf
Date: 2018-01-06 00:15:25 +0100 (Sat, 06 Jan 2018)
New Revision: 11700
Modified:
code/trunk/
code/trunk/src/modules/overlays/hud/HUDPickupItem.cc
code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc
code/trunk/src/modules/overlays/hud/HUDPickupSystem.h
code/trunk/src/modules/pickup/PickupManager.cc
code/trunk/src/orxonox/interfaces/Pickupable.cc
Log:
merged the remaining commits of HUD_HS16 branch back to trunk (except commit r11392 which added DDDialogue that seems to be just a test)
Index: code/trunk
===================================================================
--- code/trunk 2018-01-04 00:08:43 UTC (rev 11699)
+++ code/trunk 2018-01-05 23:15:25 UTC (rev 11700)
Property changes on: code/trunk
___________________________________________________________________
Modified: svn:mergeinfo
## -2,7 +2,7 ##
/code/branches/Alejandro_FS17:11369-11447
/code/branches/BigShip_HS16:11213-11356
/code/branches/Dialogue_FS17:11360-11450
-/code/branches/HUD_HS16:11212-11353
+/code/branches/HUD_HS16:11212-11390,11392-11699
/code/branches/Highscore_HS16:11226-11355
/code/branches/ParticleEffectsFS15:10309-10612
/code/branches/Racingbot:9388-9513
Modified: code/trunk/src/modules/overlays/hud/HUDPickupItem.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDPickupItem.cc 2018-01-04 00:08:43 UTC (rev 11699)
+++ code/trunk/src/modules/overlays/hud/HUDPickupItem.cc 2018-01-05 23:15:25 UTC (rev 11700)
@@ -49,7 +49,7 @@
RegisterObject(HUDPickupItem);
std::string name = "HUDPickupItem" + getUniqueNumberString();
-
+ orxout() << "name: "<< name<<endl;
overlayElement_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", name ));
overlayElement_->setDimensions(0.075f,0.08f);
@@ -58,10 +58,10 @@
HUDPickupItem::~HUDPickupItem()
{
- if (this->isInitialized())
+ /*if (this->isInitialized())
{
overlayElement_=nullptr;
- }
+ }*/
}
void HUDPickupItem::initializeMaterial(const std::string& s, float x, float y)
@@ -77,7 +77,9 @@
if(!repaint) return; //dont do anything, if we are not allowed to repaint because the level is terminating
assert(overlayElement_);
assert(this->background_);
- overlayElement_->hide();
+ orxout()<< overlayElement_->getName()<< endl;
+ //overlayElement_->hide();
this->background_->removeChild(overlayElement_->getName());
+
}
}
Modified: code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc 2018-01-04 00:08:43 UTC (rev 11699)
+++ code/trunk/src/modules/overlays/hud/HUDPickupSystem.cc 2018-01-05 23:15:25 UTC (rev 11700)
@@ -55,10 +55,10 @@
HUDPickupSystem::~HUDPickupSystem()
{
- if (this->isInitialized())
+ /*if (this->isInitialized())
{
this->picks.clear();
- }
+ }*/
}
void HUDPickupSystem::sizeChanged()
@@ -67,54 +67,49 @@
}
+ void HUDPickupSystem::sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_)
+ {
+ //hide all pickup symbols in HUD and delete from local map
+
+ orxout() << "picks size before: " << picks.size() << endl;
+ orxout() << "p size before: " << p.size() << endl;
- void HUDPickupSystem::updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_)
- {
- int i =0;
+ for(const auto& sm_pair : picks)
+ {
+ sm_pair.second->hideMe(sm_pair.first, repaint);
+ orxout() << "deleting local list picks: " << picks.size() << " pickup ptr" << sm_pair.first << endl;
+ }
+
+ picks.clear();
+ assert(picks.empty()); //picks must be empty now
+
+ //add to local map and place on screen
+ int i = 0;
const float offsetX = 0.345f;
float offsetY = 0.82f;
const float x = 0.102f;
+ orxout() << "picks size after: " << picks.size() << endl;
+ orxout() << "p size after: " << p.size() << endl;
- if(picks.size()>0)
+ for(Pickupable* pickup:p)
{
- for(Pickupable* p : picks)
- {
- i = indexes_.find(p)->second;
- offsetY = 0.82f;
+ i=indexes_.find(pickup)->second;
+ //second row has offset
+ if(i==5)
+ {
+ i=0;
+ offsetY+=0.075f;
+ }
- if(i>=5)
- {
- offsetY+=0.075f;
- i-=5;
- }
- if(this->picks.count(p)==0)
- {
- HUDPickupItem* item = new HUDPickupItem(this->getContext());
- item->initializeMaterial(this->getIcon(((Pickup*)p)->getRepresentationName()), offsetX+i*x, offsetY);
-
- item->setOverlayGroup(this->getOverlayGroup());
- this->picks[p] = item;
- }
- }
+ HUDPickupItem* item = new HUDPickupItem(this->getContext());
+ item->initializeMaterial(this->getIcon(((Pickup*)pickup)->getRepresentationName()), offsetX+i*x, offsetY);
+ orxout() << "created new pickupHUDItem"<<endl;
+ item->setOverlayGroup(this->getOverlayGroup());
+ picks[pickup] = item;
}
}
- void HUDPickupSystem::createPickupList()
- {
- }
-
- void HUDPickupSystem::removePickup(Pickupable* pickup)
- {
- assert(pickup);
- HUDPickupItem* item = this->picks.find(pickup)->second;
- orxout(internal_info, context::pickups) << "removePickup: pickup= " << pickup << " item= " << item << endl;
- assert(item);
- item->hideMe(pickup, repaint);
- assert(overlayElement_);
- assert(this->background_);
- this->picks.erase(pickup);
- }
-
+
void HUDPickupSystem::destroyAll()
{
this->background_->removeChild(overlayElement_->getName());
Modified: code/trunk/src/modules/overlays/hud/HUDPickupSystem.h
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDPickupSystem.h 2018-01-04 00:08:43 UTC (rev 11699)
+++ code/trunk/src/modules/overlays/hud/HUDPickupSystem.h 2018-01-05 23:15:25 UTC (rev 11700)
@@ -56,9 +56,7 @@
virtual ~HUDPickupSystem();
void sizeChanged();
- void updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_);
- void createPickupList();
- void removePickup(Pickupable* pickup);
+ void sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_);
bool repaint=true; //if we shouldnt repaint, set this to false
Modified: code/trunk/src/modules/pickup/PickupManager.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupManager.cc 2018-01-04 00:08:43 UTC (rev 11699)
+++ code/trunk/src/modules/pickup/PickupManager.cc 2018-01-05 23:15:25 UTC (rev 11700)
@@ -102,10 +102,9 @@
// Destroying all the WeakPointers that are still there.
this->pickups_.clear();
-
this->indexes_.clear();
- orxout(internal_info, context::pickups) << "PickupManager destroyed." << endl;
+ orxout() << "PickupManager destroyed." << endl;
}
/**
@@ -265,6 +264,7 @@
{
assert(pickup);
+ orxout() << "just got called"<<endl;
for (HUDPickupSystem* hud : ObjectList<HUDPickupSystem>())
pickupSystem = hud;
@@ -299,7 +299,7 @@
this->picks.push_back(pickup);
if(pickupSystem)
- pickupSystem->updatePickupList(picks, indexes_);
+ pickupSystem->sync(picks, indexes_);
}
else // If it was dropped, it is removed from the required lists.
@@ -315,7 +315,8 @@
this->picks.erase(std::remove(this->picks.begin(), this->picks.end(), pickup), this->picks.end()); //remove pickup from vector
if(pickupSystem)
- pickupSystem->removePickup(pickup);
+ pickupSystem->sync(picks, indexes_);
+ orxout() << "end of pickupChangedPickedUp" << endl;
}
// If we're either in standalone mode or this is the host whom the change of the pickup's status concerns.
Modified: code/trunk/src/orxonox/interfaces/Pickupable.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/Pickupable.cc 2018-01-04 00:08:43 UTC (rev 11699)
+++ code/trunk/src/orxonox/interfaces/Pickupable.cc 2018-01-05 23:15:25 UTC (rev 11700)
@@ -79,6 +79,7 @@
if(this->isPickedUp())
this->drop(false); // Drops the pickup without creating a PickupSpawner.
+ orxout()<< "end of preDestroy" << endl;
}
/**
@@ -97,10 +98,12 @@
*/
void Pickupable::destroyPickup(void)
{
+ orxout()<< "beginning of actual destroy" << endl;
if(!this->isBeingDestroyed())
this->Destroyable::destroy();
else
orxout(internal_warning, context::pickups) << this->getIdentifier()->getName() << " may be unsafe. " << endl;
+ orxout()<<"end of actual destroy" << endl;
}
/**
More information about the Orxonox-commit
mailing list