changeset 59:535801aec63e

DialogueGUI now acceps met_fnc and meet_fnc in its constructor and stores them in its game_state as "met" and "meet" respectively.
author KarstenBock@gmx.net
date Fri, 09 Sep 2011 16:12:46 +0200
parents d4f213b99d41
children e2004c9549d7
files dialogueactions.py gui/dialoguegui.py gui/hud.py
diffstat 3 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/dialogueactions.py	Fri Sep 09 15:47:43 2011 +0200
+++ b/dialogueactions.py	Fri Sep 09 16:12:46 2011 +0200
@@ -107,7 +107,7 @@
         #     verbose, so I'm logging it as an INFO message instead.
 #        print("You've met {0}!".format(npc_id))
         self.logger.info("You've met {0}!".format(npc_id))
-        game_state['pc'].meet(npc_id)
+        game_state['meet'](npc_id)
 DialogueAction.registerAction(MeetAction)
 
 
--- a/gui/dialoguegui.py	Fri Sep 09 15:47:43 2011 +0200
+++ b/gui/dialoguegui.py	Fri Sep 09 16:12:46 2011 +0200
@@ -27,7 +27,7 @@
     """Window that handles the dialogues."""
     _logger = logging.getLogger('dialoguegui.DialogueGUI')
     
-    def __init__(self, controller, npc, quest_engine, player_character):
+    def __init__(self, controller, npc, quest_engine, met_fnc, meet_fnc, player_character):
         self.active = False
         self.controller = controller
         xml_file = vfs.VFS.open('gui/dialogue.xml')
@@ -38,6 +38,8 @@
         #     handling.
         self.quest_engine = quest_engine
         self.player_character = player_character
+        self.met_fnc = met_fnc
+        self.meet_fnc = meet_fnc
     
     def initiateDialogue(self):
         """Callback for starting a quest"""
@@ -53,7 +55,7 @@
         self.setAvatarImage(self.npc.dialogue.dialogue.avatar_path)
         
         game_state = {'npc': self.npc, 'pc': self.player_character,
-                      'quest': self.quest_engine}
+                      'quest': self.quest_engine, 'met': self.met_fnc, 'meet': self.meet_fnc}
         try:
             self.dialogue_processor = DialogueProcessor(self.npc.dialogue.dialogue,
                                                         game_state)
--- a/gui/hud.py	Fri Sep 09 15:47:43 2011 +0200
+++ b/gui/hud.py	Fri Sep 09 16:12:46 2011 +0200
@@ -508,5 +508,6 @@
                     self.controller,
                     npc,
                     self.model.game_state.quest_engine,
-                    self.model.game_state.getObjectById("PlayerCharacter").fifeagent)
+                    self.model.game_state.met, self.model.game_state.meet,
+                    self.model.game_state.getObjectById("PlayerCharacter"))
         return dialogue