Changeset 668 for trunk/game/scripts/gamemodel.py
- Timestamp:
- 11/17/10 21:44:05 (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 4 4 .settings 5 5 Thumbs.db 6 7 .externalToolBuilders 8 9 .cproject
-
- Property svn:ignore
-
trunk/game/scripts/gamemodel.py
r667 r668 19 19 import sys 20 20 import os.path 21 import logging 21 22 from copy import deepcopy 22 23 … … 31 32 from common.utils import parseBool 32 33 from inventory import Inventory 34 from scripts.dialogueparser import YamlDialogueParser, DialogueFormatError 33 35 34 36 try: … … 732 734 """Searches the dialogue directory for dialogues """ 733 735 files = locateFiles("*.yaml", self.dialogues_directory) 734 for dialogue_file in files: 735 dialogue_file = os.path.relpath(dialogue_file).replace("\\", "/") 736 dialogues = yaml.load_all(file(dialogue_file, "r")) 737 for dialogue in dialogues: 738 self.dialogues[dialogue["NPC"]] = dialogue 736 dialogue_parser = YamlDialogueParser() 737 for dialogue_filepath in files: 738 dialogue_filepath = os.path.relpath(dialogue_filepath) \ 739 .replace("\\", "/") 740 # Note Technomage 2010-11-13: the new DialogueEngine uses its own 741 # parser now, YamlDialogueParser. 742 # dialogues = yaml.load_all(file(dialogue_file, "r")) 743 with file(dialogue_filepath, 'r') as dialogue_file: 744 try: 745 dialogue = dialogue_parser.load(dialogue_file) 746 except DialogueFormatError as error: 747 logging.error('unable to load dialogue file {0}: {1}' 748 .format(dialogue_filepath, error)) 749 else: 750 self.dialogues[dialogue.npc_name] = dialogue 751 # Note Technomage 2010-11-13: the below code is used to load 752 # multiple dialogues from a single file. Is this functionality 753 # used/necessary? 754 # for dialogue in dialogues: 755 # self.dialogues[dialogue["NPC"]] = dialogue
Note: See TracChangeset
for help on using the changeset viewer.