From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 29 Nov 2015 22:06:07 +0000 (+0100)
Subject: New client: Scroll map window with player avatar.
X-Git-Tag: tce~242
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%7B%7B%20web_path%20%7D%7D/edit?a=commitdiff_plain;h=9c346f2749d1e9f63be1421d7d1fe51162bc64e3;p=plomrogue

New client: Scroll map window with player avatar.
---

diff --git a/client_prototype.py b/client_prototype.py
index 2fc7a44..02f63b9 100644
--- a/client_prototype.py
+++ b/client_prototype.py
@@ -298,7 +298,16 @@ def win_foo():
 
 
 def win_map():
+    win_size = next(win["size"] for win in windows if win["func"] == win_map)
     offset = [0, 0]
+    for i in range(2):
+        if world_data["position"][i] * (i + 1) > win_size[i] / 2:
+            if world_data["position"][i] * (i + 1) \
+                < world_data["map_size"] * (i + 1) - win_size[i] / 2:
+                offset[i] = world_data["position"][i] * (i + 1) \
+                    - int(win_size[i] / 2)
+            else:
+                offset[i] = world_data["map_size"] * (i + 1) - win_size[i] + i
     winmap_size = [world_data["map_size"], world_data["map_size"] * 2 + 1]
     winmap = []
     for y in range(world_data["map_size"]):