1 | /* |
1 | /* |
2 | * static char *rcsid_object_c = |
2 | * static char *rcsid_object_c = |
3 | * "$Id: object.C,v 1.22 2006/09/10 00:51:23 root Exp $"; |
3 | * "$Id: object.C,v 1.23 2006/09/10 14:54:02 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 | |
… | |
… | |
529 | SET_FLAG (this, FLAG_REMOVED); |
529 | SET_FLAG (this, FLAG_REMOVED); |
530 | } |
530 | } |
531 | |
531 | |
532 | void object::clone (object *destination) |
532 | void object::clone (object *destination) |
533 | { |
533 | { |
534 | *(object_copy *)destination = *(object_copy *)this; |
534 | *(object_copy *)destination = *this; |
535 | *(object_pod *)destination = *(object_pod *)this; |
535 | *(object_pod *)destination = *this; |
536 | |
536 | |
537 | if (self || cb) |
537 | if (self || cb) |
538 | INVOKE_OBJECT (CLONE, this, ARG_OBJECT (destination)); |
538 | INVOKE_OBJECT (CLONE, this, ARG_OBJECT (destination)); |
539 | } |
539 | } |
540 | |
540 | |
… | |
… | |
590 | |
590 | |
591 | if (op2->speed < 0) |
591 | if (op2->speed < 0) |
592 | op->speed_left = op2->speed_left - RANDOM() % 200 / 100.0; |
592 | op->speed_left = op2->speed_left - RANDOM() % 200 / 100.0; |
593 | |
593 | |
594 | /* Copy over key_values, if any. */ |
594 | /* Copy over key_values, if any. */ |
595 | if (op2->key_values != NULL) |
595 | if (op2->key_values) |
596 | { |
596 | { |
597 | key_value *tail = NULL; |
597 | key_value *tail = 0; |
598 | key_value *i; |
598 | key_value *i; |
599 | |
599 | |
600 | op->key_values = NULL; |
600 | op->key_values = 0; |
601 | |
601 | |
602 | for (i = op2->key_values; i != NULL; i = i->next) |
602 | for (i = op2->key_values; i; i = i->next) |
603 | { |
603 | { |
604 | key_value *new_link = new key_value; |
604 | key_value *new_link = new key_value; |
605 | |
605 | |
606 | new_link->next = NULL; |
606 | new_link->next = 0; |
607 | new_link->key = i->key; |
607 | new_link->key = i->key; |
608 | new_link->value = i->value; |
608 | new_link->value = i->value; |
609 | |
609 | |
610 | /* Try and be clever here, too. */ |
610 | /* Try and be clever here, too. */ |
611 | if (op->key_values == NULL) |
611 | if (!op->key_values) |
612 | { |
612 | { |
613 | op->key_values = new_link; |
613 | op->key_values = new_link; |
614 | tail = new_link; |
614 | tail = new_link; |
615 | } |
615 | } |
616 | else |
616 | else |