Kaynağa Gözat

Added map-server config for prefered file lookup:
* group_conf_file: groups.conf
* atcommand_conf_file: groups.conf

NOTE:
Those files aren't for importing, but "which file do you want to read..."

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>

Cydh Ramdh 10 yıl önce
ebeveyn
işleme
ca3b06479d
3 değiştirilmiş dosya ile 5 ekleme ve 4 silme
  1. 1 0
      3rdparty/libconfig/libconfig.c
  2. 2 2
      src/map/atcommand.c
  3. 2 2
      src/map/pc_groups.c

+ 1 - 0
3rdparty/libconfig/libconfig.c

@@ -676,6 +676,7 @@ int config_read_file(config_t *config, const char *filename)
   {
     config->error_text = __io_error;
     config->error_type = CONFIG_ERR_FILE_IO;
+    config->error_file = filename; // Put error filename here, for more info
     return(CONFIG_FALSE);
   }
 

+ 2 - 2
src/map/atcommand.c

@@ -6962,7 +6962,7 @@ ACMD_FUNC(gmotd)
 {
 	FILE* fp;
 
-	if( ( fp = fopen(StringBuf_Value(map_config.motd_txt), "r") ) != NULL )
+	if( ( fp = fopen(mapserv_file(motd), "r") ) != NULL )
 	{
 		char buf[CHAT_SIZE_MAX];
 		size_t len;
@@ -10533,7 +10533,7 @@ void atcommand_doload(void) {
 	atcommand_db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH);
 	atcommand_alias_db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH);
 	atcommand_basecommands(); //fills initial atcommand_db with known commands
-	atcommand_config_read(ATCOMMAND_CONF_FILENAME);
+	atcommand_config_read(ATCOMMAND_CONF_FILENAME ? ATCOMMAND_CONF_FILENAME : mapserv_file(atcommand));
 }
 
 void do_init_atcommand(void) {

+ 2 - 2
src/map/pc_groups.c

@@ -61,9 +61,9 @@ static inline GroupSettings* name2group(const char* group_name)
 static void read_config(void)
 {
 	config_setting_t *groups = NULL;
-	const char *config_filename = "conf/groups.conf"; // FIXME hardcoded name
+	const char *config_filename = mapserv_file(group);
 	int group_count = 0;
-	
+
 	if (conf_read_file(&pc_group_config, config_filename))
 		return;