aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/serialize.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/serialize.h b/src/util/serialize.h
index 15bdd050d..2203fff0c 100644
--- a/src/util/serialize.h
+++ b/src/util/serialize.h
@@ -439,6 +439,18 @@ MAKE_STREAM_WRITE_FXN(video::SColor, ARGB8, 4);
//// More serialization stuff
////
+inline void clampToF1000(float &v)
+{
+ v = core::clamp(v, F1000_MIN, F1000_MAX);
+}
+
+inline void clampToF1000(v3f &v)
+{
+ clampToF1000(v.X);
+ clampToF1000(v.Y);
+ clampToF1000(v.Z);
+}
+
// Creates a string with the length as the first two bytes
std::string serializeString16(const std::string &plain);