From 19d62704602a80b809a707668c97f25108bf6c7e Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Fri, 11 Mar 2016 22:08:23 +0100
Subject: [PATCH] TCE: Refactor calc_effort.

---
 plugins/server/TheCrawlingEater.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

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
 
-- 
2.30.2