Changeset 530 for trunk/game/scripts


Ignore:
Timestamp:
03/16/10 20:40:20 (10 years ago)
Author:
beliar
Message:

Booleans are now parsed correctly when loading a map.

pylintrc:

Disabled some pylint messages

utils.py:

Added parseBool function

xmlmap.py:

Changed parseInstances to use parseBool for is_open and locked

base.py:

removed Hack for locked - Not needed anymore, and wasn't working correctly anyway.

Location:
trunk/game/scripts
Files:
2 edited

Legend:

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

    r147 r530  
    2929            sys.path.append(os.path.sep.join(p.split('/'))) 
    3030 
     31def parseBool(value): 
     32    """Parses a string to get a boolean value""" 
     33    if (value.isdigit()): 
     34        return bool(int(value)) 
     35    elif (value.isalpha): 
     36        return value.lower()[0] == "t" 
     37    return False 
  • trunk/game/scripts/objects/base.py

    r480 r530  
    162162                           are always closed.""" 
    163163        self.is_lockable = True 
    164         # HACK: For some reason locked appears to NOT be a bool??? 
    165         # TODO: fix this, if only for our sanity! 
    166         if locked == True: 
    167             locked = True 
    168         else: locked = False 
    169164        self.locked = locked 
    170165        if locked : 
Note: See TracChangeset for help on using the changeset viewer.