Ignore:
Timestamp:
07/08/10 18:00:37 (10 years ago)
Author:
beliar
Message:

Patch by Beliar:

  • Quest states are now saved and restored too
  • People met are now restored from saves too (there where saved before but not restored)

Note that old savegames are not working anymore.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/gamestate.py

    r571 r574  
    1616#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>. 
    1717 
    18 from scripts import quest_engine 
     18from scripts.quest_engine import QuestEngine 
    1919 
    2020class GameState(object): 
    2121    """This class holds the current state of the game.""" 
    22     def __init__(self): 
     22    def __init__(self, QuestsDir = None): 
    2323        self.PlayerCharacter = None 
    24         self.quest_engine = None 
     24        self.quest_engine = QuestEngine(QuestsDir) 
     25        self.quest_engine.readQuests() 
    2526        self.objects = {} 
    2627        self.object_ids = {} 
     
    113114        ret_dict = {} 
    114115        ret_dict["CurrentMap"] = self.current_map_name 
     116        ret_dict["Quests"] = self.quest_engine.getStateForSaving() 
    115117        return ret_dict 
    116118 
     
    118120        """Restores the state""" 
    119121        self.current_map_name = state["CurrentMap"] 
     122        self.quest_engine.readQuests() 
     123        self.quest_engine.restoreFromState(state["Quests"]) 
    120124         
Note: See TracChangeset for help on using the changeset viewer.