diff --git a/src/bflib_dernc.c b/src/bflib_dernc.c index 79cf63ece2..3e6dccc2ce 100644 --- a/src/bflib_dernc.c +++ b/src/bflib_dernc.c @@ -452,7 +452,6 @@ long LbFileLengthRnc(const char *fname) long flength; TbFileHandle handle = LbFileOpen(fname, Lb_FILE_MODE_READ_ONLY); if (!handle) { - LbSyncLog("%s: failed to open\n", fname); return -1; } #if (BFDEBUG_LEVEL > 19) diff --git a/src/config_magic.c b/src/config_magic.c index f68df108ac..0914667cfe 100644 --- a/src/config_magic.c +++ b/src/config_magic.c @@ -425,10 +425,14 @@ TbBool parse_magic_spell_blocks(char *buf, long len, const char *config_textname // Initialize the array for (int i = 0; i < MAGIC_ITEMS_MAX; i++) { spellst = &game.conf.magic_conf.spell_cfgstats[i]; - if (((flags & CnfLd_AcceptPartial) == 0) || (strlen(spellst->code_name) <= 0)) { - LbMemorySet(&spellst->code_name, 0, COMMAND_WORD_LEN); - spell_desc[i].name = spellst->code_name; - spell_desc[i].num = i; + if ((!flag_is_set(flags,CnfLd_AcceptPartial)) || (strlen(spellst->code_name) <= 0)) + { + if (flag_is_set(flags, CnfLd_ListOnly)) + { + LbMemorySet(&spellst->code_name, 0, COMMAND_WORD_LEN); + spell_desc[i].name = spellst->code_name; + spell_desc[i].num = i; + } spconf = &game.conf.magic_conf.spell_config[i]; spconf->linked_power = 0; spconf->duration = 0; @@ -474,11 +478,10 @@ TbBool parse_magic_spell_blocks(char *buf, long len, const char *config_textname int cmd_num = recognize_conf_command(buf, &pos, len, magic_spell_commands); // Now store the config item in correct place if (cmd_num == ccr_endOfBlock) break; // if next block starts - if ((flags & CnfLd_ListOnly) != 0) { - // In "List only" mode, accept only name command - if (cmd_num > 1) { - cmd_num = 0; - } + //Do the name when listing, the rest when not listing. + if ((flag_is_set(flags, CnfLd_ListOnly) && cmd_num > 1) || (!flag_is_set(flags, CnfLd_ListOnly) && cmd_num <= 1)) + { + cmd_num = ccr_comment; } int n = 0, k = 0; char word_buf[COMMAND_WORD_LEN]; @@ -491,6 +494,11 @@ TbBool parse_magic_spell_blocks(char *buf, long len, const char *config_textname COMMAND_TEXT(cmd_num), blocknamelen, blockname, config_textname); break; } + else + { + spell_desc[i].name = spellst->code_name; + spell_desc[i].num = i; + } n++; break; case 2: // DURATION @@ -729,11 +737,15 @@ TbBool parse_magic_shot_blocks(char *buf, long len, const char *config_textname, // Initialize the array for (int i = 0; i < MAGIC_ITEMS_MAX; i++) { shotst = &game.conf.magic_conf.shot_cfgstats[i]; - if (((flags & CnfLd_AcceptPartial) == 0) || (strlen(shotst->code_name) <= 0)) { - LbMemorySet(shotst->code_name, 0, COMMAND_WORD_LEN); + if ((!flag_is_set(flags,CnfLd_AcceptPartial)) || (strlen(shotst->code_name) <= 0)) + { + if (flag_is_set(flags, CnfLd_ListOnly)) + { + LbMemorySet(shotst->code_name, 0, COMMAND_WORD_LEN); + shot_desc[i].name = shotst->code_name; + shot_desc[i].num = i; + } shotst->model_flags = 0; - shot_desc[i].name = shotst->code_name; - shot_desc[i].num = i; shotst->area_hit_type = THit_CrtrsOnly; shotst->area_range = 0; shotst->area_damage = 0; @@ -795,23 +807,27 @@ TbBool parse_magic_shot_blocks(char *buf, long len, const char *config_textname, int cmd_num = recognize_conf_command(buf, &pos, len, magic_shot_commands); // Now store the config item in correct place if (cmd_num == ccr_endOfBlock) break; // if next block starts - if ((flags & CnfLd_ListOnly) != 0) { - // In "List only" mode, accept only name command - if (cmd_num > 1) { - cmd_num = 0; - } + //Do the name when listing, the rest when not listing. + if ((flag_is_set(flags, CnfLd_ListOnly) && cmd_num > 1) || (!flag_is_set(flags, CnfLd_ListOnly) && cmd_num <= 1)) + { + cmd_num = ccr_comment; } int n = 0, k = 0; char word_buf[COMMAND_WORD_LEN]; switch (cmd_num) { case 1: // NAME - if (get_conf_parameter_single(buf,&pos,len,shotst->code_name,COMMAND_WORD_LEN) <= 0) + if (get_conf_parameter_single(buf, &pos, len, shotst->code_name, COMMAND_WORD_LEN) <= 0) { CONFWRNLOG("Couldn't read \"%s\" parameter in [%.*s] block of %s file.", COMMAND_TEXT(cmd_num), blocknamelen, blockname, config_textname); break; } + else + { + shot_desc[i].name = shotst->code_name; + shot_desc[i].num = i; + } n++; break; case 2: // HEALTH @@ -1809,8 +1825,14 @@ TbBool parse_magic_power_blocks(char *buf, long len, const char *config_textname // Initialize the array for (int i = 0; i < MAGIC_ITEMS_MAX; i++) { powerst = &game.conf.magic_conf.power_cfgstats[i]; - if (((flags & CnfLd_AcceptPartial) == 0) || (strlen(powerst->code_name) <= 0)) { - LbMemorySet(powerst->code_name, 0, COMMAND_WORD_LEN); + if ((!flag_is_set(flags,CnfLd_AcceptPartial)) || (strlen(powerst->code_name) <= 0)) + { + if (flag_is_set(flags, CnfLd_ListOnly)) + { + LbMemorySet(powerst->code_name, 0, COMMAND_WORD_LEN); + power_desc[i].name = powerst->code_name; + power_desc[i].num = i; + } powerst->artifact_model = 0; powerst->can_cast_flags = 0; powerst->config_flags = 0; @@ -1825,11 +1847,9 @@ TbBool parse_magic_power_blocks(char *buf, long len, const char *config_textname powerst->panel_tab_idx = 0; powerst->select_sound_idx = 0; powerst->cast_cooldown = 0; - power_desc[i].name = powerst->code_name; - power_desc[i].num = i; } } - if ((flags & CnfLd_AcceptPartial) == 0) { + if (!flag_is_set(flags, CnfLd_AcceptPartial)) { for (int i = 0; i < MAGIC_ITEMS_MAX; i++) { game.conf.object_conf.object_to_power_artifact[i] = 0; } @@ -1862,11 +1882,10 @@ TbBool parse_magic_power_blocks(char *buf, long len, const char *config_textname int cmd_num = recognize_conf_command(buf, &pos, len, magic_power_commands); // Now store the config item in correct place if (cmd_num == ccr_endOfBlock) break; // if next block starts - if ((flags & CnfLd_ListOnly) != 0) { - // In "List only" mode, accept only name command - if (cmd_num > 1) { - cmd_num = 0; - } + //Do the name when listing, the rest when not listing. + if ((flag_is_set(flags, CnfLd_ListOnly) && cmd_num > 1) || (!flag_is_set(flags, CnfLd_ListOnly) && cmd_num <= 1)) + { + cmd_num = ccr_comment; } int n = 0; char word_buf[COMMAND_WORD_LEN]; @@ -1879,6 +1898,11 @@ TbBool parse_magic_power_blocks(char *buf, long len, const char *config_textname COMMAND_TEXT(cmd_num), blocknamelen, blockname, config_textname); break; } + else + { + power_desc[i].name = powerst->code_name; + power_desc[i].num = i; + } break; case 2: // POWER while (get_conf_parameter_single(buf,&pos,len,word_buf,sizeof(word_buf)) > 0)