--- deliantra/server/common/compat.C 2009/11/06 13:07:28 1.3 +++ deliantra/server/common/compat.C 2010/04/04 04:59:20 1.8 @@ -1,9 +1,9 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team - * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team - * Copyright (©) 1992,2007 Frank Tore Johansen + * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2002 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992 Frank Tore Johansen * * Deliantra is free software: you can redistribute it and/or modify it under * the terms of the Affero GNU General Public License as published by the @@ -59,22 +59,16 @@ ///////////////////////////////////////////////////////////////////////////// -static const char *const fatalmsgs[80] = { - "Failed to allocate memory", - "Failed repeatedly to load maps", - "Hashtable for archetypes is too small", - "Too many errors" -}; - /* * 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 (int err) +fatal (const char *msg) { - LOG (llevError, "Fatal: %s\n", fatalmsgs [err]); - cleanup (fatalmsgs[err], 1); + LOG (llevError, "FATAL: %s\n", msg); + cleanup (msg, 1); } ///////////////////////////////////////////////////////////////////////////// @@ -162,10 +156,10 @@ int die_roll (int num, int size, const object *op, int goodbad) { - int min, luck, total, i, gotlucky; + int min_roll, luck, total, i, gotlucky; int diff = size; - min = 1; + min_roll = 1; luck = total = gotlucky = 0; int base = diff > 2 ? 20 : 50; /* d2 and d3 are corner cases */ @@ -180,7 +174,7 @@ for (i = 0; i < num; i++) { - if (rndm (base) < MIN (10, abs (luck)) && !gotlucky) + if (rndm (base) < min (10, abs (luck)) && !gotlucky) { /* we have a winner */ gotlucky++; @@ -188,8 +182,8 @@ diff -= luck; if (diff < 1) return (num); /*check again */ - ((goodbad) ? (min += luck) : (diff)); - total += MAX (1, MIN (size, rndm (diff) + min)); + ((goodbad) ? (min_roll += luck) : (diff)); + total += max (1, min (size, rndm (diff) + min_roll)); } else total += rndm (size) + 1;