Ignore:
Timestamp:
12/10/10 19:11:29 (9 years ago)
Author:
technomage
Message:

Patch by Technomage

  • Refactored the DialogueEngine? singleton into the DialogueProcessor? instance factory, eliminating some of the problems the singleton pattern caused with encapsulation and unit testing.
  • Renamed the dialogueengine.py module to dialogueprocessor.py for clarity.
  • Added type-checking code to the instance variables defined by the DialogueProcessor? and Dialogue classes using assert statements that are removed when the optimization '-O' flag is passed to the Python interpreter.
  • Moved the 'main' logic in dialogue_demo.py script into a 'main' method to avoid cluttering the module namespace with runtime variables.
  • Fixed a few code documentation issues pointed out by aspidites.
Location:
trunk/game
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/game

    • Property svn:ignore
      •  

        old new  
        55settings-old.xml 
        66settings.xml 
         7config.py 
  • trunk/game/scripts/dialogue.py

    r680 r684  
    5151        self.npc_name = npc_name 
    5252        self.avatar_path = avatar_path 
    53         self.start_section_id = start_section_id 
    5453        self.sections = OrderedDict() 
    5554        if (dialogue_sections is not None): 
    5655            for section in dialogue_sections: 
    5756                self.sections[section.id] = section 
     57        assert start_section_id in self.sections.keys(), \ 
     58            'start_section_id "{0}" not found in specified sections'\ 
     59            .format(start_section_id) 
     60        self.start_section_id = start_section_id 
    5861     
    5962    def __str__(self): 
     
    128131        @param actions: dialogue actions that should be executed if this 
    129132            response is chosen by the player. 
    130         @type actions: list of L{DialogueActions} 
     133        @type actions: list of L{DialogueActions<DialogueAction>} 
    131134        @param condition: Python expression that when evaluated determines 
    132135            whether the L{DialogueResponse} should be displayed to the player 
Note: See TracChangeset for help on using the changeset viewer.