1 | /* |
1 | /* |
2 | * static char *rcsid_object_c = |
2 | * static char *rcsid_object_c = |
3 | * "$Id: object.C,v 1.9 2006/08/30 06:06:26 root Exp $"; |
3 | * "$Id: object.C,v 1.10 2006/08/31 17:54:14 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
281 | * Some error messages. |
281 | * Some error messages. |
282 | * The result of the dump is stored in the static global errmsg array. |
282 | * The result of the dump is stored in the static global errmsg array. |
283 | */ |
283 | */ |
284 | |
284 | |
285 | void dump_object2(object *op) { |
285 | void dump_object2(object *op) { |
|
|
286 | errmsg[0] = 0; |
|
|
287 | return; |
|
|
288 | //TODO//D#d# |
|
|
289 | #if 0 |
286 | char *cp; |
290 | char *cp; |
287 | /* object *tmp;*/ |
291 | /* object *tmp;*/ |
288 | |
292 | |
289 | if(op->arch!=NULL) { |
293 | if(op->arch!=NULL) { |
290 | strcat(errmsg,"arch "); |
294 | strcat(errmsg,"arch "); |
… | |
… | |
315 | for (tmp=op->inv; tmp; tmp=tmp->below) |
319 | for (tmp=op->inv; tmp; tmp=tmp->below) |
316 | dump_object2(tmp); |
320 | dump_object2(tmp); |
317 | #endif |
321 | #endif |
318 | strcat(errmsg,"end\n"); |
322 | strcat(errmsg,"end\n"); |
319 | } |
323 | } |
|
|
324 | #endif |
320 | } |
325 | } |
321 | |
326 | |
322 | /* |
327 | /* |
323 | * Dumps an object. Returns output in the static global errmsg array. |
328 | * Dumps an object. Returns output in the static global errmsg array. |
324 | */ |
329 | */ |
… | |
… | |
329 | return; |
334 | return; |
330 | } |
335 | } |
331 | errmsg[0]='\0'; |
336 | errmsg[0]='\0'; |
332 | dump_object2(op); |
337 | dump_object2(op); |
333 | } |
338 | } |
334 | |
|
|
335 | /* GROS - Dumps an object. Return the result into a string */ |
|
|
336 | /* Note that no checking is done for the validity of the target string, so */ |
|
|
337 | /* you need to be sure that you allocated enough space for it. */ |
|
|
338 | void dump_me(object *op, char *outstr) |
|
|
339 | { |
|
|
340 | char *cp; |
|
|
341 | |
|
|
342 | if(op==NULL) |
|
|
343 | { |
|
|
344 | strcpy(outstr,"[NULL pointer]"); |
|
|
345 | return; |
|
|
346 | } |
|
|
347 | outstr[0]='\0'; |
|
|
348 | |
|
|
349 | if(op->arch!=NULL) |
|
|
350 | { |
|
|
351 | strcat(outstr,"arch "); |
|
|
352 | strcat(outstr,op->arch->name?op->arch->name:"(null)"); |
|
|
353 | strcat(outstr,"\n"); |
|
|
354 | if((cp=get_ob_diff(op,&empty_archetype->clone))!=NULL) |
|
|
355 | strcat(outstr,cp); |
|
|
356 | strcat(outstr,"end\n"); |
|
|
357 | } |
|
|
358 | else |
|
|
359 | { |
|
|
360 | strcat(outstr,"Object "); |
|
|
361 | if (op->name==NULL) |
|
|
362 | strcat(outstr, "(null)"); |
|
|
363 | else |
|
|
364 | strcat(outstr,op->name); |
|
|
365 | strcat(outstr,"\n"); |
|
|
366 | strcat(outstr,"end\n"); |
|
|
367 | } |
|
|
368 | } |
|
|
369 | |
|
|
370 | /* |
|
|
371 | * This is really verbose...Can be triggered by the P key while in DM mode. |
|
|
372 | * All objects are dumped to stderr (or alternate logfile, if in server-mode) |
|
|
373 | */ |
|
|
374 | |
339 | |
375 | void dump_all_objects(void) { |
340 | void dump_all_objects(void) { |
376 | object *op; |
341 | object *op; |
377 | for(op=objects;op!=NULL;op=op->next) { |
342 | for(op=objects;op!=NULL;op=op->next) { |
378 | dump_object(op); |
343 | dump_object(op); |