annotate inform.c @ 3:5a977ccbc7a9 default tip

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