summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-book.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-10 22:15:27 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-10 22:15:27 +0000
commit8139324f50a0685218d606c7e89e44f3c3ab9da8 (patch)
treea58ee0b8c2c72abb97ead0c9c4ee43dd10c07010 /crawl-ref/source/spl-book.cc
parent677bb30a8e6bc99e66955e829329dba3f217e535 (diff)
downloadcrawl-ref-8139324f50a0685218d606c7e89e44f3c3ab9da8.tar.gz
crawl-ref-8139324f50a0685218d606c7e89e44f3c3ab9da8.zip
Fix 2800089: the standard does not guarantee that you can convert
from integer types to pointers and back. While we're at it, fix an older bug which might trigger if we ever have a platform where different pointer types have different sizes. Technically the standard does not guarantee (I think) that this isn't the case. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9947 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-book.cc')
-rw-r--r--crawl-ref/source/spl-book.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index c400cbf099..bf83e90f73 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -1523,7 +1523,7 @@ static spell_type _choose_mem_spell(spell_list &spells,
MenuEntry* me = new MenuEntry(desc.str(), MEL_ITEM, 1,
index_to_letter(i % 52));
- me->data = (void*) i;
+ me->data = &spells[i];
spell_menu.add_entry(me);
}
@@ -1539,7 +1539,7 @@ static spell_type _choose_mem_spell(spell_list &spells,
ASSERT(sel.size() == 1);
- const spell_type spell = spells[(int) sel[0]->data];
+ const spell_type spell = *static_cast<spell_type*>(sel[0]->data);
ASSERT(is_valid_spell(spell));
return (spell);