X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=new2%2Fplomrogue%2Fgame.py;h=74c79d1e2eadddc7502bd803455f6c691ad70eb5;hb=beebfdb7dac8e7630643c44e9ae8d3c79d5d39d8;hp=8fb264447d5c2e30f757d2d507c9e62e5a3ee84d;hpb=2e712c7bd1617337bafff6afdf8c3ba058d4a709;p=plomrogue2-experiments diff --git a/new2/plomrogue/game.py b/new2/plomrogue/game.py index 8fb2644..74c79d1 100755 --- a/new2/plomrogue/game.py +++ b/new2/plomrogue/game.py @@ -2,7 +2,8 @@ from plomrogue.tasks import (Task_WAIT, Task_MOVE, Task_WRITE, Task_FLATTEN_SURROUNDINGS) from plomrogue.errors import GameError from plomrogue.commands import (cmd_ALL, cmd_LOGIN, cmd_QUERY, cmd_PING, - cmd_TURN, cmd_MAP_LINE, cmd_MAP) + cmd_TURN, cmd_MAP_LINE, cmd_MAP, cmd_GET_ANNOTATION, + cmd_ANNOTATE) from plomrogue.io import GameIO from plomrogue.misc import quote from plomrogue.things import Thing, ThingPlayer @@ -48,12 +49,15 @@ class Game(GameBase): 'LOGIN': cmd_LOGIN, 'TURN': cmd_TURN, 'MAP_LINE': cmd_MAP_LINE, + 'GET_ANNOTATION': cmd_GET_ANNOTATION, + 'ANNOTATE': cmd_ANNOTATE, 'MAP': cmd_MAP, 'PING': cmd_PING} self.thing_type = Thing self.thing_types = {'player': ThingPlayer} self.sessions = {} self.map = Map(self.map_geometry.size) + self.annotations = {} if os.path.exists(self.io.save_file): if not os.path.isfile(self.io.save_file): raise GameError('save file path refers to non-file') @@ -163,7 +167,10 @@ class Game(GameBase): write(f, 'MAP %s' % (self.map_geometry.size,)) for y, line in self.map.lines(): write(f, 'MAP_LINE %5s %s' % (y, quote(line))) + for yx in self.annotations: + write(f, 'ANNOTATE %s %s' % (yx, quote(self.annotations[yx]))) - def new_map(self, size): + def new_world(self, size): self.map_geometry = MapGeometrySquare(YX(size.y, size.x)) self.map = Map(self.map_geometry.size) + self.annotations = {}