1 | /* |
1 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
2 | * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game. |
3 | |
3 | * |
|
|
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | |
7 | * |
7 | This program is free software; you can redistribute it and/or modify |
8 | * Crossfire TRT is free software; you can redistribute it and/or modify it |
8 | it under the terms of the GNU General Public License as published by |
9 | * under the terms of the GNU General Public License as published by the Free |
9 | the Free Software Foundation; either version 2 of the License, or |
10 | * Software Foundation; either version 2 of the License, or (at your option) |
10 | (at your option) any later version. |
11 | * any later version. |
11 | |
12 | * |
12 | This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, but |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
15 | GNU General Public License for more details. |
16 | * for more details. |
16 | |
17 | * |
17 | You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License along |
18 | along with this program; if not, write to the Free Software |
19 | * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 | |
21 | * |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
22 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
22 | */ |
23 | */ |
23 | |
24 | |
24 | #include <global.h> |
25 | #include <global.h> |
25 | |
26 | |
26 | /* |
27 | /* |
27 | * The functions in this file are purely mean to generate information |
28 | * The functions in this file are purely mean to generate information |
… | |
… | |
37 | { |
38 | { |
38 | archetype *at; |
39 | archetype *at; |
39 | |
40 | |
40 | for (at = first_archetype; at; at = at->next) |
41 | for (at = first_archetype; at; at = at->next) |
41 | { |
42 | { |
42 | char *ch; |
43 | const char *ch; |
43 | const char *gen_name = ""; |
44 | const char *gen_name = ""; |
44 | archetype *gen; |
45 | archetype *gen; |
45 | |
46 | |
46 | if (!QUERY_FLAG (&at->clone, FLAG_MONSTER)) |
47 | if (!QUERY_FLAG (&at->clone, FLAG_MONSTER)) |
47 | continue; |
48 | continue; |
… | |
… | |
49 | /* Get rid of e.g. multiple black puddings */ |
50 | /* Get rid of e.g. multiple black puddings */ |
50 | if (QUERY_FLAG (&at->clone, FLAG_CHANGING)) |
51 | if (QUERY_FLAG (&at->clone, FLAG_CHANGING)) |
51 | continue; |
52 | continue; |
52 | |
53 | |
53 | for (gen = first_archetype; gen; gen = gen->next) |
54 | for (gen = first_archetype; gen; gen = gen->next) |
54 | { |
|
|
55 | if (gen->clone.other_arch && gen->clone.other_arch == at) |
55 | if (gen->clone.other_arch && gen->clone.other_arch == at) |
56 | { |
56 | { |
57 | gen_name = gen->name; |
57 | gen_name = gen->name; |
58 | break; |
58 | break; |
59 | } |
59 | } |
60 | } |
|
|
61 | |
60 | |
62 | ch = describe_item (&at->clone, NULL); |
61 | ch = describe_item (&at->clone, NULL); |
63 | #ifndef WIN32 |
|
|
64 | 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, |
65 | 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); |
66 | #else |
|
|
67 | printf ("%-16s|%6I64d|%4d|%3d|%s|%s|%s\n", &at->clone.name, (long long) at->clone.stats.exp, |
|
|
68 | at->clone.stats.hp, at->clone.stats.ac, ch, &at->name, gen_name); |
|
|
69 | #endif |
|
|
70 | } |
64 | } |
71 | } |
65 | } |
72 | |
66 | |
73 | /* |
67 | /* |
74 | * As dump_abilities(), but with an alternative way of output. |
68 | * As dump_abilities(), but with an alternative way of output. |
… | |
… | |
89 | printf |
83 | printf |
90 | ("---------------------------------------------------------------------------------------------------------------------------------------------------\n"); |
84 | ("---------------------------------------------------------------------------------------------------------------------------------------------------\n"); |
91 | for (at = first_archetype; at != NULL; at = at->next) |
85 | for (at = first_archetype; at != NULL; at = at->next) |
92 | { |
86 | { |
93 | op = arch_to_object (at); |
87 | op = arch_to_object (at); |
|
|
88 | |
94 | if (QUERY_FLAG (op, FLAG_MONSTER)) |
89 | if (QUERY_FLAG (op, FLAG_MONSTER)) |
95 | { |
90 | { |
96 | bitstostring ((long) op->attacktype, NROFATTACKS, attbuf); |
91 | bitstostring ((long) op->attacktype, NROFATTACKS, attbuf); |
97 | 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); |
98 | for (i = 0; i < NROFATTACKS; i++) |
93 | for (i = 0; i < NROFATTACKS; i++) |
99 | printf ("%4d", op->resist[i]); |
94 | printf ("%4d", op->resist[i]); |
100 | 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)); |
101 | } |
96 | } |
102 | free_object (op); |
97 | |
|
|
98 | op->destroy (); |
103 | } |
99 | } |
104 | } |
100 | } |
105 | |
101 | |
106 | /* |
102 | /* |
107 | * 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 |
… | |
… | |
121 | if (i && (i % 3) == 0) |
117 | if (i && (i % 3) == 0) |
122 | { |
118 | { |
123 | str[i + j] = ' '; |
119 | str[i + j] = ' '; |
124 | j++; |
120 | j++; |
125 | } |
121 | } |
|
|
122 | |
126 | if (bits & 1) |
123 | if (bits & 1) |
127 | str[i + j] = '1'; |
124 | str[i + j] = '1'; |
128 | else |
125 | else |
129 | str[i + j] = '0'; |
126 | str[i + j] = '0'; |
|
|
127 | |
130 | bits >>= 1; |
128 | bits >>= 1; |
131 | } |
129 | } |
|
|
130 | |
132 | str[i + j] = '\0'; |
131 | str[i + j] = '\0'; |
133 | return; |
|
|
134 | } |
132 | } |