aqhome-react: added functions to inc/dec an int value.
This commit is contained in:
@@ -246,6 +246,36 @@ int AqHomeReact_GetIntValue(AQHOME_REACT *aqh, const char *path, int idx, int de
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int AqHomeReact_IncIntValue(AQHOME_REACT *aqh, const char *path, int startValue, int defaultValue)
|
||||||
|
{
|
||||||
|
if (aqh && aqh->localVars && path && *path) {
|
||||||
|
int v;
|
||||||
|
|
||||||
|
v=AQH_Vars_GetIntValue(aqh->localVars, path, 0, startValue);
|
||||||
|
v++;
|
||||||
|
AqHomeReact_SetIntValue(aqh, path, v);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int AqHomeReact_DecIntValue(AQHOME_REACT *aqh, const char *path, int startValue, int defaultValue)
|
||||||
|
{
|
||||||
|
if (aqh && aqh->localVars && path && *path) {
|
||||||
|
int v;
|
||||||
|
|
||||||
|
v=AQH_Vars_GetIntValue(aqh->localVars, path, 0, startValue);
|
||||||
|
v--;
|
||||||
|
AqHomeReact_SetIntValue(aqh, path, v);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_CreateUnitByName(AQHOME_REACT *aqh, const char *unitType)
|
AQHREACT_UNIT *AqHomeReact_CreateUnitByName(AQHOME_REACT *aqh, const char *unitType)
|
||||||
{
|
{
|
||||||
/* this does not include u_timer and u_varchanges, because those are only created once globally in init.c */
|
/* this does not include u_timer and u_varchanges, because those are only created once globally in init.c */
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ double AqHomeReact_GetDoubleValue(AQHOME_REACT *aqh, const char *path, int idx,
|
|||||||
int AqHomeReact_SetIntValue(AQHOME_REACT *aqh, const char *path, int value);
|
int AqHomeReact_SetIntValue(AQHOME_REACT *aqh, const char *path, int value);
|
||||||
int AqHomeReact_GetIntValue(AQHOME_REACT *aqh, const char *path, int idx, int defaultValue);
|
int AqHomeReact_GetIntValue(AQHOME_REACT *aqh, const char *path, int idx, int defaultValue);
|
||||||
|
|
||||||
|
int AqHomeReact_IncIntValue(AQHOME_REACT *aqh, const char *path, int startValue, int defaultValue);
|
||||||
|
int AqHomeReact_DecIntValue(AQHOME_REACT *aqh, const char *path, int startValue, int defaultValue);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user