1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Sanitize player position and speed server-side (#12396)

This commit is contained in:
sfan5 2022-06-07 21:27:05 +02:00 committed by GitHub
parent 3107c98591
commit 3ac5a24b12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 6 deletions

View file

@ -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);