Ignore:
Timestamp:
07/11/10 13:50:17 (9 years ago)
Author:
beliar
Message:

Patch by Beliar.

  • Changes according to our coding standards
  • Updated pylintrc
File:
1 edited

Legend:

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

    r578 r579  
    1 #!/usr/bin/python 
     1#!/usr/bin/python # pylint: disable-msg=C0111 
    22 
    33#   This file is part of PARPG. 
     
    102102        @param attributes: Dictionary of all object attributes 
    103103        @type attributes: Dictionary 
    104         @return: The created object 
    105         """ 
     104        @return: The created object """ 
    106105        # create the extra data 
    107106        extra = {} 
     
    146145        """Removes an object from the game 
    147146        @param object_id: ID of the object 
    148         @type object_id: str 
    149         """ 
     147        @type object_id: str """ 
    150148        self.game_state.deleteObject(object_id) 
    151149         
     
    169167            for agent in self.agents[map_name]: 
    170168                agent_obj = self.game_state.getObjectById(agent, map_name) 
    171                 agent_inst = self.game_state.maps[map_name].agent_layer.getInstance(agent) 
     169                agent_inst = self.game_state.maps[map_name].\ 
     170                                    agent_layer.getInstance(agent) 
    172171                agent_dict = self.agents[map_name][agent] 
    173172                agent_dict.update(agent_obj.getStateForSaving()) 
     
    181180            agent_obj = None 
    182181            if agent == "PlayerCharacter": 
    183                 agent_obj = self.game_state.PlayerCharacter 
     182                agent_obj = self.game_state.player_character 
    184183            else: 
    185184                agent_obj = self.game_state.getObjectById(agent, map_name) 
    186185            if agent_obj: 
    187                 agent_inst = self.game_state.maps[map_name].agent_layer.getInstance(agent) 
     186                agent_inst = self.game_state.maps[map_name].\ 
     187                                    agent_layer.getInstance(agent) 
    188188                agent_dict.update(agent_obj.getStateForSaving()) 
    189189                agent_dict["Rotation"] = agent_inst.getRotation() 
     
    307307        @type namespace: str 
    308308        @param agent: The agent to be added 
    309         @type agent: dict 
    310         """ 
     309        @type agent: dict """ 
    311310        from local_loaders.loaders import loadImportFile 
    312311        if not self.agents.has_key(namespace): 
     
    326325        """Read the agents of the map 
    327326        @param map_name: Name of the map 
    328         @type map_name: str 
    329         """ 
     327        @type map_name: str """ 
    330328        #Get the agents of the map         
    331329        map_agents_file = self.map_files[map_name].\ 
     
    349347        @param map_name: Name of the map 
    350348        @type map_name: str 
    351         @return: A dictionary with the agents of the map 
    352         """ 
     349        @return: A dictionary with the agents of the map""" 
    353350        if not self.agents.has_key(map_name): 
    354351            return {} 
    355352        ret_dict = self.agents[map_name].copy() 
    356         for agent_name, agent_value in self.agents[self.ALL_AGENTS_KEY].iteritems(): 
     353        for agent_name, agent_value in self.agents[self.ALL_AGENTS_KEY]\ 
     354                                                .iteritems(): 
    357355            if agent_value["Map"] == map_name: 
    358356                ret_dict[agent_name] = agent_value 
     
    361359    def getAgentsOfActiveMap(self): 
    362360        """Returns the agents that are on active map 
    363         @return: A dictionary with the agents of the map 
    364         """ 
     361        @return: A dictionary with the agents of the map """ 
    365362        return self.getAgentsOfMap(self.active_map.map.getId()) 
    366363 
     
    472469     
    473470    def placeAgents(self): 
    474         """Places the current maps agents 
    475         """ 
     471        """Places the current maps agents """ 
    476472        if not self.active_map: 
    477473            return 
     
    492488        # create the PlayerCharacter agent 
    493489        self.active_map.addPC() 
    494         self.game_state.PlayerCharacter.start() 
     490        self.game_state.player_character.start() 
    495491        if agent.has_key("PeopleKnown"): 
    496             self.game_state.PlayerCharacter.peopleIknow = agent["PeopleKnown"] 
     492            self.game_state.player_character.peopleIknow = agent["PeopleKnown"] 
    497493                       
    498494    def changeMap(self, map_name, target_position = None): 
     
    568564        # in the future we will need to copy 
    569565        # PlayerCharacter specifics between the different PlayerCharacter's 
    570         self.game_state.PlayerCharacter = player_char 
    571         self.game_state.PlayerCharacter.setup()         
     566        self.game_state.player_character = player_char 
     567        self.game_state.player_character.setup()         
    572568 
    573569    def addObject(self, layer, obj, instance): 
     
    607603           @rtype: boolean 
    608604           @return: Status of result (True/False)""" 
    609         for i in \ 
     605        for game_object in \ 
    610606           self.game_state.getObjectsFromMap(self.game_state.current_map_name): 
    611             if (i.ID == ident): 
     607            if (game_object.ID == ident): 
    612608                # we found a match 
    613                 return i 
     609                return game_object 
    614610        # no match 
    615611        return False     
     
    621617           @return: None""" 
    622618        if(self.pc_run == 1): 
    623             self.game_state.PlayerCharacter.run(position) 
     619            self.game_state.player_character.run(position) 
    624620        else: 
    625             self.game_state.PlayerCharacter.walk(position) 
     621            self.game_state.player_character.walk(position) 
    626622         
    627623    def teleportAgent(self, agent, position): 
     
    634630 
    635631    def readObjectDB(self): 
    636         """Reads the Object Information Database from a file. 
    637         """ 
     632        """Reads the Object Information Database from a file. """ 
    638633        database_file = file(self.object_db_file, "r") 
    639634        database = yaml.load_all(database_file) 
     
    642637 
    643638    def getAgentImportFiles(self): 
    644         """Searches the agents directory for import files 
    645         """ 
     639        """Searches the agents directory for import files """ 
    646640        files = locateFiles("*.xml", self.agents_directory) 
    647641        for xml_file in files: 
     
    652646     
    653647    def getDialogues(self): 
    654         """Searches the dialogue directory for dialogues 
    655         """ 
     648        """Searches the dialogue directory for dialogues """ 
    656649        files = locateFiles("*.yaml", self.dialogues_directory) 
    657650        for dialogue_file in files: 
Note: See TracChangeset for help on using the changeset viewer.