home · contact · privacy
Server: Make thingproliferation function selectable.
[plomrogue] / server / build_fov_map.py
diff --git a/server/build_fov_map.py b/server/build_fov_map.py
new file mode 100644 (file)
index 0000000..11c6382
--- /dev/null
@@ -0,0 +1,14 @@
+# This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
+# or any later version. For details on its copyright, license, and warranties,
+# see the file NOTICE in the root directory of the PlomRogue source package.
+
+
+def build_fov_map(t):
+    """Build Thing's FOV map."""
+    from server.config.world_data import world_db
+    from server.utils import libpr, c_pointer_to_bytearray
+    t["fovmap"] = bytearray(b'v' * (world_db["MAP_LENGTH"] ** 2))
+    fovmap = c_pointer_to_bytearray(t["fovmap"])
+    map = c_pointer_to_bytearray(world_db["MAP"])
+    if libpr.build_fov_map(t["T_POSY"], t["T_POSX"], fovmap, map):
+        raise RuntimeError("Malloc error in build_fov_Map().")