1 | /* |
1 | /* |
2 | * static char *rcsid_utils_c = |
2 | * static char *rcsid_utils_c = |
3 | * "$Id: utils.C,v 1.2 2006/08/29 08:01:36 root Exp $"; |
3 | * "$Id: utils.C,v 1.3 2006/09/03 00:18:40 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 | |
… | |
… | |
284 | if (!IS_ARMOR(op)) |
284 | if (!IS_ARMOR(op)) |
285 | return; |
285 | return; |
286 | |
286 | |
287 | mt = name_to_material(op->materialname); |
287 | mt = name_to_material(op->materialname); |
288 | if (!mt) { |
288 | if (!mt) { |
289 | LOG(llevError, "archetype '%s>%s' uses nonexistent material '%s'\n", op->arch->name, op->name, op->materialname); |
289 | LOG(llevError, "archetype '%s>%s' uses nonexistent material '%s'\n", &op->arch->name, &op->name, &op->materialname); |
290 | return; |
290 | return; |
291 | } |
291 | } |
292 | |
292 | |
293 | for (j=0; j < NROFATTACKS; j++) |
293 | for (j=0; j < NROFATTACKS; j++) |
294 | if (op->resist[j] == 0 && change->resist[j] != 0) { |
294 | if (op->resist[j] == 0 && change->resist[j] != 0) { |
… | |
… | |
336 | lmt = nmt; |
336 | lmt = nmt; |
337 | } |
337 | } |
338 | |
338 | |
339 | if (lmt != NULL) { |
339 | if (lmt != NULL) { |
340 | #ifndef NEW_MATERIAL_CODE |
340 | #ifndef NEW_MATERIAL_CODE |
341 | op->materialname = add_string(lmt->name); |
341 | op->materialname = lmt->name; |
342 | return; |
342 | return; |
343 | #else |
343 | #else |
344 | |
344 | |
345 | if (op->stats.dam && IS_WEAPON(op)) { |
345 | if (op->stats.dam && IS_WEAPON(op)) { |
346 | op->stats.dam += lmt->damage; |
346 | op->stats.dam += lmt->damage; |
… | |
… | |
480 | strcat(input, p); |
480 | strcat(input, p); |
481 | } |
481 | } |
482 | else strcpy(input, tmp); |
482 | else strcpy(input, tmp); |
483 | return; |
483 | return; |
484 | } |
484 | } |
|
|
485 | |
|
|
486 | void * |
|
|
487 | zero_initialised::operator new (size_t s) |
|
|
488 | { |
|
|
489 | void *p = malloc (s); |
|
|
490 | |
|
|
491 | memset (p, 0, s); |
|
|
492 | return p; |
|
|
493 | } |
|
|
494 | |
|
|
495 | void |
|
|
496 | zero_initialised::operator delete (void *p, size_t s) |
|
|
497 | { |
|
|
498 | free (p); |
|
|
499 | } |
|
|
500 | |