summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/store.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-06-08 20:22:21 +0200
committerAdam Borowski <kilobyte@angband.pl>2013-06-08 20:22:21 +0200
commit258af752a1d6f6dc337c97e8ceabf26bcb974f31 (patch)
treedd0a724b9c936b2fc8c497a6d8089d5afcf7c68d /crawl-ref/source/store.cc
parenta2c649a2645682eb974353707775e599f1f2ce96 (diff)
downloadcrawl-ref-258af752a1d6f6dc337c97e8ceabf26bcb974f31.tar.gz
crawl-ref-258af752a1d6f6dc337c97e8ceabf26bcb974f31.zip
Turn pairs of assertions with x > min, x <= max into ASSERT_RANGE.
The perl regexp to do so is: s&ASSERT\(([^\n]+) >= ([^\n]+)\);\s*ASSERT\(\1 < ([^\n]+)\);&ASSERT_RANGE($1, $2, $3);&sg;
Diffstat (limited to 'crawl-ref/source/store.cc')
-rw-r--r--crawl-ref/source/store.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/crawl-ref/source/store.cc b/crawl-ref/source/store.cc
index ea067115c1..b486e726f1 100644
--- a/crawl-ref/source/store.cc
+++ b/crawl-ref/source/store.cc
@@ -34,8 +34,7 @@ CrawlStoreValue::CrawlStoreValue()
CrawlStoreValue::CrawlStoreValue(const CrawlStoreValue &other)
{
- ASSERT(other.type >= SV_NONE);
- ASSERT(other.type < NUM_STORE_VAL_TYPES);
+ ASSERT_RANGE(other.type, SV_NONE, NUM_STORE_VAL_TYPES);
val.ptr = NULL;
@@ -143,8 +142,7 @@ CrawlStoreValue::CrawlStoreValue(const store_flags _flags,
const store_val_type _type)
: type(_type), flags(_flags)
{
- ASSERT(type >= SV_NONE);
- ASSERT(type < NUM_STORE_VAL_TYPES);
+ ASSERT_RANGE(type, SV_NONE, NUM_STORE_VAL_TYPES);
ASSERT(!(flags & SFLAG_UNSET));
flags |= SFLAG_UNSET;
@@ -394,8 +392,7 @@ void CrawlStoreValue::unset(bool force)
CrawlStoreValue &CrawlStoreValue::operator = (const CrawlStoreValue &other)
{
- ASSERT(other.type >= SV_NONE);
- ASSERT(other.type < NUM_STORE_VAL_TYPES);
+ ASSERT_RANGE(other.type, SV_NONE, NUM_STORE_VAL_TYPES);
ASSERT(other.type != SV_NONE || type == SV_NONE);
// NOTE: We don't bother checking SFLAG_CONST_VAL, since the
@@ -1566,8 +1563,7 @@ CrawlVector::CrawlVector(store_val_type _type, store_flags flags,
vec_size _max_size)
: type(_type), default_flags(flags), max_size(_max_size)
{
- ASSERT(type >= SV_NONE);
- ASSERT(type < NUM_STORE_VAL_TYPES);
+ ASSERT_RANGE(type, SV_NONE, NUM_STORE_VAL_TYPES);
ASSERT(!(default_flags & SFLAG_UNSET));
ASSERT(max_size > 0);
}