home · contact · privacy
Client: Save commands config file path in world struct.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 25 Jan 2014 20:29:36 +0000 (21:29 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 25 Jan 2014 20:29:36 +0000 (21:29 +0100)
src/client/command_db.c
src/client/main.c
src/client/world.h

index f5670a8f207b9638ce420e0775afb5aa492ccfd5..a74a93b1984014f7132f5a345c048eab2bc37cc2 100644 (file)
@@ -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];
index 3abb44a13ad889e67253e38e9b24590cbf4713a4..c7ac6f1a94a771f36577f899e68581bd0bd85124 100644 (file)
@@ -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. */
index 8b49a29e9f717b06d5b294650d2c6bdf3c7da412..a71f772db401b0d7ea5b5adfd432ac5b97c42308 100644 (file)
@@ -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*/