[Orxonox-commit 4626] r9297 - in code/branches/presentation2012merge: data/gui/scripts src/modules/pickup

landauf at orxonox.net landauf at orxonox.net
Thu Jun 14 23:10:07 CEST 2012


Author: landauf
Date: 2012-06-14 23:10:06 +0200 (Thu, 14 Jun 2012)
New Revision: 9297

Modified:
   code/branches/presentation2012merge/data/gui/scripts/PickupInventory.lua
   code/branches/presentation2012merge/src/modules/pickup/PickupCollectionIdentifier.cc
Log:
- fixed crash on closing pickup inventory. happened if pickup inventory and detail window were closed with ESC which didn't clean up the detail window properly. the next time the pickup inventory was opened and closed, the game crashed.
- cleaned up a detail in PickupCollectionIdentifier

Modified: code/branches/presentation2012merge/data/gui/scripts/PickupInventory.lua
===================================================================
--- code/branches/presentation2012merge/data/gui/scripts/PickupInventory.lua	2012-06-12 21:47:59 UTC (rev 9296)
+++ code/branches/presentation2012merge/data/gui/scripts/PickupInventory.lua	2012-06-14 21:10:06 UTC (rev 9297)
@@ -175,7 +175,7 @@
     end
     for k,v in pairs(P.detailsWindows) do
         if v ~= nil then
-            winMgr:destroyWindow(v)
+            P.destroyDetailWindow(k)
         end
     end
 end
@@ -322,6 +322,10 @@
     local match = string.gmatch(name, "%d+")
     local detailNr = tonumber(match())
     
+    P.destroyDetailWindow(detailNr)
+end
+
+function P.destroyDetailWindow(detailNr)
     local window = P.detailsWindows[detailNr]
     winMgr:destroyWindow(window)
     P.detailsWindows[detailNr] = nil

Modified: code/branches/presentation2012merge/src/modules/pickup/PickupCollectionIdentifier.cc
===================================================================
--- code/branches/presentation2012merge/src/modules/pickup/PickupCollectionIdentifier.cc	2012-06-12 21:47:59 UTC (rev 9296)
+++ code/branches/presentation2012merge/src/modules/pickup/PickupCollectionIdentifier.cc	2012-06-14 21:10:06 UTC (rev 9297)
@@ -71,9 +71,7 @@
     {
         assert(identifier);
 
-        // Slight un-niceity to cast the const PickupIdentifier to a const PickupCollectionIdentifier, but since we cast to a const, there is no harm done.
-        PickupIdentifier* temp = const_cast<PickupIdentifier*>(identifier);
-        const PickupCollectionIdentifier* collectionIdentifier = orxonox_cast<PickupCollectionIdentifier*>(temp);
+        const PickupCollectionIdentifier* collectionIdentifier = orxonox_cast<const PickupCollectionIdentifier*>(identifier);
 
         // If the input PickupIdentifier 'identifier' is no PickupCollectionIdentifier then just the two PickupIdentifiers are compared.
         if(collectionIdentifier == NULL)




More information about the Orxonox-commit mailing list