From 115082714784c182ab0187c4de13d4980edf6896 Mon Sep 17 00:00:00 2001 From: Mesutcan Kurt Date: Wed, 18 Apr 2012 21:48:04 +0300 Subject: [PATCH] Fix boat builder icon bug (#1694) --- horizons/world/production/producer.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/horizons/world/production/producer.py b/horizons/world/production/producer.py index 9a00da7d096..31d03718d65 100644 --- a/horizons/world/production/producer.py +++ b/horizons/world/production/producer.py @@ -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()] @@ -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()