ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/init.C
(Generate patch)

Comparing deliantra/server/common/init.C (file contents):
Revision 1.50 by root, Thu Oct 15 21:40:42 2009 UTC vs.
Revision 1.51 by root, Sat Nov 7 18:30:05 2009 UTC

198 char buf[MAX_BUF]; 198 char buf[MAX_BUF];
199 char filename[MAX_BUF]; 199 char filename[MAX_BUF];
200 char *cp, *p; 200 char *cp, *p;
201 FILE *fp; 201 FILE *fp;
202 static int has_been_done = 0; 202 static int has_been_done = 0;
203 int mess, level, comp; 203 int msgnum, level, comp;
204 int mode = 0, total = 0; 204 int mode = 0, total = 0;
205 205
206 if (has_been_done) 206 if (has_been_done)
207 return; 207 return;
208 else 208 else
231 231
232 if (strncmp (cp, "TYPE:", 5) == 0) 232 if (strncmp (cp, "TYPE:", 5) == 0)
233 { 233 {
234 p = strtok (buf, ":"); 234 p = strtok (buf, ":");
235 p = strtok (NULL, ":"); 235 p = strtok (NULL, ":");
236
236 if (mode == 1) 237 if (mode == 1)
237 { 238 {
238 attack_mess[mess][level].level = -1; 239 attack_mess[msgnum][level].level = -1;
239 attack_mess[mess][level].buf1 = NULL; 240 attack_mess[msgnum][level].buf1 = NULL;
240 attack_mess[mess][level].buf2 = NULL; 241 attack_mess[msgnum][level].buf2 = NULL;
241 attack_mess[mess][level].buf3 = NULL; 242 attack_mess[msgnum][level].buf3 = NULL;
242 } 243 }
243 244
244 level = 0; 245 level = 0;
245 mess = atoi (p); 246 msgnum = atoi (p);
246 mode = 1; 247 mode = 1;
247 continue;
248 } 248 }
249
250 if (mode == 1) 249 else if (mode == 1)
251 { 250 {
252 p = strtok (buf, "="); 251 p = strtok (buf, "=");
253 attack_mess[mess][level].level = atoi (buf); 252 attack_mess[msgnum][level].level = atoi (buf);
254 p = strtok (NULL, "="); 253 p = strtok (NULL, "=");
254
255 if (p != NULL) 255 if (p != NULL)
256 attack_mess[mess][level].buf1 = strdup (p); 256 attack_mess[msgnum][level].buf1 = strdup (p);
257 else 257 else
258 attack_mess[mess][level].buf1 = strdup (""); 258 attack_mess[msgnum][level].buf1 = strdup ("");
259
259 mode = 2; 260 mode = 2;
260 continue;
261 } 261 }
262 else if (mode == 2) 262 else if (mode == 2)
263 { 263 {
264 p = strtok (buf, "="); 264 p = strtok (buf, "=");
265 attack_mess[mess][level].level = atoi (buf); 265 attack_mess[msgnum][level].level = atoi (buf);
266 p = strtok (NULL, "="); 266 p = strtok (NULL, "=");
267
267 if (p != NULL) 268 if (p != NULL)
268 attack_mess[mess][level].buf2 = strdup (p); 269 attack_mess[msgnum][level].buf2 = strdup (p);
269 else 270 else
270 attack_mess[mess][level].buf2 = strdup (""); 271 attack_mess[msgnum][level].buf2 = strdup ("");
272
271 mode = 3; 273 mode = 3;
272 continue;
273 } 274 }
274 else if (mode == 3) 275 else if (mode == 3)
275 { 276 {
276 p = strtok (buf, "="); 277 p = strtok (buf, "=");
277 attack_mess[mess][level].level = atoi (buf); 278 attack_mess[msgnum][level].level = atoi (buf);
278 p = strtok (NULL, "="); 279 p = strtok (NULL, "=");
280
279 if (p != NULL) 281 if (p != NULL)
280 attack_mess[mess][level].buf3 = strdup (p); 282 attack_mess[msgnum][level].buf3 = strdup (p);
281 else 283 else
282 attack_mess[mess][level].buf3 = strdup (""); 284 attack_mess[msgnum][level].buf3 = strdup ("");
285
283 mode = 1; 286 mode = 1;
284 level++; 287 level++;
285 total++; 288 total++;
286 continue;
287 } 289 }
288 } 290 }
289 291
290 LOG (llevDebug, "got %d messages in %d categories.\n", total, mess + 1); 292 LOG (llevDebug, "got %d messages in %d categories.\n", total, msgnum + 1);
291 close_and_delete (fp, comp); 293 close_and_delete (fp, comp);
292} 294}
293 295

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines