Fix for #324 - do not reset itemID automatically upon removal due to way modules are swapped.

This commit is contained in:
blitzmann
2015-07-09 18:36:11 -04:00
parent 221a3fde14
commit 4c17f38b1a

View File

@@ -109,7 +109,8 @@ class HandledList(list):
# We must flag it as modified, otherwise it not be removed from the database
# @todo: flag_modified isn't in os x skel. need to rebuild to include
#flag_modified(thing, "itemID")
thing.itemID = 0
if thing.isInvalid: # see GH issue #324
thing.itemID = 0
list.remove(self, thing)
class HandledModuleList(HandledList):
@@ -191,6 +192,7 @@ class HandledImplantBoosterList(HandledList):
oldObj = next((m for m in self if m.slot == thing.slot), None)
if oldObj:
logging.info("Slot %d occupied with %s, replacing with %s", thing.slot, oldObj.item.name, thing.item.name)
oldObj.itemID = 0 # hack to remove from DB. See GH issue #324
self.remove(oldObj)
HandledList.append(self, thing)