Ignore:
Timestamp:
10/10/09 21:45:49 (10 years ago)
Author:
Kaydeth_parpg
Message:

Ticket #2: Patch by Kaydeth. Updated the rest of the classes in the scripts directory to correct some obvious discrepancies with our coding standard. Still need to go through the common and objects sub directories. comment[s:trac, t:2]

File:
1 edited

Legend:

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

    r312 r313  
    2121from gamestate import GameState 
    2222from objects import * 
    23 from objectLoader import ObjectXMLParser 
    2423from objects.action import * 
    2524 
     
    8281        """Loads a saver from a file. 
    8382           @type path: string  
    84            @param path: the path where the savefile is located 
     83           @param path: the path where the save file is located 
    8584           @type filename: string 
    8685           @param filename: the name of the file to load from 
     
    9493        self.game_state = pickle.load(f) 
    9594        f.close() 
    96         if self.game_state.currentMap: 
    97             self.loadMap(self.game_state.currentMapName, \ 
    98                          self.game_state.currentMap)  
     95        if self.game_state.current_map: 
     96            self.loadMap(self.game_state.current_map_name, \ 
     97                         self.game_state.current_map)  
    9998 
    10099    def createObject (self, layer, attributes, instance): 
     
    133132        """ 
    134133        # add to view data  
    135         self.view.activeMap.addObject(pc.ID, instance)           
     134        self.view.active_map.addObject(pc.ID, instance)           
    136135         
    137136        # sync with game data 
     
    156155        if ref is None: 
    157156            # no, add it to the game state 
    158             obj.map_id = self.game_state.currentMap 
     157            obj.map_id = self.game_state.current_map 
    159158            self.game_state.objects[obj.ID] = obj 
    160159        else: 
     
    165164             
    166165        # add it to the view 
    167         self.view.activeMap.addObject(obj.ID, instance)           
     166        self.view.active_map.addObject(obj.ID, instance)           
    168167 
    169168        if obj.trueAttr("NPC"): 
     
    181180           @rtype: boolean 
    182181           @return: Status of result (True/False)""" 
    183         for i in self.game_state.getObjectsFromMap(self.game_state.currentMap): 
     182        for i in self.game_state.getObjectsFromMap(self.game_state.current_map): 
    184183            if (i.ID == ident): 
    185184                # we found a match 
     
    248247           @param map_file: Filename of map file to load 
    249248           @return: None""" 
    250         self.game_state.currentMap = map_file 
    251         self.game_state.currentMapName= map_name 
     249        self.game_state.current_map = map_file 
     250        self.game_state.current_map_name= map_name 
    252251        self.view.loadMap(map_name, str(map_file)) 
    253252        self.view.setActiveMap(map_name) 
     
    256255 
    257256        # create the PC agent 
    258         self.view.activeMap.addPC(self.game_state.PC.behaviour.agent) 
     257        self.view.active_map.addPC(self.game_state.PC.behaviour.agent) 
    259258        self.game_state.PC.start() 
    260259 
     
    270269            self.game_state.PC.walk(position) 
    271270 
    272     def changeMap(self, mapName, mapFile, target_position): 
     271    def changeMap(self, map_name, mapFile, target_position): 
    273272        """Registers for a map change on the next pump(). 
    274273           @type nameName: String 
    275            @param mapName: Id of the map to teleport to 
     274           @param map_name: Id of the map to teleport to 
    276275           @type mapFile: String 
    277276           @param mapFile: Filename of the map to teleport to 
     
    280279           @return None""" 
    281280        # set the parameters for the map change if moving to a new map 
    282         print self.game_state.currentMapName 
    283         if mapName != self.game_state.currentMapName: 
    284             self.game_state.currentMapName = mapName 
    285             self.game_state.currentMap = mapFile 
     281        print self.game_state.current_map_name 
     282        if map_name != self.game_state.current_map_name: 
     283            self.game_state.current_map_name = map_name 
     284            self.game_state.current_map = mapFile 
    286285            self.target_position = target_position 
    287286            # issue the map change 
     
    293292    def handleCommands(self): 
    294293        if self.map_change: 
    295             self.loadMap(self.game_state.currentMapName, \ 
    296                          self.game_state.currentMap) 
     294            self.loadMap(self.game_state.current_map_name, \ 
     295                         self.game_state.current_map) 
    297296            self.view.teleport(self.target_position) 
    298297            self.map_change = False 
Note: See TracChangeset for help on using the changeset viewer.