Skip to content

Commit

Permalink
Fix #56, increase and decrease raw values, not scaled ones.
Browse files Browse the repository at this point in the history
  • Loading branch information
jieter committed Feb 24, 2015
1 parent fee538e commit ba26cd1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ int Setup_getNumItems(void) {
return NUM_SETUP_ITEMS;
}

int _getRawValue(int item) {
return NV_GetConfig(setupmenu[item].nvval);
}

float Setup_getValue(int item) {
int intval = NV_GetConfig(setupmenu[item].nvval);
int intval = _getRawValue(item);
intval += setupmenu[item].offset;
return ((float)intval) * setupmenu[item].multiplier;
}
Expand All @@ -49,7 +53,7 @@ void Setup_setValue(int item, int value) {
}

void Setup_increaseValue(int item, int amount) {
int curval = Setup_getValue(item) + amount;
int curval = _getRawValue(item) + amount;

int maxval = setupmenu[item].maxval;
if (curval > maxval) curval = maxval;
Expand All @@ -58,7 +62,7 @@ void Setup_increaseValue(int item, int amount) {
}

void Setup_decreaseValue(int item, int amount) {
int curval = Setup_getValue(item) - amount;
int curval = _getRawValue(item) - amount;

int minval = setupmenu[item].minval;
if (curval < minval) curval = minval;
Expand Down

0 comments on commit ba26cd1

Please sign in to comment.