home · contact · privacy
Server: Start modularizing into separate files.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 27 Jan 2016 22:54:38 +0000 (23:54 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 27 Jan 2016 22:54:38 +0000 (23:54 +0100)
roguelike-server
server/config/io.py [new file with mode: 0644]
server/config/world_data.py [new file with mode: 0644]

index 4ab7287bccf2f063d32021cbdf74078e11b0ac36..773a2fa4a5827fb6639974ff9cc2ef03637b9fc5 100755 (executable)
@@ -15,6 +15,10 @@ import ctypes
 import math
 
 
+from server.config.world_data import world_db, directions_db
+from server.config.io import io_db
+
+
 class RandomnessIO:
     """"Interface to libplomrogue's pseudo-randomness generator."""
 
@@ -1712,37 +1716,6 @@ commands_db = {
 # TODO: Unhandled cases: (Un-)killing animates (esp. player!) with T_LIFEPOINTS.
 
 
-"""World state database. With sane default values. (Randomness is in rand.)"""
-world_db = {
-    "TURN": 0,
-    "MAP_LENGTH": 64,
-    "PLAYER_TYPE": 0,
-    "WORLD_ACTIVE": 0,
-    "MAP": False,
-    "ThingActions": {},
-    "ThingTypes": {},
-    "Things": {}
-}
-
-"""Mapping of direction names to internal direction chars."""
-directions_db = {"east": "d", "south-east": "c", "south-west": "x",
-                 "west": "s", "north-west": "w", "north-east": "e"}
-
-"""File IO database."""
-io_db = {
-    "path_save": "save",
-    "path_record": "record_save",
-    "path_worldconf": "confserver/world",
-    "path_server": "server_run/",
-    "path_in": "server_run/in",
-    "path_out": "server_run/out",
-    "path_worldstate": "server_run/worldstate",
-    "tmp_suffix": "_tmp",
-    "kicked_by_rival": False,
-    "worldstate_updateable": False
-}
-
-
 try:
     libpr = prep_library()
     rand = RandomnessIO()
diff --git a/server/config/io.py b/server/config/io.py
new file mode 100644 (file)
index 0000000..2f22a28
--- /dev/null
@@ -0,0 +1,14 @@
+"""File IO database."""
+io_db = {
+    "path_save": "save",
+    "path_record": "record_save",
+    "path_worldconf": "confserver/world",
+    "path_server": "server_run/",
+    "path_in": "server_run/in",
+    "path_out": "server_run/out",
+    "path_worldstate": "server_run/worldstate",
+    "tmp_suffix": "_tmp",
+    "kicked_by_rival": False,
+    "worldstate_updateable": False
+}
+
diff --git a/server/config/world_data.py b/server/config/world_data.py
new file mode 100644 (file)
index 0000000..45acf4f
--- /dev/null
@@ -0,0 +1,15 @@
+"""World state database. With sane default values. (Randomness is in rand.)"""
+world_db = {
+    "TURN": 0,
+    "MAP_LENGTH": 64,
+    "PLAYER_TYPE": 0,
+    "WORLD_ACTIVE": 0,
+    "MAP": False,
+    "ThingActions": {},
+    "ThingTypes": {},
+    "Things": {}
+}
+
+"""Mapping of direction names to internal direction chars."""
+directions_db = {"east": "d", "south-east": "c", "south-west": "x",
+                 "west": "s", "north-west": "w", "north-east": "e"}