changeset 186:8cc26e89398c

Moved code from CharacterCreationController to GameModel
author KarstenBock@gmx.net
date Sat, 05 Nov 2011 14:53:12 +0100
parents 756ce052ac85
children f612b4638744
files src/parpg/charactercreationcontroller.py src/parpg/gamemodel.py
diffstat 2 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/parpg/charactercreationcontroller.py	Sat Nov 05 14:42:12 2011 +0100
+++ b/src/parpg/charactercreationcontroller.py	Sat Nov 05 14:53:12 2011 +0100
@@ -17,7 +17,6 @@
 
 from parpg import vfs
 import characterstatistics as char_stats
-from serializers import XmlSerializer
 from controllerbase import ControllerBase
 from gamescenecontroller import GameSceneController
 from gamesceneview import GameSceneView
@@ -87,16 +86,6 @@
         self.view.cancel_new_game_callback = self.cancelNewGame
 
     def reset_character(self):
-        # FIXME M. George Hansen 2011-06-06: character stats scripts aren't
-        #     finished, unfortunately.
-        #primary_stats_file = \
-        #    vfs.VFS.open('character_scripts/primary_stats.xml')
-        #primary_stats = XmlSerializer.deserialize(primary_stats_file)
-        #secondary_stats_file = \
-        #    vfs.VFS.open('character_scripts/secondary_stats.xml')
-        #secondary_stats = XmlSerializer.deserialize(secondary_stats_file)        
-        primary_stats = []
-        secondary_stats = []
         inventory = []
         for x in xrange(self.INV_SLOTS):
             inventory.append(None)
@@ -109,14 +98,14 @@
         self.char_data.characterstats.picture = (
             self.PICTURES[self.GENDERS[0]][0]
         )
-        for primary_stat in primary_stats:
+        for primary_stat in self.model.primary_stats:
             long_name = primary_stat.long_name
             self.char_data.characterstats.primary_stats[long_name] = (
                 char_stats.PrimaryStatisticValue(
                     primary_stat, self.char_data.characterstats, 
                     DEFAULT_STAT_VALUE)
             )
-        for secondary_stat in secondary_stats:
+        for secondary_stat in self.model.secondary_stats:
             name = secondary_stat.name            
             self.char_data.characterstats.secondary_stats[name] = (
                 char_stats.SecondaryStatisticValue(secondary_stat, 
--- a/src/parpg/gamemodel.py	Sat Nov 05 14:42:12 2011 +0100
+++ b/src/parpg/gamemodel.py	Sat Nov 05 14:53:12 2011 +0100
@@ -22,6 +22,7 @@
 from fife import fife
 from fife.extensions.serializers.xmlobject import XMLObjectLoader 
 from parpg.bGrease.geometry import Vec2d
+from serializers import XmlSerializer
 
 from parpg import vfs
 from gamestate import GameState
@@ -95,7 +96,17 @@
         self.dialogues = {}
         self.agent_import_files = {}
         self.obj_loader = XMLObjectLoader(self.engine)
-
+        # FIXME M. George Hansen 2011-06-06: character stats scripts aren't
+        #     finished, unfortunately.
+        #primary_stats_file = \
+        #    vfs.VFS.open('character_scripts/primary_stats.xml')
+        #self.primary_stats = XmlSerializer.deserialize(primary_stats_file)
+        #secondary_stats_file = \
+        #    vfs.VFS.open('character_scripts/secondary_stats.xml')
+        #self.secondary_stats = XmlSerializer.deserialize(secondary_stats_file)        
+        self.primary_stats = []
+        self.secondary_stats = []
+        
     def checkAttributes(self, attributes, template):
         """Checks for attributes that where not given in the map file
         and fills them with values from the object database