Skip to content

Commit

Permalink
Fix boat builder icon bug (unknown-horizons#1694)
Browse files Browse the repository at this point in the history
  • Loading branch information
mesutcank committed Apr 18, 2012
1 parent 43ffdc5 commit 1150827
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion horizons/world/production/producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ def remove_production(self, production):
production.remove() # production "destructor"
if self.is_active(production):
del self._productions[production.get_production_line_id()]
# update decommissioned icon after removing production
self._update_decommissioned_icon()

self.instance._changed()
self.on_activity_changed(self.is_active())

else:
del self._inactive_productions[production.get_production_line_id()]

Expand All @@ -240,10 +246,12 @@ def alter_production_time(self, modifier, prod_line_id=None):
self._get_production(prod_line_id).alter_production_time(modifier)

def remove(self):
super(Producer, self).remove()
Scheduler().rem_all_classinst_calls(self)
for production in self.get_productions():
self.remove_production(production)
# call super() after removing all productions since it removes the instance (make it invalid)
# which can be needed by changelisteners' actions (e.g. in remove_production method)
super(Producer, self).remove()
assert len(self.get_productions()) == 0 , 'Failed to remove %s ' % self.get_productions()


Expand Down

0 comments on commit 1150827

Please sign in to comment.