annotate wide_plist.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: wide_plist.c,v 1.1.1.1 1997/12/06 05:41:31 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 #ifdef WIDE_PLIST
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
5 #define PLIST1
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
6 #define PLIST2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
7 #define PLIST
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
8 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
9 * playerlist.c
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
10 *
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
11 * Fairly substantial re-write to do variable player lists: Sept 93 DRG
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
12 * Paradise shoehorning: 2/13/94 [BDyess]
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
13 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
14 #include "copyright.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
15
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
16 #include <stdio.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
17 #include "Wlib.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
18 #include "defs.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
19 #include "struct.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
20 #include "data.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
21 #include "gameconf.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
22 #include "proto.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
23
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
24 static char header[BUFSIZ];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
25 int header_len=0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
26 char *old_playerList=NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
27 char **slottext=NULL; /* array of strings shown in each slot
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
28 [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
29 W_Color *slotcolors=NULL; /* array of colors, one per slot [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
30 int slottext_size=0; /* keep track of the size in case nplayers
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
31 changes */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
32
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
33 /*===========================================================================*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
34
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
35 int
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
36 playerlistnum()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
37 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
38 int num = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
39 char *ptr;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
40 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
41
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
42 ptr = playerList;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
43 header[0] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
44 while (ptr[0] != '\0' && ptr[0] != ',') {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
45 switch (ptr[0]) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
46 case 'n': /* Ship Number */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
47 strcat(header, " No");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
48 num += 3;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
49 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
50 case 'T': /* Ship Type */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
51 strcat(header, " Ty");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
52 num += 3;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
53 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
54 case 'R': /* Rank */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
55 strcat(header, " Rank ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
56 num += 11;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
57 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
58 case 'N': /* Name */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
59 strcat(header, " Name ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
60 num += 17;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
61 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
62 case 'K': /* Kills */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
63 strcat(header, " Kills");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
64 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
65 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
66 case 'l': /* Login Name */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
67 strcat(header, " Login ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
68 num += 17;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
69 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
70 case 'O': /* Offense */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
71 strcat(header, " Offse");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
72 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
73 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
74 case 'W': /* Wins */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
75 strcat(header, " Wins");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
76 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
77 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
78 case 'D': /* Defense */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
79 strcat(header, " Defse");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
80 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
81 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
82 case 'L': /* Losses */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
83 strcat(header, " Loss");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
84 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
85 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
86 case 'S': /* Total Rating (stats) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
87 strcat(header, " Stats");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
88 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
89 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
90 case 'r': /* Ratio */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
91 strcat(header, " Ratio");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
92 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
93 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
94 case 'd': /* Damage Inflicted (DI) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
95 strcat(header, " DI");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
96 num += 8;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
97 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
98 case ' ': /* White Space */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
99 strcat(header, " ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
100 num += 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
101 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
102 #ifdef PLIST1
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
103 case 'B': /* Bombing */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
104 strcat(header, " Bmbng");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
105 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
106 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
107 case 'b': /* Armies Bombed */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
108 strcat(header, " Bmbed");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
109 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
110 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
111 case 'P': /* Planets */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
112 strcat(header, " Plnts");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
113 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
114 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
115 case 'p': /* Planets Taken */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
116 strcat(header, " Plnts");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
117 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
118 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
119 case 'G': /* Doosh rating ('oGGing') [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
120 strcat(header, " Dshng");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
121 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
122 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
123 case 'g': /* number of dooshes [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
124 strcat(header, " Dshed");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
125 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
126 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
127 case 'F': /* Resource rating [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
128 /* 'F' is from Farming...I'm out of good letters */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
129 strcat(header, " Resrc");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
130 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
131 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
132 case 'f': /* number of Resources bombed [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
133 strcat(header, " Rsrcs");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
134 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
135 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
136 case 'Z': /* SB rating [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
137 /* 'Z' is the last letter - a SB is the team anchor. :) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
138 strcat(header, " SBrat");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
139 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
140 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
141 case 'z': /* WB rating (small SB) [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
142 strcat(header, " WBrat");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
143 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
144 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
145 case 'J': /* JS rating - good letter [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
146 strcat(header, " JSrat");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
147 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
148 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
149 case 'j': /* JS planets [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
150 strcat(header, " JSpls");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
151 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
152 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
153 case 'C': /* SpeCial ships rating [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
154 strcat(header, " Specl");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
155 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
156 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
157 case 'E': /* genocides (Endings) [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
158 strcat(header, " Genos");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
159 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
160 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
161 case 'M': /* Display, Host Machine */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
162 strcat(header, " Host Machine ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
163 num += 17;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
164 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
165 case 'H': /* Hours Played */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
166 strcat(header, " Hours");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
167 num += 7;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
168 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
169 case 'k': /* Max Kills */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
170 strcat(header, " Max K");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
171 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
172 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
173 case 'V': /* Kills per hour */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
174 strcat(header, " KPH");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
175 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
176 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
177 case 'v': /* Deaths per hour */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
178 strcat(header, " DPH");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
179 num += 6;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
180 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
181 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
182 #ifdef PLIST2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
183 case 'w': /* War staus */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
184 strcat(header, " War Stat");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
185 num += 9;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
186 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
187 case 's': /* Speed */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
188 strcat(header, " Sp");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
189 num += 3;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
190 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
191 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
192 default:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
193 fprintf(stderr, "%c is not an option for the playerlist\n", ptr[0]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
194 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
195 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
196 ptr++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
197 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
198
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
199 old_playerList = playerList;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
200 header_len = num;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
201 return (num);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
202 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
203
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
204 /*===========================================================================*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
205
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
206 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
207 wideplayerlist()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
208 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
209 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
210 int old_len=header_len;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
211 if (old_playerList != playerList) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
212 playerlistnum();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
213 if(resizePlayerList)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
214 W_ResizeText(playerw,header_len,W_WindowHeight(playerw));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
215 /* init slottext [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
216 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
217 for (i = 0; i < nplayers; i++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
218 slot[i] = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
219
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
220 W_ClearWindow(playerw);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
221
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
222 if (slottext && ((old_len != header_len) || (slottext_size != nplayers))) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
223 /* free the old one */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
224 for (i = 0; i < slottext_size; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
225 free(slottext[i]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
226 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
227 free(slottext);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
228 free(slotcolors);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
229 slottext=0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
230 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
231 if(!slottext) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
232 slottext_size = nplayers;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
233 slottext = (char **) malloc(sizeof(char *) * nplayers);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
234 slotcolors = (W_Color *) malloc(sizeof(W_Color) * nplayers);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
235 for (i = 0; i < nplayers; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
236 /* malloc extra room in case a line runs off the end */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
237 slottext[i] = (char *) malloc(sizeof(char) * header_len + 30);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
238 slottext[i][0] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
239 slotcolors[i] = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
240 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
241 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
242 W_WriteText(playerw, 0, 1, textColor, header, header_len, W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
243
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
244 for (i = 0; i < nplayers; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
245 updatePlayer[i] = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
246 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
247
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
248 wideplayerlist2();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
249 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
250
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
251 /*===========================================================================*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
252
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
253 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
254 writeDiffText(window, x, y, color, orig, new, font)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
255 W_Window window;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
256 int x, y;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
257 W_Color color;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
258 char *orig, *new;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
259 W_Font font;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
260 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
261 /* little routine to print just the chars that are different between orig and
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
262 new. [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
263 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
264 char *start;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
265
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
266 for (start = new, i = 0; new[i] && orig[i]; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
267 if (orig[i] != new[i])
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
268 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
269 if (start == new + i) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
270 start++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
271 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
272 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
273 W_WriteText(window, x + start - new, y, color, start, new + i - start, font);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
274 start = new + i + 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
275 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
276 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
277 if (start != new + i) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
278 /* finish up any remaining digits */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
279 W_WriteText(window, x + start - new, y, color, start, new + i - start, font);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
280 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
281 if (new[i]) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
282 /* write any text that extends past the old one */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
283 W_WriteText(window, x + i, y, color, new + i, strlen(new + i), font);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
284 } else if (orig[i]) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
285 /* print spaces to clear to EOL */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
286 char *freeme;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
287 int len;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
288
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
289 len = strlen(orig + i);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
290 freeme = (char *) malloc(len);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
291 memset(freeme, ' ', len);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
292 W_WriteText(window, x + i, y, color, freeme, len, font);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
293 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
294 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
295
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
296 /*===========================================================================*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
297
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
298 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
299 plist_line(j, pos)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
300 struct player *j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
301 int pos;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
302 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
303 char buf[BUFSIZ];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
304 char *ptr;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
305 char tmp[30];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
306 int my_ticks;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
307 struct ratings r;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
308 W_Color color;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
309
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
310 get_ratings(j, &r);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
311
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
312 if (pos < 2) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
313 printf("bad line position in playerlist\n");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
314 pos = 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
315 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
316 if (paradise)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
317 my_ticks = j->p_stats2.st_tticks;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
318 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
319 my_ticks = j->p_stats.st_tticks;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
320
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
321 ptr = playerList;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
322 buf[0] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
323 while (ptr[0] != '\0' && ptr[0] != ',') {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
324 tmp[0] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
325 switch (ptr[0]) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
326 case 'n': /* Ship Number */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
327 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
328 if (j->p_status != PALIVE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
329 tmp[1] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
330 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
331 tmp[1] = teaminfo[j->p_teami].letter;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
332 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
333 tmp[2] = shipnos[j->p_no];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
334 tmp[3] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
335 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
336 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
337 case 'T': /* Ship Type */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
338 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
339 switch (j->p_status) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
340 case PALIVE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
341 tmp[1] = j->p_ship->s_desig[0];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
342 tmp[2] = j->p_ship->s_desig[1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
343 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
344 case PTQUEUE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
345 tmp[1] = 't';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
346 tmp[2] = 'q';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
347 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
348 case POUTFIT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
349 tmp[1] = '-';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
350 tmp[2] = '-';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
351 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
352 case PEXPLODE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
353 case PDEAD:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
354 tmp[1] = '*';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
355 tmp[2] = '*';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
356 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
357 case POBSERVE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
358 tmp[1] = 'o';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
359 tmp[2] = 'b';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
360 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
361 default:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
362 tmp[1] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
363 tmp[2] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
364 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
365 tmp[3] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
366 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
367 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
368 case 'R': /* Rank */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
369 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
370 sprintf(tmp + 1, "%-10.10s", get_players_rank_name(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
371 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
372 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
373 case 'N': /* Name */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
374 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
375 sprintf(tmp + 1, "%-16.16s", j->p_name);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
376 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
377 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
378 case 'K': /* Kills */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
379 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
380 if ((j->p_kills <= 0 &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
381 (paradise || RSA_Client <= 0) && hideNoKills)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
382 || (j->p_status & ~PALIVE))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
383 strcpy(tmp + 1, " ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
384 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
385 sprintf(tmp + 1, "%5.2f", j->p_kills);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
386 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
387 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
388 case 'l': /* Login Name */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
389 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
390 sprintf(tmp + 1, "%-16.16s", j->p_login);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
391 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
392 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
393 case 'O': /* Offense */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
394 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
395 sprintf(tmp + 1, "%5.2f", r.r_offrat);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
396 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
397 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
398 case 'W': /* Wins */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
399 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
400 sprintf(tmp + 1, "%5d", r.r_kills);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
401 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
402 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
403 case 'D': /* Defense */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
404 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
405 sprintf(tmp + 1, "%5.2f", r.r_defrat);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
406 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
407 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
408 case 'L': /* Losses */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
409 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
410 sprintf(tmp + 1, "%5d", r.r_losses);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
411 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
412 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
413 case 'S': /* Total Rating (stats) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
414 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
415 sprintf(tmp + 1, "%5.2f", r.r_ratings);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
416 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
417 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
418 case 'r': /* Ratio */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
419 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
420 sprintf(tmp + 1, "%5.2f", r.r_ratio);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
421 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
422 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
423 case 'd': /* Damage Inflicted (DI) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
424 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
425 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
426 ftoa (Ratings * (j->p_stats.st_tticks / 36000.0), tmp+1, 0, 4,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
427 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
428 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
429 sprintf(tmp + 1, "%7.2f", r.r_di);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
430 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
431 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
432 case ' ': /* White Space */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
433 strcat(buf, " ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
434 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
435 #ifdef PLIST1
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
436 case 'B': /* Bombing */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
437 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
438 sprintf(tmp + 1, "%5.2f", r.r_bombrat);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
439 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
440 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
441 case 'b': /* Armies Bombed */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
442 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
443 sprintf(tmp + 1, "%5d", r.r_armies);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
444 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
445 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
446 case 'P': /* Planets */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
447 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
448 sprintf(tmp + 1, "%5.2f", r.r_planetrat);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
449 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
450 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
451 case 'p': /* Planets Taken */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
452 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
453 sprintf(tmp + 1, "%5d", r.r_planets);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
454 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
455 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
456 case 'G': /* Doosh rating ('oGGing') [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
457 *tmp = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
458 sprintf(tmp + 1, "%5.2f", r.r_dooshrat);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
459 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
460 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
461 case 'g': /* Dooshes [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
462 *tmp = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
463 sprintf(tmp + 1, "%5d", r.r_dooshes);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
464 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
465 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
466 case 'F': /* Resource rating [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
467 /* 'F' is from Farming...I'm out of good letters */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
468 *tmp = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
469 sprintf(tmp + 1, "%5.2f", r.r_resrat);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
470 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
471 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
472 case 'f': /* number of Resources bombed [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
473 *tmp = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
474 sprintf(tmp + 1, "%5d", r.r_resources);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
475 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
476 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
477 case 'Z': /* SB rating [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
478 /* 'Z' is the last letter - a SB is the team anchor. :) */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
479 *tmp = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
480 sprintf(tmp + 1, "%5.2f", r.r_sbrat);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
481 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
482 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
483 case 'z': /* WB rating (small SB) [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
484 *tmp = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
485 sprintf(tmp + 1, "%5.2f", r.r_wbrat);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
486 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
487 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
488 case 'J': /* JS rating - good letter [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
489 *tmp = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
490 sprintf(tmp + 1, "%5.2f", r.r_jsrat);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
491 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
492 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
493 case 'j': /* JS planets [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
494 *tmp = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
495 sprintf(tmp + 1, "%5d", r.r_jsplanets);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
496 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
497 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
498 case 'C': /* SpeCial ships rating [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
499 *tmp = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
500 sprintf(tmp + 1, "%5.2f", r.r_specrat);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
501 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
502 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
503 case 'E': /* genocides (Endings) [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
504 *tmp = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
505 sprintf(tmp + 1, "%5d", r.r_genocides);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
506 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
507 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
508 case 'M': /* Display, Host Machine */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
509 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
510 sprintf(tmp + 1, "%-16.16s", j->p_monitor);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
511 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
512 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
513 case 'H': /* Hours Played */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
514 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
515 sprintf(tmp + 1, "%6.2f", my_ticks / 36000.0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
516 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
517 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
518 case 'k': /* Max Kills */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
519 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
520 sprintf(tmp + 1, "%5.2f", r.r_maxkills);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
521 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
522 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
523 case 'V': /* Kills Per Hour */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
524 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
525 sprintf(tmp + 1, "%5.1f", r.r_killsPerHour);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
526 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
527 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
528 case 'v': /* Deaths Per Hour */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
529 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
530 sprintf(tmp + 1, "%5.1f", r.r_lossesPerHour);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
531 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
532 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
533 case 'w': /* War staus */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
534 if (j->p_swar & idx_to_mask(me->p_teami))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
535 strcat(buf, " WAR ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
536 else if (j->p_hostile & idx_to_mask(me->p_teami))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
537 strcat(buf, " HOSTILE ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
538 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
539 strcat(buf, " PEACEFUL");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
540 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
541 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
542 #ifdef PLIST2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
543 case 's': /* Speed */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
544 tmp[0] = ' ';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
545 sprintf(tmp + 1, "%2d", j->p_speed);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
546 strcat(buf, tmp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
547 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
548 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
549 default:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
550 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
551 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
552 ptr++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
553 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
554
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
555 color = playerColor(j);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
556 if (slot[pos - 2] == j->p_no && slotcolors[pos - 2] == color) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
557 /* write the line, skipping chars that haven't changed [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
558 writeDiffText(playerw, 0, pos, color, slottext[pos - 2], buf,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
559 shipFont(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
560 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
561 W_WriteText(playerw, 0, pos, color, buf, strlen(buf),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
562 shipFont(j));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
563 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
564 strcpy(slottext[pos - 2], buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
565 slotcolors[pos - 2] = color;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
566 slot[pos - 2] = j->p_no;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
567 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
568
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
569 /*===========================================================================*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
570
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
571 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
572 Sorted_playerlist2()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
573 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
574 register int i, h, pos = 1, last, boolflag = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
575 register struct player *j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
576 static int num;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
577 int numplayers;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
578
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
579 /* 20, not 16, is the max for non-paradise! Mostly the extra 4 are */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
580 /* robots, but might as well show them and be safe... -JR*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
581 numplayers = (paradise) ? nplayers : 20;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
582
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
583 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
584 if (++num % 21 == 0) { boolflag = 1; num = 0; }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
585 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
586 /* go through the teams in order */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
587 for (h = 0; h < number_of_teams; h++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
588 /* skip my team, I'll come back to it later */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
589 if (me->p_teami == h)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
590 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
591
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
592 /* go through all the players looking for those on team h */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
593 for (i = 0, j = &players[0]; i < numplayers; i++, j++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
594 if (j->p_teami != h)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
595 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
596
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
597 if (j->p_status == PFREE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
598 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
599
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
600 if(j->p_status == POUTFIT && !showDead) /* already know team */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
601 /* is valid.. */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
602 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
603
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
604 pos++; /* put this AFTER checking for free slots to
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
605 get a */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
606 /* nice compact list... */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
607
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
608 if (!updatePlayer[i] && slot[pos - 2] == i)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
609 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
610
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
611 updatePlayer[i] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
612 plist_line(j, pos);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
613 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
614 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
615
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
616 /* now go through and do my team. Note: ind players haven't been done */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
617 if (me->p_teami >= 0 && me->p_teami < number_of_teams) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
618 for (i = 0, j = &players[i]; i < numplayers; i++, j++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
619 if (j->p_teami != me->p_teami)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
620 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
621
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
622 if (j->p_status == PFREE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
623 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
624
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
625 if(j->p_status == POUTFIT && !showDead) /* already know team */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
626 /* is valid.. */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
627 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
628
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
629 pos++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
630 if (!updatePlayer[i] && slot[pos - 2] == i)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
631 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
632
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
633 updatePlayer[i] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
634 plist_line(j, pos);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
635 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
636 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
637 #if 0 /* this code displays the ind players from
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
638 the bottom up. */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
639 /* not everyone has a 32 line playerlist, so this tends to */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
640 /* make iggy invisible */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
641 last = numplayers + 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
642
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
643 for (i = numplayers - 1, j = &players[i]; i >= 0; i--, j--) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
644 if (j->p_teami >=0 && j->p_teami<number_of_teams)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
645 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
646
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
647 if (j->p_status == PFREE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
648 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
649
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
650 last--;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
651
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
652 if (!updatePlayer[i] && (!boolflag))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
653 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
654
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
655 updatePlayer[i] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
656 plist_line(j, last);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
657 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
658 #endif /* 0 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
659
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
660 for (i = 0, j = &players[0]; i < numplayers; i++, j++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
661 if (j->p_teami >= 0 && j->p_teami < number_of_teams)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
662 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
663
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
664 if (j->p_status == PFREE)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
665 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
666
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
667 pos++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
668
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
669 if (!updatePlayer[i] && slot[pos - 2] == i)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
670 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
671
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
672 updatePlayer[i] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
673 plist_line(j, pos);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
674 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
675 /* now continue clearing lines until we get to an empty one */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
676 pos++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
677 while ((pos - 2) < numplayers && slot[pos - 2] != -1 && slottext[pos - 2][0]) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
678 W_ClearArea(playerw, 0, pos, header_len, 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
679 slot[pos - 2] = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
680 slottext[pos - 2][0] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
681 pos++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
682 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
683
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
684 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
685 if (boolflag && (last > (pos + 1))) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
686 W_ClearArea(playerw, 0, pos + 1, header_len, last - (pos + 1));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
687 slot[pos - 2] = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
688 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
689 #endif /* 0 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
690 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
691
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
692 /*===========================================================================*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
693
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
694 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
695 wideplayerlist2()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
696 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
697 register int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
698 register struct player *j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
699 int numplayers;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
700
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
701 /* 20, not 16, is the max for non-paradise! Mostly the extra 4 are */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
702 /* robots, but might as well show them and be safe... -JR */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
703 numplayers = (paradise) ? nplayers : 20;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
704
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
705 if (old_playerList != playerList) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
706 wideplayerlist(); /* refresh if playerList changed */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
707 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
708 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
709 if (!W_IsMapped(playerw))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
710 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
711
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
712 if (sortPlayers) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
713 Sorted_playerlist2();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
714 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
715 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
716 for (i = 0, j = &players[i]; i < numplayers; i++, j++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
717 if (!updatePlayer[i])
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
718 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
719
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
720 updatePlayer[i] = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
721
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
722 if (j->p_status == PFREE) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
723 W_ClearArea(playerw, 0, i + 2, header_len, 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
724 continue;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
725 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
726 plist_line(j, i + 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
727 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
728 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
729
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
730 #endif /* WIDE_PLIST */