home · contact · privacy
Improve input validation in command_worldactive().
[plomrogue] / roguelike-server
index ece7c86e595c2975966fca584cbfcc2b059be2f8..d68b4ff204ee6abf6a76032f49e7981d5c860a3e 100755 (executable)
@@ -793,10 +793,10 @@ def thingproliferation(t, prol_map):
         candidates = []
         for dir in [directions_db[key] for key in directions_db]:
             mv_result = mv_yx_in_dir_legal(dir, t["T_POSY"], t["T_POSX"])
-            # if mv_result[0] and  ord(":") == prol_map[mv_result[1]
-            if mv_result[0] and  ord(".") == prol_map[mv_result[1]  # #
-                                                      * world_db["MAP_LENGTH"]
-                                                      + mv_result[2]]:
+            if mv_result[0] and ord(":") == prol_map[mv_result[1]  # #
+            # if mv_result[0] and ord(".") == prol_map[mv_result[1]
+                                                     * world_db["MAP_LENGTH"]
+                                                     + mv_result[2]]:
                 candidates.append((mv_result[1], mv_result[2]))
         if len(candidates):
             i = rand.next() % len(candidates)
@@ -1370,7 +1370,7 @@ def command_worldactive(worldactive_string):
     map. On activation, rebuild all Things' FOVs, and the player's map memory.
     """
     val = integer_test(worldactive_string, 0, 1)
-    if val:
+    if None != val:
         if 0 != world_db["WORLD_ACTIVE"]:
             if 0 == val:
                 set_world_inactive()