Changeset 445


Ignore:
Timestamp:
12/13/09 15:29:54 (10 years ago)
Author:
eliedebrauwer
Message:

Ticket #239: Patch by eliedebrauwer. The readyAccess buttons are now triggered each time the PC is added to the map. Unfortunately I do not think that loading a game will work, since hte contents of the inventorygui is not properly refreshed, but we can't test this, since load/save is broken. (Also added a fix where dumping the inventory object fails). fixes[s:trac, t:239]

Location:
trunk/game/scripts
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/engine.py

    r395 r445  
    166166        self.game_state.PC = pc 
    167167        self.game_state.PC.setup() 
     168         
     169        # The PC has an inventory, and also some filling of the ready slots  
     170        # in the HUD. At this point we sync the contents of the ready slots  
     171        # with the contents of the inventory. 
     172        self.view.hud.initializeInventory() 
    168173 
    169174    def addObject(self, layer, obj, instance): 
  • trunk/game/scripts/gui/hud.py

    r444 r445  
    137137        } 
    138138        self.inventory_storage = self.data.game_state.PC.inventory 
    139         self.inventory = inventorygui.InventoryGUI(self.engine, 
    140                                             self.inventory_storage, 
    141                                             inv_callbacks) 
     139        if self.inventory == None: 
     140            self.inventory = inventorygui.InventoryGUI(self.engine, 
     141                                                       self.inventory_storage, 
     142                                                       inv_callbacks) 
    142143        self.refreshReadyImages() 
    143144         
     
    396397 
    397398    def toggleInventory(self, toggleImage=True): 
    398         """Display's the inventory screen 
     399        """Displays the inventory screen 
    399400           @return: None""" 
    400401        if self.inventory == None: 
  • trunk/game/scripts/inventory.py

    r440 r445  
    118118 
    119119    def __repr__(self): 
    120         return "[%s:%s "%(self.name, self.ID)+reduce((lambda a,b: str(a) +', '+str(b)), self.items.values())+" ]" 
     120        return "[Inventory contents: " +reduce((lambda a,b: str(a) +', '+str(b)), self.items.values())+" ]" 
Note: See TracChangeset for help on using the changeset viewer.