Changeset 627 for trunk/game/scripts


Ignore:
Timestamp:
08/06/10 08:45:53 (9 years ago)
Author:
beliar
Message:

Patch by Beliar.

  • Added SettingsVersion? to settings. This contains the version (currently a date of the last change) of the settings. The version will be checked with the version in settings-dist.xml and if the versions don't match the settings.xml file will be renamed to settings-old.xml. The version string has to be set manually when editing settings-dist.xml.
Location:
trunk/game/scripts
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/common/utils.py

    r563 r627  
    4141        for filename in fnmatch.filter(files, pattern): 
    4242            yield os.path.join(path, filename) 
     43 
     44def loadSettings(settings_file = "./settings.xml"): 
     45    from fife.extensions.fife_settings import Setting 
     46    return Setting(app_name = "PARPG", 
     47                   settings_file = settings_file,  
     48                   settings_gui_xml = "")   
  • trunk/game/scripts/gamemap.py

    r614 r627  
    1717 
    1818from fife import fife 
     19 
    1920from local_loaders.loaders import loadMapFile 
    20 from fife.extensions.fife_settings import Setting 
     21from scripts.common.utils import loadSettings 
    2122 
    22 TDS = Setting(app_name="PARPG", 
    23               settings_file="./settings.xml",  
    24               settings_gui_xml="") 
     23 
     24Settings = loadSettings() 
    2525 
    2626class GameMap(fife.MapChangeListener): 
     
    117117        text = self.engine.getGuiManager().\ 
    118118                        createFont('fonts/rpgfont.png', 0, \ 
    119                                    TDS.get("FIFE", "FontGlyphs")) 
     119                                   Settings.get("FIFE", "FontGlyphs")) 
    120120        rend.changeDefaultFont(text) 
    121121        rend.activateAllLayers(self.map) 
  • trunk/game/scripts/objects/actors.py

    r623 r627  
    1616#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>. 
    1717 
     18from random import randrange 
     19 
     20 
    1821from fife import fife 
     22 
    1923from base import GameObject, Living, Scriptable, CharStats 
    20 from fife.extensions.fife_settings import Setting 
    2124from composed import CarryableItem 
    2225from scripts.inventory import Inventory 
    23 from random import randrange 
     26from scripts.common.utils import loadSettings 
    2427 
    2528"""All actors go here. Concrete classes only.""" 
     
    2730__all__ = ["PlayerCharacter", "NonPlayerCharacter",] 
    2831 
    29 TDS = Setting(app_name="PARPG", 
    30               settings_file="./settings.xml",  
    31               settings_gui_xml="") 
     32Settings = loadSettings() 
     33 
    3234_AGENT_STATE_NONE, _AGENT_STATE_IDLE, _AGENT_STATE_APPROACH, _AGENT_STATE_RUN, _AGENT_STATE_WANDER, _AGENT_STATE_TALK = xrange(6) 
    3335 
     
    5153        self.state = _AGENT_STATE_NONE 
    5254        # TODO: rework/improve 
    53         self.speed = TDS.get("PARPG", "PCSpeed")-1 
     55        self.speed = Settings.get("PARPG", "PCSpeed")-1 
    5456         
    5557    def getX(self): 
     
    8991        self.idle_counter = 1 
    9092        # TODO: rework/improve 
    91         self.speed = TDS.get("PARPG", "PCSpeed") 
     93        self.speed = Settings.get("PARPG", "PCSpeed") 
    9294        self.nextAction = None 
    9395        self.agent = None 
  • trunk/game/scripts/parpg.py

    r566 r627  
    1717from fife.extensions import pychan 
    1818from fife.extensions.basicapplication import ApplicationBase 
     19 
    1920from scripts import gamemodel 
    20  
    2121from scripts import gamesceneview 
    2222from scripts import console 
Note: See TracChangeset for help on using the changeset viewer.