… | |
… | |
186 | bool object::can_merge_slow (object *ob1, object *ob2) |
186 | bool object::can_merge_slow (object *ob1, object *ob2) |
187 | { |
187 | { |
188 | /* A couple quicksanity checks */ |
188 | /* A couple quicksanity checks */ |
189 | if (ob1 == ob2 |
189 | if (ob1 == ob2 |
190 | || ob1->type != ob2->type |
190 | || ob1->type != ob2->type |
191 | || ob1->speed != ob2->speed |
191 | || fabs (ob1->speed - ob2->speed) < MIN_ACTIVE_SPEED |
192 | || ob1->value != ob2->value |
192 | || ob1->value != ob2->value |
193 | || ob1->name != ob2->name) |
193 | || ob1->name != ob2->name) |
194 | return 0; |
194 | return 0; |
195 | |
195 | |
196 | /* Do not merge objects if nrof would overflow, assume nrof |
196 | /* Do not merge objects if nrof would overflow, assume nrof |
… | |
… | |
230 | || ob1->move_block != ob2->move_block |
230 | || ob1->move_block != ob2->move_block |
231 | || ob1->move_allow != ob2->move_allow |
231 | || ob1->move_allow != ob2->move_allow |
232 | || ob1->move_on != ob2->move_on |
232 | || ob1->move_on != ob2->move_on |
233 | || ob1->move_off != ob2->move_off |
233 | || ob1->move_off != ob2->move_off |
234 | || ob1->move_slow != ob2->move_slow |
234 | || ob1->move_slow != ob2->move_slow |
235 | || ob1->move_slow_penalty != ob2->move_slow_penalty |
235 | || fabs (ob1->move_slow_penalty - ob2->move_slow_penalty) < (1.f / 1024.f) |
236 | || memcmp (&ob1->resist, &ob2->resist, sizeof (ob1->resist)) |
236 | || memcmp (&ob1->resist, &ob2->resist, sizeof (ob1->resist)) |
237 | || memcmp (&ob1->stats , &ob2->stats , sizeof (ob1->stats))) |
237 | || memcmp (&ob1->stats , &ob2->stats , sizeof (ob1->stats))) |
238 | return 0; |
238 | return 0; |
239 | |
239 | |
240 | if ((ob1->flag ^ ob2->flag) |
240 | if ((ob1->flag ^ ob2->flag) |
… | |
… | |
679 | * This function needs to be called whenever the speed of an object changes. |
679 | * This function needs to be called whenever the speed of an object changes. |
680 | */ |
680 | */ |
681 | void |
681 | void |
682 | object::set_speed (float speed) |
682 | object::set_speed (float speed) |
683 | { |
683 | { |
684 | if (flag [FLAG_FREED] && speed) |
|
|
685 | { |
|
|
686 | LOG (llevError, "Object %s is freed but has speed.\n", &name); |
|
|
687 | speed = 0; |
|
|
688 | } |
|
|
689 | |
|
|
690 | this->speed = speed; |
684 | this->speed = speed; |
691 | |
685 | |
692 | if (has_active_speed ()) |
686 | if (has_active_speed ()) |
693 | activate (); |
687 | activate (); |
694 | else |
688 | else |
… | |
… | |
744 | |
738 | |
745 | if (!(m.flags_ & P_UPTODATE)) |
739 | if (!(m.flags_ & P_UPTODATE)) |
746 | /* nop */; |
740 | /* nop */; |
747 | else if (action == UP_OBJ_INSERT) |
741 | else if (action == UP_OBJ_INSERT) |
748 | { |
742 | { |
|
|
743 | #if 0 |
749 | // this is likely overkill, TODO: revisit (schmorp) |
744 | // this is likely overkill, TODO: revisit (schmorp) |
750 | if ((QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(m.flags_ & P_BLOCKSVIEW)) |
745 | if ((QUERY_FLAG (op, FLAG_BLOCKSVIEW) && !(m.flags_ & P_BLOCKSVIEW)) |
751 | || (QUERY_FLAG (op, FLAG_NO_MAGIC) && !(m.flags_ & P_NO_MAGIC)) |
746 | || (QUERY_FLAG (op, FLAG_NO_MAGIC) && !(m.flags_ & P_NO_MAGIC)) |
752 | || (op->is_player () && !(m.flags_ & P_PLAYER)) |
747 | || (op->is_player () && !(m.flags_ & P_PLAYER)) |
753 | || (op->type == SAFE_GROUND && !(m.flags_ & P_SAFE)) |
748 | || (op->type == SAFE_GROUND && !(m.flags_ & P_SAFE)) |
… | |
… | |
758 | || (m.move_slow | op->move_slow) != m.move_slow |
753 | || (m.move_slow | op->move_slow) != m.move_slow |
759 | /* This isn't perfect, but I don't expect a lot of objects to |
754 | /* This isn't perfect, but I don't expect a lot of objects to |
760 | * have move_allow right now. |
755 | * have move_allow right now. |
761 | */ |
756 | */ |
762 | || ((m.move_block | op->move_block) & ~op->move_allow) != m.move_block |
757 | || ((m.move_block | op->move_block) & ~op->move_allow) != m.move_block |
763 | || 1) // the above is not strong enough a test to skip updating. los maybe? TODO (Schmorp) |
|
|
764 | m.invalidate (); |
758 | m.invalidate (); |
|
|
759 | #else |
|
|
760 | // the above is not strong enough a test to skip updating. los maybe? TODO (schmorp) |
|
|
761 | m.invalidate (); |
|
|
762 | #endif |
765 | } |
763 | } |
766 | /* if the object is being removed, we can't make intelligent |
764 | /* if the object is being removed, we can't make intelligent |
767 | * decisions, because remove_ob can't really pass the object |
765 | * decisions, because remove_ob can't really pass the object |
768 | * that is being removed. |
766 | * that is being removed. |
769 | */ |
767 | */ |