diff --git a/horizons/ai/aiplayer/goal/improvecollectorcoverage.py b/horizons/ai/aiplayer/goal/improvecollectorcoverage.py index f011f4a0c08..bb9750463d7 100644 --- a/horizons/ai/aiplayer/goal/improvecollectorcoverage.py +++ b/horizons/ai/aiplayer/goal/improvecollectorcoverage.py @@ -51,7 +51,7 @@ def _get_problematic_collector_coverage_buildings(self): amount_paused = history[PRODUCTION.STATES.inventory_full.index] + history[PRODUCTION.STATES.paused.index] if amount_paused < self.personality.min_bad_collector_coverage: continue - for resource_id in production.get_produced_res(): + for resource_id in production.get_produced_resources(): if self.settlement.get_component(StorageComponent).inventory.get_free_space_for(resource_id) > self.personality.min_free_space: # this is actually problematic problematic_buildings[building.worldid] = building diff --git a/horizons/ai/aiplayer/productionbuilder.py b/horizons/ai/aiplayer/productionbuilder.py index 789228511b6..667d05ff21d 100644 --- a/horizons/ai/aiplayer/productionbuilder.py +++ b/horizons/ai/aiplayer/productionbuilder.py @@ -483,12 +483,12 @@ def manage_production(self): for building in self.production_buildings: producer = building.get_component(Producer) for production in producer.get_productions(): - if not production.get_produced_res(): + if not production.get_produced_resources(): continue all_full = True # inventory full of the produced resources? - for resource_id, min_amount in production.get_produced_res().iteritems(): + for resource_id, min_amount in production.get_produced_resources().iteritems(): if production.inventory.get_free_space_for(resource_id) >= min_amount: all_full = False break diff --git a/horizons/gui/tabs/productiontabs.py b/horizons/gui/tabs/productiontabs.py index 23f486268ca..53517654114 100644 --- a/horizons/gui/tabs/productiontabs.py +++ b/horizons/gui/tabs/productiontabs.py @@ -124,7 +124,7 @@ def refresh(self): # fix pychans lack of dynamic container sizing # the container in the xml must provide a height attribute, that is valid for # one resource. - max_res_in_one_line = max(len(production.get_produced_res()), \ + max_res_in_one_line = max(len(production.get_produced_resources()), \ len(production.get_consumed_resources())) container.height = max_res_in_one_line * container.height diff --git a/horizons/world/playerstats.py b/horizons/world/playerstats.py index 8d746877913..333a13a6d73 100644 --- a/horizons/world/playerstats.py +++ b/horizons/world/playerstats.py @@ -62,9 +62,9 @@ def _collect_info(self): settler_buildings[building.level] += 1 for production in building.get_component(Producer).get_productions(): if production.get_state() is PRODUCTION.STATES.producing: - produced_res = production.get_produced_res() - if RES.HAPPINESS in produced_res: - happiness = produced_res[RES.HAPPINESS] + produced_resources = production.get_produced_resources() + if RES.HAPPINESS in produced_resources: + happiness = produced_resources[RES.HAPPINESS] for resource_id in production.get_consumed_resources(): settler_resources_provided[resource_id] += happiness / production.get_production_time() diff --git a/horizons/world/production/producer.py b/horizons/world/production/producer.py index ce89cd98db9..9a00da7d096 100644 --- a/horizons/world/production/producer.py +++ b/horizons/world/production/producer.py @@ -200,8 +200,8 @@ def add_production(self, production): def _production_finished(self, production): """Gets called when a production finishes. Intercepts call, adds info and forwards it""" - produced_res = production.get_produced_res() - self.on_production_finished(produced_res) + produced_resources = production.get_produced_resources() + self.on_production_finished(produced_resources) def finish_production_now(self): """Cheat, makes current production finish right now (and produce the resources). diff --git a/horizons/world/production/production.py b/horizons/world/production/production.py index 70697cf33c2..99502102bad 100644 --- a/horizons/world/production/production.py +++ b/horizons/world/production/production.py @@ -21,7 +21,6 @@ # ################################################### import logging -import copy from collections import defaultdict, deque @@ -158,7 +157,7 @@ def get_consumed_resources(self): """Res that are consumed here. Returns dict {res:amount}. Interface for _prod_line.""" return self._prod_line.consumed_res - def get_produced_res(self): + def get_produced_resources(self): """Res that are produced here. Returns dict {res:amount}. Interface for _prod_line.""" return self._prod_line.produced_res diff --git a/horizons/world/resourcehandler.py b/horizons/world/resourcehandler.py index e39c2ec72e8..6a03d5435ac 100644 --- a/horizons/world/resourcehandler.py +++ b/horizons/world/resourcehandler.py @@ -76,12 +76,12 @@ def get_consumed_resources(self): def get_produced_resources(self): """Returns the resources, that are produced by productions, that are currently active""" - produced_res = set() + produced_resources = set() if self.has_component(Producer): prod_comp = self.get_component(Producer) for production in prod_comp._productions.itervalues(): - produced_res.update(production.get_produced_res().iterkeys()) - return list(produced_res) + produced_resources.update(production.get_produced_resources().iterkeys()) + return list(produced_resources) def get_stocked_provided_resources(self): """Returns provided resources, where at least 1 ton is available""" @@ -160,15 +160,15 @@ def _load_provided_resources(self): """Returns a iterable obj containing all resources this building provides. This is outsourced from initiation to a method for the possiblity of overwriting it. Do not alter the returned list; if you need to do so, then copy it.""" - produced_res = set() + produced_resources = set() for prod in self.get_component(Producer).get_productions(): - for res in prod.get_produced_res(): - produced_res.add(res) + for res in prod.get_produced_resources(): + produced_resources.add(res) for res in self.additional_provided_resources: - produced_res.add(res) + produced_resources.add(res) - return produced_res + return produced_resources def transfer_to_storageholder(self, amount, res_id, transfer_to): """Transfers amount of res_id to transfer_to.