From b6c140e3bd19ede26e3992c03c576515487f0a10 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 25 Jan 2014 21:29:36 +0100
Subject: [PATCH] Client: Save commands config file path in world struct.

---
 src/client/command_db.c | 3 +--
 src/client/main.c       | 3 ++-
 src/client/world.h      | 1 +
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/client/command_db.c b/src/client/command_db.c
index f5670a8..a74a93b 100644
--- a/src/client/command_db.c
+++ b/src/client/command_db.c
@@ -56,8 +56,7 @@ extern struct Command * get_command(char * dsc_short)
 extern void init_command_db()
 {
     char * f_name = "init_command_db()";
-    char * path = "confclient/commands";
-    FILE * file = try_fopen(path, "r", f_name);
+    FILE * file = try_fopen(world.path_commands, "r", f_name);
     uint32_t lines;
     uint32_t linemax = textfile_sizes(file, &lines);
     char line[linemax + 1];
diff --git a/src/client/main.c b/src/client/main.c
index 3abb44a..c7ac6f1 100644
--- a/src/client/main.c
+++ b/src/client/main.c
@@ -24,7 +24,8 @@ int main(int argc, char * argv[])
     char * f_name = "main()";
 
     /* Declare hard-coded paths here. */
-    world.path_server_in = "server/in";
+    world.path_server_in      = "server/in";
+    world.path_commands       = "confclient/commands";
     world.path_interface_conf = "confclient/interface_conf";
 
     /* Parse command line arguments. */
diff --git a/src/client/world.h b/src/client/world.h
index 8b49a29..a71f772 100644
--- a/src/client/world.h
+++ b/src/client/world.h
@@ -29,6 +29,7 @@ struct World
     char * log; /* log of player's activities */
     char * path_server_in; /* path of server's input fifo */
     char * path_interface_conf; /* path of interface configuration file */
+    char * path_commands; /* path of commands config file */
     char * player_inventory; /* one-item-per-line string list of owned items */
     uint16_t turn; /* world/game turn */
     uint16_t player_score; /* player's score*/
-- 
2.30.2