home · contact · privacy
84b0a8a6f512cae596f689c85f0e13fa80613052
[plomrogue2] / plomrogue / misc.py
1 class Terrain:
2
3     def __init__(self, character, description, blocks_light=False,
4                  blocks_sound=False, blocks_movement=False):
5         self.character = character
6         self.description = description
7         self.blocks_light = blocks_light
8         self.blocks_sound = blocks_sound
9         self.blocks_movement = blocks_movement
10
11
12
13 def quote(string):
14     """Quote & escape string so client interprets it as single token."""
15     quoted = []
16     quoted += ['"']
17     for c in string:
18         if c in {'"', '\\'}:
19             quoted += ['\\']
20         quoted += [c]
21     quoted += ['"']
22     return ''.join(quoted)