diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-06-18 02:38:23 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-06-18 02:38:23 +0200 |
commit | f328e76b16b61fe3e3bd33a527ae2d49038fa57d (patch) | |
tree | 883f95acbb6fba41c0f1a544ba209e50f934da3a /crawl-ref/source/l_item.cc | |
parent | 9db3168f752c9561da776c7b1054dae7ddd27f64 (diff) | |
download | crawl-ref-f328e76b16b61fe3e3bd33a527ae2d49038fa57d.tar.gz crawl-ref-f328e76b16b61fe3e3bd33a527ae2d49038fa57d.zip |
Check the count of rings and amulets in l_item.cc
jewellery_type_name doesn't have an array to expose, would need to fix it
later.
Diffstat (limited to 'crawl-ref/source/l_item.cc')
-rw-r--r-- | crawl-ref/source/l_item.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crawl-ref/source/l_item.cc b/crawl-ref/source/l_item.cc index 5c7329815c..bfaa511e8b 100644 --- a/crawl-ref/source/l_item.cc +++ b/crawl-ref/source/l_item.cc @@ -298,12 +298,14 @@ static const char *amulet_types[] = { "rage", "clarity", "warding", "resist corrosion", "gourmand", "conservation", "controlled flight", "inaccuracy", - "resist mutation", "guardian spirit", "faith", "stasis" + "resist mutation", "guardian spirit", "faith", "stasis", }; static int l_item_do_subtype (lua_State *ls) { UDATA_ITEM(item); + COMPILE_CHECK(ARRAYSZ(ring_types) == NUM_RINGS); + COMPILE_CHECK(ARRAYSZ(amulet_types) == NUM_JEWELLERY - AMU_FIRST_AMULET); if (item) { @@ -315,7 +317,7 @@ static int l_item_do_subtype (lua_State *ls) if (item->base_type == OBJ_JEWELLERY) { if (jewellery_is_amulet(*item)) - s = amulet_types[ item->sub_type - AMU_RAGE ]; + s = amulet_types[item->sub_type - AMU_FIRST_AMULET]; else s = ring_types[item->sub_type]; } |