Changeset 555:b83ca72063ea


Ignore:
Timestamp:
04/09/11 23:54:58 (12 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Phase:
public
Rebase:
62353239663166363164666231343438353837343131636562396138643336386637383432356461
Message:

Fix bug where one NPC's dialogue could close anothers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/levelscene.py

    r553 r555  
    162162        self._dialogue = NotificationWidget(text)
    163163
    164     def _close_dialogue(self):
    165         if self._dialogue is not None:
     164    def _close_dialogue(self, npc):
     165        if isinstance(npc, basestring):
     166            npc = self._npcs[npc]
     167        # below works for notifications too since they don't have .npc and send None
     168        if self._dialogue is not None and getattr(self._dialogue, 'npc', None) is npc:
    166169            self._world.thaw()
    167170            self._dialogue.close()
     
    367370            self._open_notification(ev.text)
    368371        elif engine.CloseDialog.matches(ev):
    369             self._close_dialogue()
     372            self._close_dialogue(ev.npc)
    370373        elif engine.AddSpriteEvent.matches(ev):
    371374            self._world.add(ev.item)
Note: See TracChangeset for help on using the changeset viewer.