From: Christian Heller <c.heller@plomlompom.de>
Date: Fri, 11 Mar 2016 21:08:23 +0000 (+0100)
Subject: TCE: Refactor calc_effort.
X-Git-Tag: tce~48
X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/tasks?a=commitdiff_plain;h=19d62704602a80b809a707668c97f25108bf6c7e;p=plomrogue

TCE: Refactor calc_effort.
---

diff --git a/plugins/server/TheCrawlingEater.py b/plugins/server/TheCrawlingEater.py
index 1c7a76d..d9b827b 100644
--- a/plugins/server/TheCrawlingEater.py
+++ b/plugins/server/TheCrawlingEater.py
@@ -197,11 +197,8 @@ def calc_effort(ta, t):
                                          t["T_POSY"], t["T_POSX"])
         if 1 == move_result[0]:
             pos = (move_result[1] * world_db["MAP_LENGTH"]) + move_result[2]
-            terrain = chr(world_db["MAP"][pos])
-            if terrain == "1":
-                return 2
-            elif terrain == "2":
-                return 4
+            narrowness = world_db["MAP"][pos] - ord("0")
+            return 2 ** narrowness
     return 1
 world_db["calc_effort"] = calc_effort