if hasattr(thing, 'nickname'):
self.io.send('THING_NAME %s %s' % (thing.id_, quote(t.nickname)))
-
self.io.send('TURN ' + str(self.turn))
for t in self.things:
send_thing(t)
from plomrogue.things import ThingBase
from plomrogue.misc import quote
-# TODO: fix screen refreshes on intermediary map results
-
def cmd_TURN(game, n):
game.turn = n
game.things = []
stdscr.addstr(1, self.window_width, 'MODE: ' + self.mode.name)
def draw_map():
+ player = self.game.get_thing(self.game.player_id, False)
+ if not player:
+ # catches race conditions where game.things still empty
+ return
map_lines_split = []
for y in range(self.game.map_size.y):
start = self.game.map_size.x * y
int(self.game.map_size.x / 2))
window_center = YX(int(self.size.y / 2),
int(self.window_width / 2))
- center = map_center
+ center = player
if self.mode.shows_info:
center = self.explorer
- else:
- player = self.game.get_thing(self.game.player_id, False)
- if player:
- center = player.position
offset = center - window_center
term_y = max(0, -offset.y)
term_x = max(0, -offset.x)