Add EN_openX function

EN_openX allows an EPANET input file to be opened even if it has errors. This required re-arranging code, mainly in input3.c, so that default values are assigned to an object before its input line is parsed.
This commit is contained in:
Lew Rossman
2023-10-04 09:53:05 -04:00
parent c84c6baee2
commit 10d5079d75
18 changed files with 994 additions and 724 deletions

View File

@@ -404,7 +404,7 @@ void adjustrules(Project *pr, int objtype, int index)
}
}
void adjusttankrules(Project *pr)
void adjusttankrules(Project *pr, int ndiff)
//-----------------------------------------------------------
// Adjusts tank indices in rule premises.
//-----------------------------------------------------------
@@ -420,7 +420,8 @@ void adjusttankrules(Project *pr)
p = net->Rule[i].Premises;
while (p != NULL)
{
if (p->object == r_NODE && p->index > njuncs) p->index++;
if (p->object == r_NODE && p->index > njuncs)
p->index += ndiff;
p = p->next;
}
}
@@ -472,7 +473,7 @@ int writerule(Project *pr, FILE *f, int ruleIndex)
Srule *rule = &net->Rule[ruleIndex];
Spremise *p;
Saction *a;
// Write each premise clause to the file
p = rule->Premises;
fprintf(f, "\nIF ");