bugfix in quantity form

This commit is contained in:
Lance Edgar 2012-12-04 11:27:22 -08:00
parent e43dca60f2
commit 9ba22bc0dd

View file

@ -960,24 +960,29 @@ static void AppendQuantityDigit(UInt16 digit)
{
Char digitText[2];
if (StrLen(gQuantity) > 2) {
// If the current quantity already exceeds 2 digits, issue a warning
// beep instead of appending the digit.
if (! gQuantityTouched) {
// This is the first time the quantity is being touched; replace it
// outright instead of appending the digit.
StrIToA(gQuantity, digit);
UpdateQuantityDisplay();
gQuantityTouched = true;
} else if (StrLen(gQuantity) > 2) {
// The current quantity already exceeds 2 digits; issue a warning beep
// instead of appending the digit.
SndPlaySystemSound(sndWarning);
} else if (gQuantityTouched && StrCompare(gQuantity, "0") != 0) {
} else if (StrCompare(gQuantity, "0") == 0) {
// The current quantity is zero; replace it outright instead of
// appending the digit.
StrIToA(gQuantity, digit);
UpdateQuantityDisplay();
} else {
// Okay, we can append the digit.
StrIToA(digitText, digit);
StrCat(gQuantity, digitText);
UpdateQuantityDisplay();
} else {
// Either this is the first time the quantity is being touched, or else
// the quantity is currently zero. Replace it outright instead of
// appending the digit.
StrIToA(gQuantity, digit);
UpdateQuantityDisplay();
gQuantityTouched = true;
}
}