summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_crawl.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-03-29 07:34:01 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-03-29 07:34:01 +0100
commit561403f68198fc73e92acd5149eb876e4ffac9e3 (patch)
tree18e8578be72220803d5d90806a7ba317bfd2cf02 /crawl-ref/source/l_crawl.cc
parent4bdaa9d9e36921ca559b29fd517e7c49d4acb33d (diff)
downloadcrawl-ref-561403f68198fc73e92acd5149eb876e4ffac9e3.tar.gz
crawl-ref-561403f68198fc73e92acd5149eb876e4ffac9e3.zip
Hush an -Og warning.
It's non-obvious that dims will never be more than 4. Even if at higher optimization numbers the compiler notices this, I as a human still failed to do so after first two readings.
Diffstat (limited to 'crawl-ref/source/l_crawl.cc')
-rw-r--r--crawl-ref/source/l_crawl.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/crawl-ref/source/l_crawl.cc b/crawl-ref/source/l_crawl.cc
index 7412bb98a6..fd6e63ea63 100644
--- a/crawl-ref/source/l_crawl.cc
+++ b/crawl-ref/source/l_crawl.cc
@@ -724,8 +724,8 @@ static int crawl_simplex(lua_State *ls)
}
double result;
- if (dims < 2) return 0; // TODO: Throw error?
- switch (dims) {
+ switch (dims)
+ {
case 2:
result = perlin::noise(vals[0],vals[1]);
break;
@@ -735,6 +735,8 @@ static int crawl_simplex(lua_State *ls)
case 4:
result = perlin::noise(vals[0],vals[1],vals[2],vals[3]);
break;
+ default:
+ return 0; // TODO: Throw error?
}
lua_pushnumber(ls, result);