Skip to content

Commit

Permalink
Fix two legacy API functions
Browse files Browse the repository at this point in the history
  • Loading branch information
LRossman committed Jun 13, 2024
1 parent 109a93f commit 62f0bc6
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/epanet2.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,16 @@ int DLLEXPORT ENgetnodevalue(int index, int property, EN_API_FLOAT_TYPE *value)

int DLLEXPORT ENgetnodevalues(int property, EN_API_FLOAT_TYPE *values)
{
return EN_getnodevalues(_defaultProject, property, values);
int i, errcode = 0;
EN_API_FLOAT_TYPE value;

for (i = 1; i <= _defaultProject->network.Nnodes; i++)
{
errcode = ENgetnodevalue(i, property, &value);
values[i-1] = value;
if (errcode != 0) return errcode;
}
return 0;
}

int DLLEXPORT ENsetnodevalue(int index, int property, EN_API_FLOAT_TYPE value)
Expand Down Expand Up @@ -530,7 +539,16 @@ int DLLEXPORT ENgetlinkvalue(int index, int property, EN_API_FLOAT_TYPE *value)
}
int DLLEXPORT ENgetlinkvalues(int property, EN_API_FLOAT_TYPE *values)
{
return EN_getlinkvalues(_defaultProject, property, values);
int i, errcode = 0;
EN_API_FLOAT_TYPE value;

for (i = 1; i <= _defaultProject->network.Nlinks; i++)
{
errcode = ENgetlinkvalue(i, property, &value);
values[i-1] = value;
if (errcode != 0) return errcode;
}
return 0;
}

int DLLEXPORT ENsetlinkvalue(int index, int property, EN_API_FLOAT_TYPE value)
Expand Down

0 comments on commit 62f0bc6

Please sign in to comment.