--- deliantra/server/common/compat.C 2010/04/29 15:49:04 1.10 +++ deliantra/server/common/compat.C 2010/04/29 15:59:09 1.11 @@ -36,7 +36,6 @@ #include "define.h" #include "path.h" - /* buf_overflow() - we don't want to exceed the buffer size of * buf1 by adding on buf2! Returns true if overflow will occur. */ @@ -60,20 +59,6 @@ ///////////////////////////////////////////////////////////////////////////// /* - * fatal() is meant to be called whenever a fatal signal is intercepted. - * It will call the emergency_save and the clean_tmp_files functions. - */ -//TODO: only one caller left -void -fatal (const char *msg) -{ - LOG (llevError, "FATAL: %s\n", msg); - cleanup (msg, 1); -} - -///////////////////////////////////////////////////////////////////////////// - -/* * The random functions here take luck into account when rolling random * dice or numbers. This function has less of an impact the larger the * difference becomes in the random numbers. IE, the effect is lessened @@ -89,7 +74,7 @@ * not the recipient (ie, the poor slob getting hit). [garbled 20010916] */ int -random_roll (int r_min, int r_max, const object *op, int goodbad) +random_roll (int r_min, int r_max, const object *op, bool prefer_high) { r_max = max (r_min, r_max); @@ -113,7 +98,7 @@ * for exp loss calculations for players changing religions. */ sint64 -random_roll64 (sint64 r_min, sint64 r_max, const object *op, int goodbad) +random_roll64 (sint64 r_min, sint64 r_max, const object *op, bool prefer_high) { sint64 omin = r_min; sint64 range = max (0, r_max - r_min + 1); @@ -138,10 +123,10 @@ if (range < 1) return omin; /*check again */ - if (goodbad) + if (prefer_high) r_min += luck; - return (max (omin, min (r_max, (ran % range) + r_min))); + return clamp (ran % range + r_min, omin, r_max); } } @@ -156,7 +141,7 @@ * The args are num D size (ie 4d6) [garbled 20010916] */ int -die_roll (int num, int size, const object *op, int goodbad) +die_roll (int num, int size, const object *op, bool prefer_high) { int min_roll, luck, total, i, gotlucky; @@ -184,7 +169,7 @@ diff -= luck; if (diff < 1) return (num); /*check again */ - ((goodbad) ? (min_roll += luck) : (diff)); + ((prefer_high) ? (min_roll += luck) : (diff)); total += max (1, min (size, rndm (diff) + min_roll)); } else