… | |
… | |
71 | static char numbers_10[10][20] = { |
71 | static char numbers_10[10][20] = { |
72 | "zero", "ten", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", |
72 | "zero", "ten", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", |
73 | "eighty", "ninety" |
73 | "eighty", "ninety" |
74 | }; |
74 | }; |
75 | |
75 | |
76 | static char levelnumbers[21][20] = { |
76 | static char ordnumbers[21][20] = { |
77 | "zeroth", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", |
77 | "zeroth", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", |
78 | "eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth", |
78 | "eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth", |
79 | "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteen", |
79 | "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", |
80 | "nineteen", "twentieth" |
80 | "nineteenth", "twentieth" |
81 | }; |
81 | }; |
82 | |
82 | |
83 | static char levelnumbers_10[11][20] = { |
83 | static char ordnumbers_10[11][20] = { |
84 | "zeroth", "tenth", "twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", |
84 | "zeroth", "tenth", "twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", |
85 | "seventieth", "eightieth", "ninetieth" |
85 | "seventieth", "eightieth", "ninetieth" |
86 | }; |
86 | }; |
87 | |
87 | |
88 | /* The following is a large table of item types, the fields are: |
88 | /* The following is a large table of item types, the fields are: |
… | |
… | |
151 | {EXIT, "exit", "exits", 0, 0}, |
151 | {EXIT, "exit", "exits", 0, 0}, |
152 | {ENCOUNTER, "encounter", "encounters", 0, 0}, |
152 | {ENCOUNTER, "encounter", "encounters", 0, 0}, |
153 | {SHOP_FLOOR, "shop floor", "shop floors", 0, 0}, |
153 | {SHOP_FLOOR, "shop floor", "shop floors", 0, 0}, |
154 | {SHOP_MAT, "shop mat", "shop mats", 0, 0}, |
154 | {SHOP_MAT, "shop mat", "shop mats", 0, 0}, |
155 | {RING, "ring", "rings", SK_JEWELER, 0}, |
155 | {RING, "ring", "rings", SK_JEWELER, 0}, |
156 | {FLOOR, "floor", "floors", 0, 0}, |
156 | // {FLOOR, "floor", "floors", 0, 0}, |
157 | {FLESH, "flesh", "flesh", SK_WOODSMAN, 0}, |
157 | {FLESH, "flesh", "flesh", SK_WOODSMAN, 0}, |
158 | {INORGANIC, "inorganic", "inorganics", SK_ALCHEMY, 0}, |
158 | {INORGANIC, "inorganic", "inorganics", SK_ALCHEMY, 0}, |
159 | {SKILL_TOOL, "skill tool", "skill tools", 0, 0}, |
159 | {SKILL_TOOL, "skill tool", "skill tools", 0, 0}, |
160 | {LIGHTER, "lighter", "lighters", 0, 0}, |
160 | {LIGHTER, "lighter", "lighters", 0, 0}, |
161 | {BUILDABLE_WALL, "buildable wall", "buildable walls", 0, 0}, |
161 | {BUILDABLE_WALL, "buildable wall", "buildable walls", 0, 0}, |
… | |
… | |
387 | /* |
387 | /* |
388 | * Returns the pointer to a static buffer containing |
388 | * Returns the pointer to a static buffer containing |
389 | * the number requested (of the form first, second, third...) |
389 | * the number requested (of the form first, second, third...) |
390 | */ |
390 | */ |
391 | const char * |
391 | const char * |
392 | get_levelnumber (int i) |
392 | ordinal (int i) |
393 | { |
393 | { |
394 | static char buf[MAX_BUF]; |
394 | if (i < 0) |
395 | |
395 | return format ("minus %s", ordinal (-i)); |
396 | if (i > 99) |
|
|
397 | { |
|
|
398 | sprintf (buf, "%d.", i); |
|
|
399 | return buf; |
|
|
400 | } |
|
|
401 | |
396 | |
402 | if (i < 21) |
397 | if (i < 21) |
403 | return levelnumbers[i]; |
398 | return ordnumbers[i]; |
404 | |
399 | |
|
|
400 | int digit = i % 10; |
|
|
401 | |
405 | if (!(i % 10)) |
402 | if (i >= 100) |
|
|
403 | return format ( |
|
|
404 | digit == 1 ? "%dst" |
|
|
405 | : digit == 2 ? "%dnd" |
|
|
406 | : digit == 3 ? "%drd" |
|
|
407 | : "%dth", |
|
|
408 | i |
|
|
409 | ); |
|
|
410 | |
|
|
411 | if (digit == 0) |
406 | return levelnumbers_10[i / 10]; |
412 | return ordnumbers_10[i / 10]; |
407 | |
413 | else |
408 | strcpy (buf, numbers_10[i / 10]); |
414 | return format ("%s%s", numbers_10[i / 10], ordnumbers[i % 10]); |
409 | strcat (buf, levelnumbers[i % 10]); |
|
|
410 | return buf; |
|
|
411 | } |
415 | } |
412 | |
416 | |
413 | /* |
417 | /* |
414 | * Returns pointer to static buffer containing ring's or amulet's |
418 | * Returns pointer to static buffer containing ring's or amulet's |
415 | * abilities |
419 | * abilities |
… | |
… | |
1208 | |
1212 | |
1209 | switch (type) |
1213 | switch (type) |
1210 | { |
1214 | { |
1211 | case SPELLBOOK: |
1215 | case SPELLBOOK: |
1212 | if (flag [FLAG_IDENTIFIED] && inv) |
1216 | if (flag [FLAG_IDENTIFIED] && inv) |
1213 | buf.printf ("%s is a level %s %s spell.\r", &inv->name, get_levelnumber (inv->level), &inv->skill); |
1217 | buf.printf ("%s is a %s level %s spell.\r", &inv->name, ordinal (inv->level), &inv->skill); |
1214 | break; |
1218 | break; |
1215 | |
1219 | |
1216 | case BOOK: |
1220 | case BOOK: |
1217 | if (msg) |
1221 | if (msg) |
1218 | buf << "Something is written in it.\r"; |
1222 | buf << "Something is written in it.\r"; |
… | |
… | |
1320 | |
1324 | |
1321 | if (spell->subtype == SP_CHANGE_ABILITY) |
1325 | if (spell->subtype == SP_CHANGE_ABILITY) |
1322 | buf.printf ("\nH<The effect will last about %.10g seconds.>", |
1326 | buf.printf ("\nH<The effect will last about %.10g seconds.>", |
1323 | TICK2TIME (change_ability_duration (spell, this))); |
1327 | TICK2TIME (change_ability_duration (spell, this))); |
1324 | } |
1328 | } |
|
|
1329 | |
|
|
1330 | // some help text for skill tools |
|
|
1331 | if (type == SKILL_TOOL) |
|
|
1332 | buf << "\nH<This item is a skill tool: as long as you have this item applied " |
|
|
1333 | "you can use the " << &skill << " skill as if you had learned it.>"; |
1325 | |
1334 | |
1326 | // Display a hint about inscribable items [empty books] |
1335 | // Display a hint about inscribable items [empty books] |
1327 | // This includes the amount of text they can hold. |
1336 | // This includes the amount of text they can hold. |
1328 | if (type == INSCRIBABLE) |
1337 | if (type == INSCRIBABLE) |
1329 | { |
1338 | { |