Skip to content

Commit

Permalink
Add necessary resources tooltip to build menu
Browse files Browse the repository at this point in the history
  • Loading branch information
cristi authored and cristi committed Feb 20, 2013
1 parent 75a3a62 commit 6fbfe95
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions horizons/gui/tabs/buildtabs.py
Expand Up @@ -139,6 +139,14 @@ def _set_entry(button, icon, building_id):
building = Entities.buildings[building_id]
button.helptext = self.session.db.get_building_tooltip(building_id)

# Add necessary resources to tooltip
# [br] means newline
button.helptext += '[br]Resources needed:[br]'
for resource_id, amount_needed in sorted(building.costs.items()):
resource_name = self.session.db.get_res_name(resource_id)
button.helptext += u'[br]'
button.helptext += _('{resource}: {amount}').format(resource=resource_name, amount = amount_needed)

enough_res = False # don't show building by default
if settlement is not None: # settlement is None when the mouse has left the settlement
res_overview = self.session.ingame_gui.resource_overview
Expand Down

0 comments on commit 6fbfe95

Please sign in to comment.