home · contact · privacy
Whitespace riddance and some quote bug fixes.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 4 Nov 2020 03:42:06 +0000 (04:42 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 4 Nov 2020 03:42:06 +0000 (04:42 +0100)
new2/plomrogue/game.py
new2/plomrogue/things.py

index 2202343d2bf61bc2fd63c5467ae4fb373bf7f20e..c89d2c6cfddf80c3d30bca0abbe9dbabaa9e1d16 100755 (executable)
@@ -6,7 +6,7 @@ from plomrogue.commands import (cmd_ALL, cmd_LOGIN, cmd_QUERY, cmd_PING,
                                 cmd_ANNOTATE, cmd_PORTAL, cmd_GET_GAMESTATE)
 from plomrogue.io import GameIO
 from plomrogue.misc import quote
                                 cmd_ANNOTATE, cmd_PORTAL, cmd_GET_GAMESTATE)
 from plomrogue.io import GameIO
 from plomrogue.misc import quote
-from plomrogue.things import Thing, ThingPlayer 
+from plomrogue.things import Thing, ThingPlayer
 from plomrogue.mapping import YX, MapGeometrySquare, Map
 
 
 from plomrogue.mapping import YX, MapGeometrySquare, Map
 
 
@@ -14,7 +14,6 @@ from plomrogue.mapping import YX, MapGeometrySquare, Map
 class GameBase:
 
     def __init__(self):
 class GameBase:
 
     def __init__(self):
-        pass
         self.turn = 0
         self.things = []
 
         self.turn = 0
         self.things = []
 
@@ -87,7 +86,7 @@ class Game(GameBase):
         def send_thing(thing):
             self.io.send('THING_POS %s %s' % (thing.id_, t.position))
             if hasattr(thing, 'nickname'):
         def send_thing(thing):
             self.io.send('THING_POS %s %s' % (thing.id_, t.position))
             if hasattr(thing, 'nickname'):
-                self.io.send('THING_NAME %s %s' % (thing.id_, t.nickname))
+                self.io.send('THING_NAME %s %s' % (thing.id_, quote(t.nickname)))
 
 
         self.io.send('TURN ' + str(self.turn))
 
 
         self.io.send('TURN ' + str(self.turn))
@@ -95,7 +94,7 @@ class Game(GameBase):
             send_thing(t)
         self.io.send('MAP %s %s' % (self.map_geometry.size, quote(self.map.terrain)))
         for yx in self.portals:
             send_thing(t)
         self.io.send('MAP %s %s' % (self.map_geometry.size, quote(self.map.terrain)))
         for yx in self.portals:
-            self.io.send('PORTAL %s %s' % (yx, self.portals[yx]))
+            self.io.send('PORTAL %s %s' % (yx, quote(self.portals[yx])))
         self.io.send('GAME_STATE_COMPLETE')
 
     def run_tick(self):
         self.io.send('GAME_STATE_COMPLETE')
 
     def run_tick(self):
index 138a1fac7ccdcd1ba0603023f478cd7d92b1b9bb..0e4af344e5cc9bcfc6af4e0e6fb88cbd07054e96 100644 (file)
@@ -40,7 +40,7 @@ class ThingAnimate(Thing):
 
     def set_next_task(self, task_name, args=()):
         task_class = self.game.tasks[task_name]
 
     def set_next_task(self, task_name, args=()):
         task_class = self.game.tasks[task_name]
-        self.next_tasks += [task_class(self, args)] 
+        self.next_tasks += [task_class(self, args)]
 
     def get_next_task(self):
         if len(self.next_tasks) > 0:
 
     def get_next_task(self):
         if len(self.next_tasks) > 0: