X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=src%2Fclient%2Fmenu.c;h=b5202d38afe2fb8d8126ac76f688ad5f2e8f9aa0;hb=6b70240e4975aa8a5cfe1c4f01f79c64ec1ba5e1;hp=f30e480482ff7faa65c3b69ccc65db852bfbef1d;hpb=4f9a370c8083cd61186fa6c5fb5955b0f9220317;p=tpg%2Fopendispense2.git diff --git a/src/client/menu.c b/src/client/menu.c index f30e480..b5202d3 100644 --- a/src/client/menu.c +++ b/src/client/menu.c @@ -251,6 +251,10 @@ int ShowNCursesUI(void) return ret; } +#define COKE_LABEL "Coke Machine" +#define NCOKESLOTS 7 // slots 0 -- 6 +#define EPS_LABEL "Electronic Payment System" + /** * \brief Show item \a Index at (\a Col, \a Row) * \return Dispense index of item @@ -265,7 +269,6 @@ int ShowItemAt(int Row, int Col, int Width, int Index, int bHilighted) switch(giUIMode) { // Standard UI - // - This assumes that case UI_MODE_STANDARD: // Bounds check // Index = -1, request limit @@ -275,25 +278,25 @@ int ShowItemAt(int Row, int Col, int Width, int Index, int bHilighted) if( Index == 0 ) { price = 0; - name = "Coke Machine"; + name = COKE_LABEL; Index = -1; // -1 indicates a label break; } Index --; // Drinks 0 - 6 - if( Index <= 6 ) + if( Index < NCOKESLOTS ) { name = gaItems[Index].Desc; price = gaItems[Index].Price; status = gaItems[Index].Status; break; } - Index -= 7; + Index -= NCOKESLOTS; // EPS label if( Index == 0 ) { price = 0; - name = "Electronic Payment System"; + name = EPS_LABEL; Index = -1; // -1 indicates a label break; } @@ -303,6 +306,9 @@ int ShowItemAt(int Row, int Col, int Width, int Index, int bHilighted) price = gaItems[Index].Price; status = gaItems[Index].Status; break; + case UI_MODE_BASIC: + case UI_MODE_DRINKSONLY: + case UI_MODE_ALL: default: return -1; }