--- deliantra/server/common/info.C 2006/08/29 08:01:35 1.2 +++ deliantra/server/common/info.C 2007/01/06 14:42:28 1.10 @@ -1,11 +1,7 @@ /* - * static char *rcsid_info_c = - * "$Id: info.C,v 1.2 2006/08/29 08:01:35 root Exp $"; - */ - -/* CrossFire, A Multiplayer game for X-windows + Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team Copyright (C) 2002 Mark Wedel & Crossfire Development Team Copyright (C) 1992 Frank Tore Johansen @@ -23,7 +19,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - The authors can be reached via e-mail at crossfire-devel@real-time.com + The authors can be reached via e-mail at */ #include @@ -37,64 +33,72 @@ * Dump to standard out the abilities of all monsters. */ -void dump_abilities(void) { +void +dump_abilities (void) +{ archetype *at; - for(at = first_archetype; at; at=at->next) { - char *ch; - const char *gen_name = ""; - archetype *gen; - - if(!QUERY_FLAG(&at->clone,FLAG_MONSTER)) - continue; - - /* Get rid of e.g. multiple black puddings */ - if (QUERY_FLAG(&at->clone,FLAG_CHANGING)) - continue; - - for (gen = first_archetype; gen; gen = gen->next) { - if (gen->clone.other_arch && gen->clone.other_arch == at) { - gen_name = gen->name; - break; - } - } - ch = describe_item(&at->clone, NULL); -#ifndef WIN32 - printf("%-16s|%6lld|%4d|%3d|%s|%s|%s\n",at->clone.name,at->clone.stats.exp, - at->clone.stats.hp,at->clone.stats.ac,ch,at->name,gen_name); -#else - printf("%-16s|%6I64d|%4d|%3d|%s|%s|%s\n",at->clone.name,at->clone.stats.exp, - at->clone.stats.hp,at->clone.stats.ac,ch,at->name,gen_name); -#endif - } + for (at = first_archetype; at; at = at->next) + { + char *ch; + const char *gen_name = ""; + archetype *gen; + + if (!QUERY_FLAG (&at->clone, FLAG_MONSTER)) + continue; + + /* Get rid of e.g. multiple black puddings */ + if (QUERY_FLAG (&at->clone, FLAG_CHANGING)) + continue; + + for (gen = first_archetype; gen; gen = gen->next) + { + if (gen->clone.other_arch && gen->clone.other_arch == at) + { + gen_name = gen->name; + break; + } + } + + ch = describe_item (&at->clone, NULL); + printf ("%-16s|%6lld|%4d|%3d|%s|%s|%s\n", &at->clone.name, (long long) at->clone.stats.exp, + at->clone.stats.hp, at->clone.stats.ac, ch, &at->name, gen_name); + } } /* * As dump_abilities(), but with an alternative way of output. */ -void print_monsters(void) { - archetype *at; - object *op; - char attbuf[34]; - int i; - - printf(" | | | | | attack | resistances |\n"); - printf("monster | hp |dam| ac | wc |pmf ecw adw gpd ptf|phy mag fir ele cld cfs acd drn wmg ght poi slo par tud fer cnc dep dth chs csp gpw hwd bln int | exp | new exp |\n"); - printf("---------------------------------------------------------------------------------------------------------------------------------------------------\n"); - for(at=first_archetype;at!=NULL;at=at->next) { - op = arch_to_object(at); - if (QUERY_FLAG(op,FLAG_MONSTER)) { - bitstostring((long)op->attacktype, NROFATTACKS, attbuf); - printf("%-15s|%5d|%3d|%4d|%4d|%s|", - op->arch->name, op->stats.maxhp, op->stats.dam, op->stats.ac, - op->stats.wc,attbuf); - for (i=0; iresist[i]); - printf("|%8lld|%9d|\n",op->stats.exp, new_exp(op)); +void +print_monsters (void) +{ + archetype *at; + object *op; + char attbuf[34]; + int i; + + printf + (" | | | | | attack | resistances |\n"); + printf + ("monster | hp |dam| ac | wc |pmf ecw adw gpd ptf|phy mag fir ele cld cfs acd drn wmg ght poi slo par tud fer cnc dep dth chs csp gpw hwd bln int | exp | new exp |\n"); + printf + ("---------------------------------------------------------------------------------------------------------------------------------------------------\n"); + for (at = first_archetype; at != NULL; at = at->next) + { + op = arch_to_object (at); + + if (QUERY_FLAG (op, FLAG_MONSTER)) + { + bitstostring ((long) op->attacktype, NROFATTACKS, attbuf); + printf ("%-15s|%5d|%3d|%4d|%4d|%s|", &op->arch->name, op->stats.maxhp, op->stats.dam, op->stats.ac, op->stats.wc, attbuf); + for (i = 0; i < NROFATTACKS; i++) + printf ("%4d", op->resist[i]); + printf ("|%8lld|%9d|\n", (long long) op->stats.exp, new_exp (op)); + } + + op->destroy (); } - free_object(op); - } } /* @@ -102,24 +106,29 @@ * variable. */ -void bitstostring(long bits, int num, char *str) +void +bitstostring (long bits, int num, char *str) { - int i,j=0; + int i, j = 0; if (num > 32) num = 32; - for (i=0;i>= 1; } - if (bits&1) - str[i+j] = '1'; - else - str[i+j] = '0'; - bits >>= 1; - } - str[i+j] = '\0'; - return; + + str[i + j] = '\0'; }