int itemCount = displayMinItems;
int itemBase = 0;
int currentItem = 0;
+ int ret = -2; // -2: Used for marking "no return yet"
int height, width;
initscr();
raw(); noecho();
+ // Get item count
+ // - 6: randomly chosen (Need at least 3)
itemCount = LINES - 6;
if( itemCount > giNumItems )
itemCount = giNumItems;
}
}
else {
- break;
+ switch(ch)
+ {
+ case '\n':
+ ret = currentItem;
+ break;
+ case 'q':
+ ret = -1; // -1: Return with no dispense
+ break;
+ }
+
+ // Check if the return value was changed
+ if( ret != -2 ) break;
}
}
// Leave
endwin();
- return -1;
+ return ret;
}
/**