Update EN_setlinkvalue for EN_INITSTATUS

This commit is contained in:
Lew Rossman
2025-09-25 09:38:33 -04:00
parent 0004dc2bec
commit 0bb2e73c8e

View File

@@ -4130,10 +4130,16 @@ int DLLEXPORT EN_setlinkvalue(EN_Project p, int index, int property, double valu
case EN_STATUS:
// Cannot set status for a check valve
if (Link[index].Type == CVPIPE) return 207;
// Status 's' must be either EN_CLOSED (0) or EN_OPEN (1)
// (to set the status of a valve to ACTIVE, assign a value to its
// EN_INITSETTING or EN_SETTING property)
s = (char)ROUND(value);
if (s < 0 || s > 2) return 211;
if (s < 0 || s > 1) return 211;
if (property == EN_INITSTATUS)
{
// Convert 0/1 to StatusType CLOSED/OPEN
Link[index].InitStatus = s + CLOSED;
}
else