… | |
… | |
867 | * checker with a matching item, has it, activates the connection, throws the item |
867 | * checker with a matching item, has it, activates the connection, throws the item |
868 | * away, and then leaves the inventory checker. That would've caused an always-enabled |
868 | * away, and then leaves the inventory checker. That would've caused an always-enabled |
869 | * state in the inventory checker. This won't happen anymore now. |
869 | * state in the inventory checker. This won't happen anymore now. |
870 | * |
870 | * |
871 | */ |
871 | */ |
872 | |
|
|
873 | void |
872 | void |
874 | check_inv (object *op, object *trig) |
873 | check_inv (object *op, object *trig) |
875 | { |
874 | { |
876 | object *match = 0; |
|
|
877 | |
|
|
878 | trig->value = 0; // deactivate if none of the following conditions apply |
875 | trig->value = 0; // deactivate if none of the following conditions apply |
879 | |
876 | |
880 | for (object *tmp = trig->above; tmp; tmp = tmp->above) |
877 | if (object *pl = trig->ms ().player ()) |
881 | if (tmp->type == PLAYER) |
|
|
882 | { |
878 | { |
883 | object *match = check_inv_recursive (tmp, trig); |
879 | object *match = check_inv_recursive (pl, trig); |
884 | |
880 | |
885 | if (match && trig->last_sp) // match == having |
881 | if (match && trig->last_sp) // match == having |
886 | { |
882 | { |
887 | if (trig->last_heal) |
883 | if (trig->last_heal) |
888 | decrease_ob (match); |
884 | decrease_ob (match); |
889 | |
885 | |
890 | trig->value = 1; |
|
|
891 | } |
|
|
892 | else if (!match && !trig->last_sp) // match == not having |
|
|
893 | trig->value = 1; |
886 | trig->value = 1; |
894 | |
|
|
895 | break; |
|
|
896 | } |
887 | } |
|
|
888 | else if (!match && !trig->last_sp) // match == not having |
|
|
889 | trig->value = 1; |
|
|
890 | } |
897 | |
891 | |
898 | push_button (trig); |
892 | push_button (trig); |
899 | } |
893 | } |
900 | |
894 | |