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 |
… | |
… | |
43 | { |
38 | { |
44 | archetype *at; |
39 | archetype *at; |
45 | |
40 | |
46 | for (at = first_archetype; at; at = at->next) |
41 | for (at = first_archetype; at; at = at->next) |
47 | { |
42 | { |
48 | char *ch; |
43 | const char *ch; |
49 | const char *gen_name = ""; |
44 | const char *gen_name = ""; |
50 | archetype *gen; |
45 | archetype *gen; |
51 | |
46 | |
52 | if (!QUERY_FLAG (&at->clone, FLAG_MONSTER)) |
47 | if (!QUERY_FLAG (&at->clone, FLAG_MONSTER)) |
53 | continue; |
48 | continue; |
… | |
… | |
55 | /* Get rid of e.g. multiple black puddings */ |
50 | /* Get rid of e.g. multiple black puddings */ |
56 | if (QUERY_FLAG (&at->clone, FLAG_CHANGING)) |
51 | if (QUERY_FLAG (&at->clone, FLAG_CHANGING)) |
57 | continue; |
52 | continue; |
58 | |
53 | |
59 | for (gen = first_archetype; gen; gen = gen->next) |
54 | for (gen = first_archetype; gen; gen = gen->next) |
60 | { |
|
|
61 | if (gen->clone.other_arch && gen->clone.other_arch == at) |
55 | if (gen->clone.other_arch && gen->clone.other_arch == at) |
62 | { |
56 | { |
63 | gen_name = gen->name; |
57 | gen_name = gen->name; |
64 | break; |
58 | break; |
65 | } |
59 | } |
66 | } |
|
|
67 | |
60 | |
68 | ch = describe_item (&at->clone, NULL); |
61 | 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, |
62 | 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); |
63 | 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 | } |
64 | } |
77 | } |
65 | } |
78 | |
66 | |
79 | /* |
67 | /* |
80 | * As dump_abilities(), but with an alternative way of output. |
68 | * As dump_abilities(), but with an alternative way of output. |
… | |
… | |
95 | printf |
83 | printf |
96 | ("---------------------------------------------------------------------------------------------------------------------------------------------------\n"); |
84 | ("---------------------------------------------------------------------------------------------------------------------------------------------------\n"); |
97 | for (at = first_archetype; at != NULL; at = at->next) |
85 | for (at = first_archetype; at != NULL; at = at->next) |
98 | { |
86 | { |
99 | op = arch_to_object (at); |
87 | op = arch_to_object (at); |
|
|
88 | |
100 | if (QUERY_FLAG (op, FLAG_MONSTER)) |
89 | if (QUERY_FLAG (op, FLAG_MONSTER)) |
101 | { |
90 | { |
102 | bitstostring ((long) op->attacktype, NROFATTACKS, attbuf); |
91 | 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); |
92 | 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++) |
93 | for (i = 0; i < NROFATTACKS; i++) |
105 | printf ("%4d", op->resist[i]); |
94 | printf ("%4d", op->resist[i]); |
106 | printf ("|%8lld|%9d|\n", (long long) op->stats.exp, new_exp (op)); |
95 | printf ("|%8lld|%9d|\n", (long long) op->stats.exp, new_exp (op)); |
107 | } |
96 | } |
108 | free_object (op); |
97 | |
|
|
98 | op->destroy (); |
109 | } |
99 | } |
110 | } |
100 | } |
111 | |
101 | |
112 | /* |
102 | /* |
113 | * Writes <num> ones and zeros to the given string based on the |
103 | * Writes <num> ones and zeros to the given string based on the |
… | |
… | |
127 | if (i && (i % 3) == 0) |
117 | if (i && (i % 3) == 0) |
128 | { |
118 | { |
129 | str[i + j] = ' '; |
119 | str[i + j] = ' '; |
130 | j++; |
120 | j++; |
131 | } |
121 | } |
|
|
122 | |
132 | if (bits & 1) |
123 | if (bits & 1) |
133 | str[i + j] = '1'; |
124 | str[i + j] = '1'; |
134 | else |
125 | else |
135 | str[i + j] = '0'; |
126 | str[i + j] = '0'; |
|
|
127 | |
136 | bits >>= 1; |
128 | bits >>= 1; |
137 | } |
129 | } |
|
|
130 | |
138 | str[i + j] = '\0'; |
131 | str[i + j] = '\0'; |
139 | return; |
|
|
140 | } |
132 | } |