From d27a3955f05427762f1d3bce71b07b682bfc36b1 Mon Sep 17 00:00:00 2001 From: Nay Date: Sat, 6 Oct 2012 16:55:01 +0100 Subject: Core/Misc: Tabs to spaces and whitespace cleanup --- src/server/shared/Utilities/Util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/shared') diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index 21aaa36498d..f84e5155bb1 100755 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -31,7 +31,7 @@ template struct Finder { T val_; T S::* idMember_; - + Finder(T val, T S::* idMember) : val_(val), idMember_(idMember) {} bool operator()(const std::pair &obj) { return obj.second.*idMember_ == val_; } }; -- cgit v1.2.3 From 99175e066cf6db38853b5d7cb5b08a8e0bd8be24 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 7 Oct 2012 12:55:51 +0100 Subject: Core/Utils: Add asserts to irand, urand and frand max should always be higher or equal than min notice that SFMT was already covering these cases and it would return 0, -1 or min --- src/server/shared/Utilities/Util.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/server/shared') diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index 9778e86d444..0897c8814ab 100755 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -28,16 +28,19 @@ static SFMTRandTSS sfmtRand; int32 irand(int32 min, int32 max) { + assert(max >= min); return int32(sfmtRand->IRandom(min, max)); } uint32 urand(uint32 min, uint32 max) { + assert(max >= min); return sfmtRand->URandom(min, max); } float frand(float min, float max) { + assert(max >= min); return float(sfmtRand->Random() * (max - min) + min); } -- cgit v1.2.3