summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/makeitem.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-05-04 10:04:15 -0400
committerNeil Moore <neil@s-z.org>2014-05-04 10:06:22 -0400
commitab64676620a10b3bfd69cc55c2e66dfe6ee6ef46 (patch)
tree2253b3565bb708987ad716b4c5cf42b0e15d9378 /crawl-ref/source/makeitem.cc
parent153a95ed1777392a10c4324353197aa3e154f288 (diff)
downloadcrawl-ref-ab64676620a10b3bfd69cc55c2e66dfe6ee6ef46.tar.gz
crawl-ref-ab64676620a10b3bfd69cc55c2e66dfe6ee6ef46.zip
Correct potion colours on TAG_MAJOR_VERSION bump.
Diffstat (limited to 'crawl-ref/source/makeitem.cc')
-rw-r--r--crawl-ref/source/makeitem.cc55
1 files changed, 14 insertions, 41 deletions
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 0fb43a92f9..31ce45ea19 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -247,6 +247,19 @@ void item_colour(item_def &item)
if (is_unrandom_artefact(item) && !is_randapp_artefact(item))
return; // unrandarts have already been coloured
+ static const COLORS potion_colours[] =
+ {
+#if TAG_MAJOR_VERSION == 34
+ // clear
+ LIGHTGREY,
+#endif
+ // blue, black, silvery, cyan, purple, orange
+ BLUE, LIGHTGREY, WHITE, CYAN, MAGENTA, LIGHTRED,
+ // inky, red, yellow, green, brown, pink, white
+ BLUE, RED, YELLOW, GREEN, BROWN, LIGHTMAGENTA, WHITE
+ };
+ COMPILE_CHECK(ARRAYSZ(potion_colours) == NDSC_POT_PRI);
+
int switchnum = 0;
colour_t temp_value;
@@ -347,47 +360,7 @@ void item_colour(item_def &item)
case OBJ_POTIONS:
item.plus = you.item_description[IDESC_POTIONS][item.sub_type];
-
- switch (item.plus % NDSC_POT_PRI)
- {
- case 0: //"clear potion"
- case 2: //"black potion"
- default:
- item.colour = LIGHTGREY;
- break;
- case 1: //"blue potion"
- case 7: //"inky potion"
- item.colour = BLUE;
- break;
- case 3: //"silvery potion"
- case 13: //"white potion"
- item.colour = WHITE;
- break;
- case 4: //"cyan potion"
- item.colour = CYAN;
- break;
- case 5: //"purple potion"
- item.colour = MAGENTA;
- break;
- case 6: //"orange potion"
- item.colour = LIGHTRED;
- break;
- case 8: //"red potion"
- item.colour = RED;
- break;
- case 9: //"yellow potion"
- item.colour = YELLOW;
- break;
- case 10: //"green potion"
- item.colour = GREEN;
- break;
- case 11: //"brown potion"
- item.colour = BROWN;
- break;
- case 12: //"pink potion"
- item.colour = LIGHTMAGENTA;
- break;
- }
+ item.colour = potion_colours[item.plus % NDSC_POT_PRI];
break;
case OBJ_FOOD: