summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/store.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-11-12 07:23:05 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-11-12 07:27:19 +0100
commit6d5756594c59a11fc09ffce9465cd25e8f697bc3 (patch)
tree7e1232a922af45086a07e75062cc6dcc75f5cbd3 /crawl-ref/source/store.cc
parent41c3f7e50b1f5917aa9b05b327d4d47c3bdd2d23 (diff)
downloadcrawl-ref-6d5756594c59a11fc09ffce9465cd25e8f697bc3.tar.gz
crawl-ref-6d5756594c59a11fc09ffce9465cd25e8f697bc3.zip
Fix handling of hash tables bigger than 65535 elements.
You can get to 2147483647 if you wish. I added no range check -- 2147483647 should be enough for anybody, right? At least the old limit of 255 did not cause problems in cases that weren't broken for other reasons already.
Diffstat (limited to 'crawl-ref/source/store.cc')
-rw-r--r--crawl-ref/source/store.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/crawl-ref/source/store.cc b/crawl-ref/source/store.cc
index 6ed9be8381..a319c49692 100644
--- a/crawl-ref/source/store.cc
+++ b/crawl-ref/source/store.cc
@@ -1309,13 +1309,13 @@ void CrawlHashTable::read(reader &th)
ASSERT(empty());
#if TAG_MAJOR_VERSION == 34
- hash_size _size;
+ unsigned int _size;
if (th.getMinorVersion() < TAG_MINOR_16_BIT_TABLE)
- _size = (hash_size) unmarshallByte(th);
+ _size = unmarshallByte(th);
else
- _size = (hash_size) unmarshallUnsigned(th);
+ _size = unmarshallUnsigned(th);
#else
- hash_size _size = (hash_size) unmarshallUnsigned(th);
+ unsigned int _size = unmarshallUnsigned(th);
#endif
if (_size == 0)
@@ -1323,7 +1323,7 @@ void CrawlHashTable::read(reader &th)
init_hash_map();
- for (hash_size i = 0; i < _size; i++)
+ for (unsigned int i = 0; i < _size; i++)
{
string key = unmarshallString(th);
CrawlStoreValue &val = (*this)[key];
@@ -1467,7 +1467,7 @@ const CrawlStoreValue& CrawlHashTable::get_value(const string &key) const
///////////////////////////
// std::map style interface
-hash_size CrawlHashTable::size() const
+unsigned int CrawlHashTable::size() const
{
if (hash_map == NULL)
return 0;