Add a new pattern or use an existing pattern - EN_loadpatternfile
Co-Authored-By: Lew Rossman <LRossman@outlook.com>
This commit is contained in:
18
src/epanet.c
18
src/epanet.c
@@ -4538,16 +4538,14 @@ int DLLEXPORT EN_loadpatternfile(EN_Project p, const char *filename, const char
|
|||||||
file = fopen(filename, "r");
|
file = fopen(filename, "r");
|
||||||
if (file == NULL) return 302;
|
if (file == NULL) return 302;
|
||||||
|
|
||||||
// Add the new pattern
|
// Add a new pattern or use an existing pattern.
|
||||||
if ((err = EN_addpattern(p, id)) != 0) {
|
err = EN_getpatternindex(p, id, &i);
|
||||||
fclose(file);
|
if (err == 205) {
|
||||||
return err;
|
if ((err = EN_addpattern(p, id)) != 0) {
|
||||||
}
|
fclose(file);
|
||||||
|
return err;
|
||||||
// Get the index of the newly added pattern
|
}
|
||||||
if ((err = EN_getpatternindex(p, id, &i)) != 0) {
|
i = p->network.Npats;
|
||||||
fclose(file);
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read pattern values
|
// Read pattern values
|
||||||
|
|||||||
Reference in New Issue
Block a user