comparison inform.c @ 3:5a977ccbc7a9 default tip

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:29 +0000
parents
children
comparison
equal deleted inserted replaced
2:fba0b6e6cdc7 3:5a977ccbc7a9
1 /* $Id: inform.c,v 1.1.1.1 1997/12/06 05:41:29 darius Exp $ */
2
3 /*
4 * inform.c
5 */
6 #include "copyright.h"
7
8 #include <stdio.h>
9 #include <math.h>
10 #include <signal.h>
11 #include <string.h>
12 #include "Wlib.h"
13 #include "defs.h"
14 #include "struct.h"
15 #include "data.h"
16 #include "proto.h"
17 #include "gameconf.h"
18 #ifdef SOUND
19 #include "slib.h"
20 #endif
21
22 /* Display information about the nearest objext to mouse */
23
24 /*
25 ** When the player asks for info, this routine finds the object
26 ** nearest the mouse, either player or planet, and pop up a window
27 ** with the desired information in it.
28 **
29 ** We intentionally provide less information than is actually
30 ** available. Keeps the fog of war up.
31 **
32 ** There is a different sized window for each type player/planet
33 ** and we take care to keep it from extending beyond the main
34 ** window boundaries.
35 */
36
37 /* Prototypes */
38 static void inform_planet_paradise P((struct planet * k));
39 static void Info_list_normal P((struct player * j));
40 static void Info_list_paradise P((struct player * j));
41 static void Info_list_small P((struct player * j));
42 static void inform_planet_normal P((struct planet * k));
43
44 int last_key = 0;
45
46 void
47 inform(ww, x, y, key)
48 W_Window ww;
49 int x, y;
50 char key;
51 {
52 char buf[BUFSIZ];
53 int line = 0;
54 register struct player *j;
55 register struct planet *k;
56 int mx, my;
57 struct obtype *gettarget(), *target;
58 int windowWidth, windowHeight;
59
60 #ifdef SOUND
61 S_PlaySound(S_SENSORS);
62 #endif
63 mx = x;
64 my = y;
65 last_key = key;
66 if (key == 'i') {
67 target = gettarget(ww, x, y, TARG_PLAYER | TARG_SELF | TARG_ASTRAL);
68 } else if (key == 'I') {
69 target = gettarget(ww, x, y, TARG_PLAYER | TARG_SELF);
70 } else { /* control 'i' */
71 target = gettarget(ww, x, y, TARG_ASTRAL);
72 key = 'i';
73 }
74 if (target == NULL)
75 return; /* NULL returned from gettarget indicates no
76 target found. [BDyess] */
77 infomapped = 1;
78 if (keepInfo > 0 &&
79 key != 'I') /* don't blast the long window */
80 infowin_up = keepInfo;
81
82 /*
83 This is pretty lame. We make a graphics window for the info window so
84 we can accurately space the thing to barely fit into the galactic map
85 or whatever.
86 */
87
88 windowWidth = W_WindowWidth(ww);
89 windowHeight = W_WindowHeight(ww);
90 if (ww == playerw) {
91 windowWidth *= W_Textwidth;
92 windowHeight *= W_Textheight;
93 }
94 infotype = target->o_type;
95 if (target->o_type == PLAYERTYPE) {
96 /* Too close to the edge? */
97 if (mx + 23 * W_Textwidth + 2 > windowWidth)
98 mx = windowWidth - 23 * W_Textwidth - 2;
99 if (my + 8 * W_Textheight + 2 > windowHeight)
100 my = windowHeight - 8 * W_Textheight - 2;
101 if (key == 'i') {
102 infow = W_MakeWindow("info", mx, my, 23 * W_Textwidth, 8 * W_Textheight,
103 ww, (char *) 0, 2, foreColor);
104 W_MapWindow(infow);
105 j = &players[target->o_num];
106 infothing = (void *) j;
107 Info_list_small(j);
108 } else { /* New information window! */
109 if (!paradise) { /* if a normal server then */
110 infow = W_MakeWindow("info", mx, my, 23 * W_Textwidth,
111 8 * W_Textheight, ww, (char *) 0, 2, foreColor);
112 W_MapWindow(infow);
113 j = &players[target->o_num];
114 infothing = (void *) j;
115 (void) sprintf(buf, "%s (%c%c):", j->p_name,
116 teaminfo[j->p_teami].letter, shipnos[j->p_no]);
117 W_WriteText(infow, W_Textwidth, W_Textheight * line++,
118 playerColor(j), buf, strlen(buf), shipFont(j));
119 Info_list_normal(j);
120 } else { /* else if a paradise server */
121 if (mx + 50 * W_Textwidth + 2 > windowWidth)
122 mx = windowWidth - 50 * W_Textwidth - 2;
123 if (my + 25 * W_Textheight + 2 > windowHeight)
124 my = windowHeight - 22 * W_Textheight - 2;
125 infow = W_MakeWindow("info", mx, my, 50 * W_Textwidth,
126 22 * W_Textheight, ww, (char *) 0, 2, foreColor);
127 W_MapWindow(infow);
128 j = &players[target->o_num];
129 infothing = (void *) j;
130 (void) sprintf(buf, "%s (%c%c):", j->p_name,
131 teaminfo[j->p_teami].letter, shipnos[j->p_no]);
132 W_WriteText(infow, W_Textwidth, W_Textheight * line++,
133 playerColor(j), buf, strlen(buf), shipFont(j));
134 Info_list_paradise(j);
135 }
136 }
137 } else { /* Planet */
138 if (paradise) {
139 /* Too close to the edge? */
140 if (mx + 25 * W_Textwidth + 2 > windowWidth)
141 mx = windowWidth - 25 * W_Textwidth - 2;
142 if (my + 5 * W_Textheight + 2 > windowHeight)
143 my = windowHeight - 5 * W_Textheight - 2;
144
145 infow = W_MakeWindow("info", mx, my, W_Textwidth * 25, W_Textheight * 5, ww,
146 (char *) 0, 2, foreColor);
147 } else {
148 /* Too close to the edge? */
149 if (mx + 25 * W_Textwidth + 2 > windowWidth)
150 mx = windowWidth - 25 * W_Textwidth - 2;
151 if (my + 3 * W_Textheight + 2 > windowHeight)
152 my = windowHeight - 5 * W_Textheight - 2;
153
154 infow = W_MakeWindow("info", mx, my, W_Textwidth * 25, W_Textheight * 3, ww,
155 (char *) 0, 2, foreColor);
156 }
157 W_MapWindow(infow);
158 k = &planets[target->o_num];
159 infothing = (void *) k;
160 /*
161 dist = hypot((double) (me->p_x - k->pl_x), (double) (me->p_y -
162 k->pl_y));
163 */
164
165 if (!paradise) { /* if not a paradise server */
166 inform_planet_normal(k);
167 } else { /* else must be a paradise server */
168 inform_planet_paradise(k); /* go display paradise info */
169 }
170 }
171 }
172
173
174 void
175 destroyInfo()
176 {
177 W_DestroyWindow(infow);
178 infow = 0;
179 infomapped = 0;
180 infotype = 0;
181 infoupdate = 0;
182 }
183
184
185 static void
186 Info_list_small(j)
187 struct player *j;
188 {
189 char buf[100];
190 int line = 0;
191 double dist;
192
193 (void) sprintf(buf, "%s (%c%c):", j->p_name, teaminfo[j->p_teami].letter,
194 shipnos[j->p_no]);
195 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
196 buf, strlen(buf), shipFont(j));
197 (void) sprintf(buf, "Login %-s", j->p_login);
198 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
199 buf, strlen(buf),
200 W_RegularFont);
201 (void) sprintf(buf, "Display %-s", j->p_monitor);
202 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
203 buf, strlen(buf),
204 W_RegularFont);
205 (void) sprintf(buf, "Speed %-d", j->p_speed);
206 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
207 buf, strlen(buf),
208 W_RegularFont);
209 (void) sprintf(buf, "kills %-4.2f", j->p_kills);
210 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
211 buf, strlen(buf),
212 W_RegularFont);
213 dist = hypot((double) (me->p_x - j->p_x),
214 (double) (me->p_y - j->p_y)) / (double) GRIDSIZE;
215 (void) sprintf(buf, "dist %-1.2f sectors", dist);
216 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
217 buf, strlen(buf),
218 W_RegularFont);
219 (void) sprintf(buf, "S-Class %-2.2s", j->p_ship->s_desig);
220 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
221 buf, strlen(buf),
222 W_RegularFont);
223
224 if (j->p_swar & idx_to_mask(me->p_teami))
225 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
226 "WAR", 3,
227 W_RegularFont);
228 else if (j->p_hostile & idx_to_mask(me->p_teami))
229 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
230 "HOSTILE", 7,
231 W_RegularFont);
232 else
233 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
234 "PEACEFUL", 8,
235 W_RegularFont);
236 }
237
238 static void
239 inform_planet_normal(k)
240 struct planet *k;
241 {
242 char buf[100];
243 int line = 0;
244
245 if (k->pl_info & idx_to_mask(me->p_teami)) {
246 (void) sprintf(buf, "%s (%c)", k->pl_name,
247 teaminfo[mask_to_idx(k->pl_owner)].letter);
248 W_WriteText(infow, W_Textwidth, W_Textheight * line++, planetColor(k),
249 buf, strlen(buf), planetFont(k));
250 (void) sprintf(buf, "Armies %d", k->pl_armies);
251 W_WriteText(infow, W_Textwidth, W_Textheight * line++,
252 planetColor(k), buf, strlen(buf), W_RegularFont);
253 (void) sprintf(buf, "%s %s %s %s",
254 (k->pl_flags & PLREPAIR ? "RPR" : " "),
255 (k->pl_flags & PLFUEL ? "FUEL" : " "),
256 (k->pl_flags & PLAGRI ? "AGRI" : " "),
257 team_bit_string(k->pl_info));
258 W_WriteText(infow, W_Textwidth, W_Textheight * line++,
259 planetColor(k), buf, strlen(buf), W_RegularFont);
260 } else { /* else player has no info on planet */
261 (void) sprintf(buf, "%s", k->pl_name);
262 W_WriteText(infow, W_Textwidth, W_Textheight * line++, planetColor(k),
263 buf, strlen(buf), W_RegularFont);
264 (void) sprintf(buf, "No other info");
265 W_WriteText(infow, W_Textwidth, W_Textheight * line++, planetColor(k),
266 buf, strlen(buf), W_RegularFont);
267 }
268 }
269
270
271 /* This function provides info about planets for a paradise version 2.0
272 server. */
273
274 static void
275 inform_planet_paradise(k)
276 struct planet *k; /* the planet */
277 {
278 char buf[100];
279 int line = 0;
280
281 if (k->pl_flags & PLSTAR) { /* test if planet is a star */
282 (void) sprintf(buf, "%s", k->pl_name);
283 W_WriteText(infow, W_Textwidth, W_Textheight * line++, textColor,
284 buf, strlen(buf), W_RegularFont);
285 (void) sprintf(buf, "STAR ");
286 W_WriteText(infow, W_Textwidth, W_Textheight * line++,
287 textColor, buf, strlen(buf), W_RegularFont);
288 } else if (!(k->pl_info & idx_to_mask(me->p_teami))) { /* else if no info */
289 (void) sprintf(buf, "%s", k->pl_name);
290 W_WriteText(infow, W_Textwidth, W_Textheight * line++, planetColor(k),
291 buf, strlen(buf), W_RegularFont);
292 (void) sprintf(buf, "No other info");
293 W_WriteText(infow, W_Textwidth, W_Textheight * line++, planetColor(k),
294 buf, strlen(buf), W_RegularFont);
295 } else { /* else we have info */
296 (void) sprintf(buf, "%s (%c)", k->pl_name,
297 teaminfo[mask_to_idx(k->pl_owner)].letter);
298 W_WriteText(infow, W_Textwidth, W_Textheight * line++, planetColor(k),
299 buf, strlen(buf), W_RegularFont);
300 (void) sprintf(buf, "Armies %d", k->pl_armies);
301 W_WriteText(infow, W_Textwidth, W_Textheight * line++,
302 planetColor(k), buf, strlen(buf), W_RegularFont);
303 (void) sprintf(buf, "%s %s %s %s",
304 (k->pl_flags & PLREPAIR ? "RPR" : " "),
305 (k->pl_flags & PLFUEL ? "FUEL" : " "),
306 (k->pl_flags & PLAGRI ? "AGRI" : " "),
307 (k->pl_flags & PLSHIPYARD ? "SHPYD" : " "));
308 W_WriteText(infow, W_Textwidth, W_Textheight * line++,
309 planetColor(k), buf, strlen(buf), W_RegularFont);
310 (void) sprintf(buf, "atmos: ");
311 switch (k->pl_flags & PLATMASK) {
312 case PLPOISON:
313 strcat(buf, "TOXC surfc: ");
314 break;
315 case PLATYPE3:
316 strcat(buf, "TNTD surfc: ");
317 break;
318 case PLATYPE2:
319 strcat(buf, "THIN surfc: ");
320 break;
321 case PLATYPE1:
322 strcat(buf, "STND surfc: ");
323 break;
324 default:
325 strcat(buf, " surfc: ");
326 break;
327 };
328 if (k->pl_flags & PLDILYTH)
329 strcat(buf, "D");
330 else
331 strcat(buf, " ");
332 if (k->pl_flags & PLMETAL)
333 strcat(buf, "M");
334 else
335 strcat(buf, " ");
336 if (k->pl_flags & PLARABLE)
337 strcat(buf, "A");
338 else
339 strcat(buf, " ");
340 W_WriteText(infow, W_Textwidth, W_Textheight * line++,
341 planetColor(k), buf, strlen(buf), W_RegularFont);
342 sprintf(buf, "Time: %-5d Visit: %s",
343 ((idx_to_mask(me->p_teami) == k->pl_owner) ? 0
344 : (int) (status2->clock - k->pl_timestamp)),
345 team_bit_string(k->pl_info));
346 W_WriteText(infow, W_Textwidth, W_Textheight * line++,
347 planetColor(k), buf, strlen(buf), W_RegularFont);
348 }
349 }
350
351
352
353 static void
354 Info_list_normal(j)
355 struct player *j; /* player to do info on */
356 {
357 char buf[80];
358 int line = 0;
359 struct ratings r;
360
361 get_ratings(j, &r);
362 sprintf(buf, "%s (%c%c):", j->p_name, teaminfo[j->p_teami].letter,
363 shipnos[j->p_no]);
364 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
365 buf, strlen(buf), W_RegularFont);
366 strcpy(buf, " Rating Total");
367 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
368 buf, strlen(buf), W_RegularFont);
369 sprintf(buf, "Bombing: %5.2f %5d", r.r_bombrat, r.r_armies);
370 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
371 buf, strlen(buf), W_RegularFont);
372 sprintf(buf, "Planets: %5.2f %5d", r.r_planetrat, r.r_planets);
373 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
374 buf, strlen(buf), W_RegularFont);
375 sprintf(buf, "Offense: %5.2f %5d", r.r_offrat, r.r_kills);
376 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
377 buf, strlen(buf), W_RegularFont);
378 sprintf(buf, "Defense: %5.2f %5d", r.r_defrat, r.r_losses);
379 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
380 buf, strlen(buf), W_RegularFont);
381 sprintf(buf, " Maxkills: %6.2f", r.r_maxkills);
382 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
383 buf, strlen(buf), W_RegularFont);
384 sprintf(buf, " Hours: %6.2f", (float) j->p_stats.st_tticks / 36000.0);
385 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
386 buf, strlen(buf), W_RegularFont);
387 }
388
389 static void
390 Info_list_paradise(j)
391 struct player *j; /* player to do info on */
392 {
393 char buf[80];
394 int line = 0;
395 struct ratings r;
396
397 get_ratings(j, &r);
398
399 sprintf(buf, "Name: %s", j->p_name);
400 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
401 buf, strlen(buf), W_RegularFont);
402 sprintf(buf, "Rank: %s", ranks2[j->p_stats2.st_rank].name);
403 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
404 buf, strlen(buf), W_RegularFont);
405 sprintf(buf, "Royalty: %s", royal[j->p_stats2.st_royal].name);
406 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
407 buf, strlen(buf), W_RegularFont);
408 sprintf(buf, "Genocides: %4d", r.r_genocides);
409 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
410 buf, strlen(buf), W_RegularFont);
411 sprintf(buf, "DI: %7.2f", r.r_di);
412 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
413 buf, strlen(buf), W_RegularFont);
414 sprintf(buf, "Maxkills:%6.2f", j->p_stats2.st_tmaxkills);
415 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
416 buf, strlen(buf), W_RegularFont);
417 sprintf(buf, "Kills: %4d", j->p_stats2.st_tkills);
418 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
419 buf, strlen(buf), W_RegularFont);
420 sprintf(buf, "Losses: %4d", j->p_stats2.st_tlosses);
421 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
422 buf, strlen(buf), W_RegularFont);
423 sprintf(buf, "T-hours: %6.2f", (float) j->p_stats2.st_tticks / 36000.0);
424 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
425 buf, strlen(buf), W_RegularFont);
426 sprintf(buf, " ");
427 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
428 buf, strlen(buf), W_RegularFont);
429 strcpy(buf, " Rating Total");
430 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
431 buf, strlen(buf), W_RegularFont);
432 sprintf(buf, "Bombing: %5.2f %6d", r.r_bombrat, r.r_armies);
433 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
434 buf, strlen(buf), W_RegularFont);
435 sprintf(buf, "Planets: %5.2f %6d", r.r_planetrat, r.r_planets);
436 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
437 buf, strlen(buf), W_RegularFont);
438 sprintf(buf, "Resources: %5.2f %6d", r.r_resrat, r.r_resources);
439 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
440 buf, strlen(buf), W_RegularFont);
441 sprintf(buf, "Dooshes: %5.2f %6d", r.r_dooshrat, r.r_dooshes);
442 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
443 buf, strlen(buf), W_RegularFont);
444 sprintf(buf, "Ratio: %5.2f", j->p_stats2.st_tkills /
445 ((j->p_stats2.st_tlosses) ? j->p_stats2.st_tlosses : 1.0));
446 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
447 buf, strlen(buf), W_RegularFont);
448 sprintf(buf, "Offense: %5.2f", r.r_offrat);
449 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
450 buf, strlen(buf), W_RegularFont);
451 sprintf(buf, " ");
452 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
453 buf, strlen(buf), W_RegularFont);
454 sprintf(buf, "RATINGS");
455 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
456 buf, strlen(buf), W_RegularFont);
457 sprintf(buf, "Special ships: %7.2f", r.r_specrat);
458 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
459 buf, strlen(buf), W_RegularFont);
460 sprintf(buf, "Battle: %7.2f", r.r_batrat);
461 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
462 buf, strlen(buf), W_RegularFont);
463 sprintf(buf, "Strategy: %7.2f", r.r_stratrat);
464 W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j),
465 buf, strlen(buf), W_RegularFont);
466
467 line = 1;
468 sprintf(buf, " ");
469 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
470 buf, strlen(buf), W_RegularFont);
471 sprintf(buf, "JUMPSHIP STATS");
472 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
473 buf, strlen(buf), W_RegularFont);
474 sprintf(buf, "Planets: %7d", j->p_stats2.st_jsplanets);
475 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
476 buf, strlen(buf), W_RegularFont);
477 sprintf(buf, "Hours: %7.2f", (float) j->p_stats2.st_jsticks / 36000.0);
478 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
479 buf, strlen(buf), W_RegularFont);
480 sprintf(buf, "JS rating: %7.2f", r.r_jsrat);
481 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
482 buf, strlen(buf), W_RegularFont);
483
484 sprintf(buf, " ");
485 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
486 buf, strlen(buf), W_RegularFont);
487 sprintf(buf, "STARBASE STATS");
488 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
489 buf, strlen(buf), W_RegularFont);
490 sprintf(buf, "Kills: %4d", j->p_stats2.st_sbkills);
491 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
492 buf, strlen(buf), W_RegularFont);
493 sprintf(buf, "Losses: %4d", j->p_stats2.st_sblosses);
494 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
495 buf, strlen(buf), W_RegularFont);
496 sprintf(buf, "Hours: %7.2f", (float) j->p_stats2.st_sbticks / 36000.0);
497 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
498 buf, strlen(buf), W_RegularFont);
499 sprintf(buf, "Maxkills: %7.2f", j->p_stats2.st_sbmaxkills);
500 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
501 buf, strlen(buf), W_RegularFont);
502 sprintf(buf, "SB rating: %7.2f", r.r_sbrat);
503 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
504 buf, strlen(buf), W_RegularFont);
505
506 sprintf(buf, " ");
507 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
508 buf, strlen(buf), W_RegularFont);
509 sprintf(buf, "WARBASE STATS");
510 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
511 buf, strlen(buf), W_RegularFont);
512 sprintf(buf, "Kills: %4d", j->p_stats2.st_wbkills);
513 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
514 buf, strlen(buf), W_RegularFont);
515 sprintf(buf, "Losses: %4d", j->p_stats2.st_wblosses);
516 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
517 buf, strlen(buf), W_RegularFont);
518 sprintf(buf, "Hours: %7.2f", (float) j->p_stats2.st_wbticks / 36000.0);
519 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
520 buf, strlen(buf), W_RegularFont);
521 sprintf(buf, "Maxkills: %7.2f", j->p_stats2.st_wbmaxkills);
522 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
523 buf, strlen(buf), W_RegularFont);
524 sprintf(buf, "WB rating: %7.2f", r.r_wbrat);
525 W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j),
526 buf, strlen(buf), W_RegularFont);
527 }
528
529 /*
530 constantly updating info window code [BDyess]
531 */
532 void
533 updateInform()
534 {
535 if (!infomapped || !paradise)
536 return; /* disabled for Bronco servers */
537 if (infotype == PLAYERTYPE && last_key == 'i' && (redrawPlayer[me->p_no] ||
538 redrawPlayer[((struct player *) infothing)->p_no]))
539 infoupdate = 1;
540 if (infoupdate) {
541 infoupdate = 0;
542 W_ClearWindow(infow);
543 if (infotype == PLAYERTYPE) {
544 /* if(isAlive((struct player*)infothing)) { */
545 if (last_key == 'i')/* use small info */
546 Info_list_small((struct player *) infothing);
547 else if (!paradise)
548 Info_list_normal((struct player *) infothing);
549 else
550 Info_list_paradise((struct player *) infothing);
551 /*
552 } else { destroyInfo(); }
553 */
554 } else { /* planet */
555 if (!paradise)
556 inform_planet_normal((struct planet *) infothing);
557 else
558 inform_planet_paradise((struct planet *) infothing);
559 }
560 }
561 }