Changeset 132


Ignore:
Timestamp:
06/13/09 12:37:00 (10 years ago)
Author:
maximinus_parpg
Message:

Fixed map loading bug, where it crashed sometimes.

Location:
trunk/PARPG/scripts
Files:
2 edited

Legend:

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

    r130 r132  
    6464        self.npcs = [] 
    6565        self.objects = [] 
     66        self.doors = [] 
    6667        self.tele_tiles = [] 
    6768 
     
    9091        self.addTeleTiles(cur_handler.tele_tiles) 
    9192        self.addDoors(cur_handler.doors) 
     93        objects_file.close() 
    9294        return True 
    9395 
     
    163165                # load the new map 
    164166                self.loadMap(str(i.map)) 
     167                return None 
    165168        # is it in our objects? 
    166169        for i in self.objects: 
     
    182185        self.view.load(map_file) 
    183186        # then we update FIFE with the PC, NPC and object details 
    184         self.reset() 
     187        self.reset()         
    185188        self.loadObjects(map_file[:-4]+"_objects.xml") 
    186189 
  • trunk/PARPG/scripts/world.py

    r131 r132  
    8181        # TODO: I'm killing the PC now, but later we will have to save the PC 
    8282        if self.map: 
     83             
     84            print "number=",self.model.getNamespaces() 
     85             
     86            self.model.deleteObjects() 
    8387            self.model.deleteMap(self.map) 
    8488        self.transitions = [] 
    85         """ self.PC and self.npcs are never used, and can be accessed through 
    86             the self.data object...commented out for the time being 
    87             Also, why are there duplicated lines?""" 
    88         #self.PC = None 
    89         #self.npcs = [] 
    9089        self.map,self.agent_layer = None,None 
    9190        # We have to clear the cameras in the view as well, or we can't reuse 
     
    9392        self.view.clearCameras() 
    9493        self.cameras = {} 
    95         #self.PC = None 
    96         #self.npcs = [] 
    9794        self.cur_cam2_x,self.initial_cam2_x,self.cam2_scrolling_right = 0,0,True 
    9895        self.target_rotation = 0 
     
    235232 
    236233    def mousePressed(self, evt): 
    237         """If a mouse button is pressed down, fife cals this routine 
     234        """If a mouse button is pressed down, fife calls this routine 
    238235           Currently we assume this is on the map""" 
    239236        click = fife.ScreenPoint(evt.getX(), evt.getY()) 
    240237        if(evt.getButton() == fife.MouseEvent.LEFT): 
    241238            self.data.handleMouseClick(self.getCoords(click)) 
    242             if (hasattr(self, "context_menu")): 
     239            if(hasattr(self, "context_menu")): 
    243240                self.context_menu.vbox.hide() 
    244241                delattr(self, "context_menu") 
     
    253250                        # yes, get the data 
    254251                        info = self.data.getItemActions(obj.getId()) 
    255                         print info 
     252                        if(info == None): 
     253                            # there was a map change, don't screw with the GUI 
     254                            return 
    256255            if (hasattr(self, "context_menu")): 
    257256                self.context_menu.vbox.hide() 
Note: See TracChangeset for help on using the changeset viewer.