home · contact · privacy
Server/py: Fix buggy logging in actor_use().
[plomrogue] / plomrogue-server.py
index adbada39cec822041a1c667985eae6f0ada835d1..2d53bb56fdea150011f046a68c1d798a88e4831a 100755 (executable)
@@ -485,7 +485,8 @@ def update_map_memory(t, age_map=True):
                if "v" == chr(t["fovmap"][(mt[1] * world_db["MAP_LENGTH"])
                                          + mt[2]])]:
             t["T_MEMTHING"].remove(mt)
-    for id in world_db["Things"]:
+    for id in [id for id in world_db["Things"]
+               if not world_db["Things"][id]["carried"]]:
         type = world_db["Things"][id]["T_TYPE"]
         if not world_db["ThingTypes"][type]["TT_LIFEPOINTS"]:
             y = world_db["Things"][id]["T_POSY"]
@@ -667,15 +668,15 @@ def actor_use(t):
             t["T_CARRIES"].remove(id)
             del world_db["Things"][id]
             t["T_SATIATION"] += world_db["ThingTypes"][type]["TT_CONSUMABLE"]
-            t["T_LIFEPOINTS"] += 1
-            # Wrongly increment HPs is a replica of the original code.
-            strong_write(io_db["file_out"], "LOG You consume this object.\n")
-        else:
-            strong_write(io_db["file_out"], "LOG You try to use this object," +
-                                            "but fail.\n")
-    else:
-        strong_write(io_db["file_out"], "LOG You try to use an object, but " +
-                                        "you own none.\n")
+            if t == world_db["Things"][0]:
+                strong_write(io_db["file_out"],
+                             "LOG You consume this object.\n")
+        elif t == world_db["Things"][0]:
+            strong_write(io_db["file_out"],
+                         "LOG You try to use this object, but fail.\n")
+    elif t == world_db["Things"][0]:
+        strong_write(io_db["file_out"],
+                     "LOG You try to use an object, but you own none.\n")
 
 
 def thingproliferation(t):