ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/info.C
(Generate patch)

Comparing deliantra/server/common/info.C (file contents):
Revision 1.4 by root, Sun Sep 10 16:00:23 2006 UTC vs.
Revision 1.11 by pippijn, Mon Jan 15 21:06:18 2007 UTC

1
2/* 1/*
3 * static char *rcsid_info_c = 2 * CrossFire, A Multiplayer game for X-windows
4 * "$Id: info.C,v 1.4 2006/09/10 16:00:23 root Exp $"; 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
5 * Copyright (C) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (C) 1992 Frank Tore Johansen
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * The authors can be reached via e-mail at <crossfire@schmorp.de>
5 */ 23 */
6
7/*
8 CrossFire, A Multiplayer game for X-windows
9
10 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
11 Copyright (C) 1992 Frank Tore Johansen
12
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 The authors can be reached via e-mail at crossfire-devel@real-time.com
28*/
29 24
30#include <global.h> 25#include <global.h>
31 26
32/* 27/*
33 * The functions in this file are purely mean to generate information 28 * The functions in this file are purely mean to generate information
64 break; 59 break;
65 } 60 }
66 } 61 }
67 62
68 ch = describe_item (&at->clone, NULL); 63 ch = describe_item (&at->clone, NULL);
69#ifndef WIN32
70 printf ("%-16s|%6lld|%4d|%3d|%s|%s|%s\n", &at->clone.name, (long long) at->clone.stats.exp, 64 printf ("%-16s|%6lld|%4d|%3d|%s|%s|%s\n", &at->clone.name, (long long) at->clone.stats.exp,
71 at->clone.stats.hp, at->clone.stats.ac, ch, &at->name, gen_name); 65 at->clone.stats.hp, at->clone.stats.ac, ch, &at->name, gen_name);
72#else
73 printf ("%-16s|%6I64d|%4d|%3d|%s|%s|%s\n", &at->clone.name, (long long) at->clone.stats.exp,
74 at->clone.stats.hp, at->clone.stats.ac, ch, &at->name, gen_name);
75#endif
76 } 66 }
77} 67}
78 68
79/* 69/*
80 * As dump_abilities(), but with an alternative way of output. 70 * As dump_abilities(), but with an alternative way of output.
95 printf 85 printf
96 ("---------------------------------------------------------------------------------------------------------------------------------------------------\n"); 86 ("---------------------------------------------------------------------------------------------------------------------------------------------------\n");
97 for (at = first_archetype; at != NULL; at = at->next) 87 for (at = first_archetype; at != NULL; at = at->next)
98 { 88 {
99 op = arch_to_object (at); 89 op = arch_to_object (at);
90
100 if (QUERY_FLAG (op, FLAG_MONSTER)) 91 if (QUERY_FLAG (op, FLAG_MONSTER))
101 { 92 {
102 bitstostring ((long) op->attacktype, NROFATTACKS, attbuf); 93 bitstostring ((long) op->attacktype, NROFATTACKS, attbuf);
103 printf ("%-15s|%5d|%3d|%4d|%4d|%s|", &op->arch->name, op->stats.maxhp, op->stats.dam, op->stats.ac, op->stats.wc, attbuf); 94 printf ("%-15s|%5d|%3d|%4d|%4d|%s|", &op->arch->name, op->stats.maxhp, op->stats.dam, op->stats.ac, op->stats.wc, attbuf);
104 for (i = 0; i < NROFATTACKS; i++) 95 for (i = 0; i < NROFATTACKS; i++)
105 printf ("%4d", op->resist[i]); 96 printf ("%4d", op->resist[i]);
106 printf ("|%8lld|%9d|\n", (long long) op->stats.exp, new_exp (op)); 97 printf ("|%8lld|%9d|\n", (long long) op->stats.exp, new_exp (op));
107 } 98 }
108 free_object (op); 99
100 op->destroy ();
109 } 101 }
110} 102}
111 103
112/* 104/*
113 * Writes <num> ones and zeros to the given string based on the 105 * Writes <num> ones and zeros to the given string based on the
127 if (i && (i % 3) == 0) 119 if (i && (i % 3) == 0)
128 { 120 {
129 str[i + j] = ' '; 121 str[i + j] = ' ';
130 j++; 122 j++;
131 } 123 }
124
132 if (bits & 1) 125 if (bits & 1)
133 str[i + j] = '1'; 126 str[i + j] = '1';
134 else 127 else
135 str[i + j] = '0'; 128 str[i + j] = '0';
129
136 bits >>= 1; 130 bits >>= 1;
137 } 131 }
132
138 str[i + j] = '\0'; 133 str[i + j] = '\0';
139 return;
140} 134}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines