summaryrefslogtreecommitdiff
path: root/src/utility.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utility.h')
-rw-r--r--src/utility.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utility.h b/src/utility.h
index 4178e9d95..e6a09547b 100644
--- a/src/utility.h
+++ b/src/utility.h
@@ -603,5 +603,15 @@ inline bool is_yes(std::string s)
return false;
}
+inline s32 stoi(std::string s, s32 min, s32 max)
+{
+ s32 i = atoi(s.c_str());
+ if(i < min)
+ i = min;
+ if(i > max)
+ i = max;
+ return i;
+}
+
#endif