diff gamelib/level.py @ 412:1e24eedbf40f

Implement non-gui parts of level loading communication
author Neil Muller <drnlmuller@gmail.com>
date Sat, 21 Nov 2009 11:34:12 +0000
parents e83ec14163f2
children a356e57529ea
line wrap: on
line diff
--- a/gamelib/level.py	Sat Nov 21 11:18:08 2009 +0000
+++ b/gamelib/level.py	Sat Nov 21 11:34:12 2009 +0000
@@ -10,15 +10,15 @@
     """Container for level details"""
 
     def __init__(self, level_name):
-        level_info = None
+        self.level_file = None
         default_map = '%s.tga' % level_name
         for poss_file in ['levels/%s.conf' % level_name, '%s.conf' % level_name,
                 'levels/%s' % level_name, level_name]:
             cand = data.filepath(poss_file)
             if os.path.exists(cand):
-                level_info = cand
+                self.level_file = cand
                 break
-        if not level_info:
+        if not self.level_file:
             raise RuntimeError('Unable to load %s' % level_name)
         # Load the level info file
         # setup defaults
@@ -38,7 +38,7 @@
         for animal, prob in DEFAULT_FOX_WEIGHTINGS:
             defaults[animal.CONFIG_NAME] = prob
         config = RawConfigParser(defaults)
-        config.read(level_info)
+        config.read(self.level_file)
         # NB. This assumes the level file is correctly formatted. No provision
         # is made for missing sections or incorrectly specified values.
         # i.e. Things may blow up