From d50c6733213d8952daddfd823531527df5e1bbe4 Mon Sep 17 00:00:00 2001 From: Dennis <65568528+zannads@users.noreply.github.com> Date: Thu, 23 May 2024 10:33:30 +0300 Subject: [PATCH] Fix Issue #790 - incorrect number of pipes The pipe counter was not decreased if the element was a pipe. --- src/epanet.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/epanet.c b/src/epanet.c index 86b510ba..4c8399f7 100644 --- a/src/epanet.c +++ b/src/epanet.c @@ -3408,6 +3408,12 @@ int DLLEXPORT EN_deletelink(EN_Project p, int index, int actionCode) if (net->Valve[i].Link > index) net->Valve[i].Link -= 1; } + // Reduce the number of pipes count by one if it is a pipe. + if (linkType == PIPE) + { + net->Npipes--; + } + // Delete any pump associated with the deleted link if (linkType == PUMP) {