Skip to content

Commit

Permalink
Removed hardcoded channel file name
Browse files Browse the repository at this point in the history
* Added config `channel_conf: conf/channels.conf` in conf/map_athena.conf

Signed-off-by: Cydh Ramdh <[email protected]>
  • Loading branch information
cydh committed Nov 18, 2016
1 parent df6c9e8 commit 2962e32
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions conf/map_athena.conf
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ help_txt: conf/help.txt
help2_txt: conf/help2.txt
charhelp_txt: conf/charhelp.txt

// Load channel config from
channel_conf: conf/channels.conf

// Maps:
import: conf/maps_athena.conf

Expand Down
7 changes: 4 additions & 3 deletions src/map/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1358,10 +1358,11 @@ void channel_read_config(void) {
config_setting_t *chsys = NULL;
config_setting_t *colors = NULL;
config_setting_t *chan_setting = NULL;
const char *config_filename = "conf/channels.conf"; // FIXME hardcoded name

if (conf_read_file(&channels_conf, config_filename))
if (conf_read_file(&channels_conf, channel_conf)) {
ShowError("Cannot read file '%s' for channel connfig.\n", channel_conf);
return;
}

chan_setting = config_lookup(&channels_conf, "channel_config");
if (chan_setting != NULL) {
Expand Down Expand Up @@ -1449,7 +1450,7 @@ void channel_read_config(void) {
}
}

ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' channels in '"CL_WHITE"%s"CL_RESET"'.\n", db_size(channel_db), config_filename);
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' channels in '"CL_WHITE"%s"CL_RESET"'.\n", db_size(channel_db), channel_conf);
config_destroy(&channels_conf);
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/map/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ char motd_txt[256] = "conf/motd.txt";
char help_txt[256] = "conf/help.txt";
char help2_txt[256] = "conf/help2.txt";
char charhelp_txt[256] = "conf/charhelp.txt";
char channel_conf[256] = "conf/channels.conf";

char wisp_server_name[NAME_LENGTH] = "Server"; // can be modified in char-server configuration file

Expand Down Expand Up @@ -3871,6 +3872,8 @@ int map_config_read(char *cfgName)
strcpy(help2_txt, w2);
else if (strcmpi(w1, "charhelp_txt") == 0)
strcpy(charhelp_txt, w2);
else if (strcmpi(w1, "channel_conf") == 0)
safestrncpy(channel_conf, w2, sizeof(channel_conf));
else if(strcmpi(w1,"db_path") == 0)
safestrncpy(db_path,w2,ARRAYLENGTH(db_path));
else if (strcmpi(w1, "console") == 0) {
Expand Down
1 change: 1 addition & 0 deletions src/map/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@ extern char motd_txt[];
extern char help_txt[];
extern char help2_txt[];
extern char charhelp_txt[];
extern char channel_conf[];

extern char wisp_server_name[];

Expand Down

0 comments on commit 2962e32

Please sign in to comment.