Mercurial > parpg-source
comparison gamemodel.py @ 170:0296f5f74a0f
Fixed saving and loading that broke with changing of the settings module.
author | Beliar <KarstenBock@gmx.net> |
---|---|
date | Sat, 25 Feb 2012 22:05:39 +0100 |
parents | b3b82c2aebee |
children | ab6a0fd1668a |
comparison
equal
deleted
inserted
replaced
169:5b880b8cff6d | 170:0296f5f74a0f |
---|---|
211 def load(self, path, filename): | 211 def load(self, path, filename): |
212 """Loads a saver from a file. | 212 """Loads a saver from a file. |
213 @type filename: string | 213 @type filename: string |
214 @param filename: the name of the file (including path) to load from | 214 @param filename: the name of the file (including path) to load from |
215 @return: None""" | 215 @return: None""" |
216 fname = '/'.join([path, filename]) | 216 fname = os.path.join(path, filename) |
217 | 217 |
218 try: | 218 try: |
219 load_file = open(fname, 'r') | 219 load_file = open(fname, 'r') |
220 except(IOError): | 220 except(IOError): |
221 sys.stderr.write("Error: Can't find save game file\n") | 221 sys.stderr.write("Error: Can't find save game file '" + fname + "'\n") |
222 return | 222 return |
223 self.deleteMaps() | 223 self.deleteMaps() |
224 self.clearAgents() | 224 self.clearAgents() |
225 | 225 |
226 save_state = yaml.load(load_file) | 226 save_state = yaml.load(load_file) |