Skip to content
Snippets Groups Projects
Commit a225fd20 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Detect and log warnings about duplicate area sections in areas.ini

... like how we do for areas.bbs files.
parent 7046272e
No related branches found
No related tags found
No related merge requests found
......@@ -6316,7 +6316,7 @@ void read_areafile_ini(FILE* stream)
{
char value[INI_MAX_VALUE_LEN];
str_list_t ini = iniReadFile(stream);
str_list_t areas = iniGetSectionList(ini, /* prefix: */NULL);
str_list_t areas = iniGetSectionListWithDupes(ini, /* prefix: */NULL);
for(size_t u = 0; areas != NULL && areas[u] != NULL; ++u) {
char* area_tag = areas[u];
......@@ -6335,6 +6335,12 @@ void read_areafile_ini(FILE* stream)
}
if(area_tag[0]=='*') /* UNKNOWN-ECHO area */
cfg.badecho = areanum;
if(areanum > 0 && area_is_valid(find_area(area_tag))) {
printf("\n");
lprintf(LOG_WARNING, "DUPLICATE AREA (%s) in area file (%s), IGNORED!", area_tag, cfg.areafile);
cfg.areas--;
continue;
}
if((cfg.area[areanum].tag=strdup(area_tag))==NULL) {
printf("\n");
lprintf(LOG_ERR,"ERROR allocating memory for area #%u tag."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment