Add a new pattern or use an existing pattern - EN_loadpatternfile

Co-Authored-By: Lew Rossman <LRossman@outlook.com>
This commit is contained in:
Marios S. Kyriakou
2024-08-01 17:06:32 +03:00
parent 17b14e2178
commit b16dacb87e

View File

@@ -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