1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

UtilityClass::number impl a bit cleaner

This commit is contained in:
Keith Stellyes 2020-01-11 16:43:23 -08:00 committed by Ethan Lee
parent 84320d241e
commit 9af73a27f7

View file

@ -151,162 +151,23 @@ std::string UtilityClass::timestring( int t )
std::string UtilityClass::number( int _t ) std::string UtilityClass::number( int _t )
{ {
switch(_t) const int BIGGEST_SMALL_NUMBER = 50;
{ const char* smallnumbers[] = {"Zero", "One", "Two", "Three",
case 0: "Four", "Five", "Six", "Seven", "Eight", "Nine",
return "Zero"; "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen",
break; "Sixteen", "Seventeen", "Eighteen", "Nineteen", "Twenty", "Twenty One",
case 1: "Twenty Two", "Twenty Three", "Twenty Four", "Twenty Five",
return "One"; "Twenty Six", "Twenty Seven", "Twenty Eight", "Twenty Nine",
break; "Thirty", "Thirty One", "Thirty Two", "Thirty Three", "Thirty Four",
case 2: "Thirty Five", "Thirty Six", "Thirty Seven", "Thirty Eight",
return "Two"; "Thirty Nine", "Forty Zero", "Forty One", "Forty Two", "Forty Three",
break; "Forty Four", "Forty Five", "Forty Six", "Forty Seven", "Forty Eight",
case 3: "Forty Nine", "Fifty"};
return "Three";
break; if(_t <= BIGGEST_SMALL_NUMBER) {
case 4: return smallnumbers[_t];
return "Four";
break;
case 5:
return "Five";
break;
case 6:
return "Six";
break;
case 7:
return "Seven";
break;
case 8:
return "Eight";
break;
case 9:
return "Nine";
break;
case 10:
return "Ten";
break;
case 11:
return "Eleven";
break;
case 12:
return "Twelve";
break;
case 13:
return "Thirteen";
break;
case 14:
return "Fourteen";
break;
case 15:
return "Fifteen";
break;
case 16:
return "Sixteen";
break;
case 17:
return "Seventeen";
break;
case 18:
return "Eighteen";
break;
case 19:
return "Nineteen";
break;
case 20:
return "Twenty";
break;
case 21:
return "Twenty One";
break;
case 22:
return "Twenty Two";
break;
case 23:
return "Twenty Three";
break;
case 24:
return "Twenty Four";
break;
case 25:
return "Twenty Five";
break;
case 26:
return "Twenty Six";
break;
case 27:
return "Twenty Seven";
break;
case 28:
return "Twenty Eight";
break;
case 29:
return "Twenty Nine";
break;
case 30:
return "Thirty";
break;
case 31:
return "Thirty One";
break;
case 32:
return "Thirty Two";
break;
case 33:
return "Thirty Three";
break;
case 34:
return "Thirty Four";
break;
case 35:
return "Thirty Five";
break;
case 36:
return "Thirty Six";
break;
case 37:
return "Thirty Seven";
break;
case 38:
return "Thirty Eight";
break;
case 39:
return "Thirty Nine";
break;
case 40:
return "Forty";
break;
case 41:
return "Forty One";
break;
case 42:
return "Forty Two";
break;
case 43:
return "Forty Three";
break;
case 44:
return "Forty Four";
break;
case 45:
return "Forty Five";
break;
case 46:
return "Forty Six";
break;
case 47:
return "Forty Seven";
break;
case 48:
return "Forty Eight";
break;
case 49:
return "Forty Nine";
break;
case 50:
return "Fifty";
break;
} }
return "Lots"; return "Lots";
} }