Ok
Does obj->in_room == in_obj->in_room?
Yes, it is the same if "obj" sitting in the room.
Instead change if the "obj" is inside another object that sitting in the room.
Looking the for cicle we had:
for( in_obj = obj; in_obj->in_obj; in_obj = in_obj->in_obj )
;
1) obj lies directly in room?
in_obj->in_obj; check fails, so: obj->in_room == in_obj->in_room and point to the room.
This because
in_obj = obj;.
2) obj is directly carried_by?
in_obj->in_obj; check again fails, so: obj->in_room is NULL and in_obj->in_room is NULL.
This because
in_obj = obj; ...but in_obj->carried_by is TRUE and also obj->carryed_by is TRUE).
3) obj stay inside another object that lies in room?
in_obj->in_obj; ckeck is TRUE, and
in_obj = in_obj->in_obj change the assign of in_obj pointer that became different from obj.
So obj->in_room is NULL but in_obj->in_room point to the room.
4) obj is inside another object that's carryed_by?
in_obj->in_obj; check is TRUE and
in_obj = in_obj->in_obj change the assign of in_obj pointer that became different from obj.
So: obj->in_room is NULL, also in_obj->in_room is NULL, obj->carried_by is NULL, but in_obj->carried_by is TRUE and in_obj->carried_by->in_room point to the room.
In conclusion, using my mod, the set_supermob function change only in case (3).