Ignore:
Timestamp:
07/30/10 19:47:08 (9 years ago)
Author:
beliar
Message:

Patch by Domtron_Vox.

  • Items from the inventory can now be switched with items in containers too when dropped on top of them.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/gui/containergui.py

    r605 r606  
    8989           @return: None""" 
    9090        drop_widget = self.gui.findChild(name = obj) 
    91         if drop_widget != data_drag.dragged_widget: 
    92             self.container.placeItem(data_drag.dragged_item, drop_widget.index) 
    93         drop_widget.item = data_drag.dragged_item 
     91        drop_index = drop_widget.index 
     92        replace_item = drop_widget.item 
     93 
     94        if data_drag.dragging: 
     95            container = self.container 
     96            drag_item = data_drag.dragged_item 
     97            #this will get the replacement item and the data for drag_drop if 
     98            ## there is an item all ready occupying the slot 
     99            if replace_item != None: 
     100                self.dragObject(obj) 
     101                 
     102            container.placeItem(drag_item, drop_index) 
     103             
     104        drop_widget.item = drag_item 
    94105        self.updateImage(drop_widget) 
    95         data_drag.dragging = False 
    96         #reset the mouse cursor to the normal cursor 
    97         self.controller.resetMouseCursor() 
     106        #if there was no item the stop dragging and reset cursor 
     107        if replace_item == None: 
     108            data_drag.dragging = False 
     109            #reset the mouse cursor to the normal cursor 
     110            self.controller.resetMouseCursor() 
    98111         
    99112    def showContainer(self): 
Note: See TracChangeset for help on using the changeset viewer.