| 945 | #include <algorithm> |
| 946 | |
| 947 | static bool AreObjectsAttached(const object *obj1, const object *obj2) { |
| 948 | const bool f_o1_a = (obj1->flags & OF_ATTACHED) != 0; |
| 949 | const bool f_o2_a = (obj2->flags & OF_ATTACHED) != 0; |
| 950 | |
| 951 | if (f_o1_a || f_o2_a) { |
| 952 | const int o1_uh = obj1->attach_ultimate_handle; |
| 953 | const int o2_uh = obj2->attach_ultimate_handle; |
| 954 | |
| 955 | if ((f_o1_a) && ((o1_uh == obj2->handle) || (f_o2_a && (o1_uh == o2_uh)))) |
| 956 | return true; |
| 957 | |
| 958 | if ((f_o2_a) && (o2_uh == obj1->handle)) |
| 959 | return true; |
| 960 | } |
| 961 | |
| 962 | return false; |
| 963 | } |
| 964 | |
| 965 | bool ObjectsAreRelated(int o1, int o2) { |
| 966 | if ((o1 < 0) || (o2 < 0)) |