--- deliantra/server/common/item.C 2010/04/04 02:51:56 1.79 +++ deliantra/server/common/item.C 2010/04/06 04:24:29 1.82 @@ -73,14 +73,14 @@ "eighty", "ninety" }; -static char levelnumbers[21][20] = { +static char ordnumbers[21][20] = { "zeroth", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth", - "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteen", - "nineteen", "twentieth" + "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", + "nineteenth", "twentieth" }; -static char levelnumbers_10[11][20] = { +static char ordnumbers_10[11][20] = { "zeroth", "tenth", "twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", "seventieth", "eightieth", "ninetieth" }; @@ -153,7 +153,7 @@ {SHOP_FLOOR, "shop floor", "shop floors", 0, 0}, {SHOP_MAT, "shop mat", "shop mats", 0, 0}, {RING, "ring", "rings", SK_JEWELER, 0}, - {FLOOR, "floor", "floors", 0, 0}, +// {FLOOR, "floor", "floors", 0, 0}, {FLESH, "flesh", "flesh", SK_WOODSMAN, 0}, {INORGANIC, "inorganic", "inorganics", SK_ALCHEMY, 0}, {SKILL_TOOL, "skill tool", "skill tools", 0, 0}, @@ -389,25 +389,29 @@ * the number requested (of the form first, second, third...) */ const char * -get_levelnumber (int i) +ordinal (int i) { - static char buf[MAX_BUF]; - - if (i > 99) - { - sprintf (buf, "%d.", i); - return buf; - } + if (i < 0) + return format ("minus %s", ordinal (-i)); if (i < 21) - return levelnumbers[i]; + return ordnumbers[i]; - if (!(i % 10)) - return levelnumbers_10[i / 10]; + int digit = i % 10; - strcpy (buf, numbers_10[i / 10]); - strcat (buf, levelnumbers[i % 10]); - return buf; + if (i >= 100) + return format ( + digit == 1 ? "%dst" + : digit == 2 ? "%dnd" + : digit == 3 ? "%drd" + : "%dth", + i + ); + + if (digit == 0) + return ordnumbers_10[i / 10]; + else + return format ("%s%s", numbers_10[i / 10], ordnumbers[i % 10]); } /* @@ -1210,7 +1214,7 @@ { case SPELLBOOK: if (flag [FLAG_IDENTIFIED] && inv) - buf.printf ("%s is a level %s %s spell.\r", &inv->name, get_levelnumber (inv->level), &inv->skill); + buf.printf ("%s is a %s level %s spell.\r", &inv->name, ordinal (inv->level), &inv->skill); break; case BOOK: @@ -1323,6 +1327,11 @@ TICK2TIME (change_ability_duration (spell, this))); } + // some help text for skill tools + if (type == SKILL_TOOL) + buf << "\nH"; + // Display a hint about inscribable items [empty books] // This includes the amount of text they can hold. if (type == INSCRIBABLE)