From: Christian Heller Date: Sat, 25 Jan 2014 20:29:36 +0000 (+0100) Subject: Client: Save commands config file path in world struct. X-Git-Tag: tce~861 X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/%7B%7Bdb.prefix%7D%7D/processes?a=commitdiff_plain;h=b6c140e3bd19ede26e3992c03c576515487f0a10;p=plomrogue Client: Save commands config file path in world struct. --- 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*/