… | |
… | |
828 | Care must be taken that the next item pointer is not to money as |
828 | Care must be taken that the next item pointer is not to money as |
829 | the drop() routine will do unknown things to it when dropping |
829 | the drop() routine will do unknown things to it when dropping |
830 | in a shop. --Tero.Pelander@utu.fi |
830 | in a shop. --Tero.Pelander@utu.fi |
831 | */ |
831 | */ |
832 | |
832 | |
|
|
833 | int cnt = MAX_ITEM_PER_DROP; |
|
|
834 | |
833 | if (params == NULL) |
835 | if (params == NULL) |
834 | { |
836 | { |
835 | while (curinv != NULL) |
837 | while (curinv != NULL) |
836 | { |
838 | { |
837 | nextinv = curinv->below; |
839 | nextinv = curinv->below; |
… | |
… | |
841 | curinv->type != FOOD && curinv->type != KEY && |
843 | curinv->type != FOOD && curinv->type != KEY && |
842 | curinv->type != SPECIAL_KEY && curinv->type != GEM && |
844 | curinv->type != SPECIAL_KEY && curinv->type != GEM && |
843 | !curinv->invisible && (curinv->type != CONTAINER || op->container != curinv)) |
845 | !curinv->invisible && (curinv->type != CONTAINER || op->container != curinv)) |
844 | { |
846 | { |
845 | drop (op, curinv); |
847 | drop (op, curinv); |
|
|
848 | if (--cnt <= 0) break; |
846 | } |
849 | } |
847 | curinv = nextinv; |
850 | curinv = nextinv; |
848 | } |
851 | } |
849 | } |
852 | } |
850 | |
853 | |
… | |
… | |
856 | while (nextinv && nextinv->type == MONEY) |
859 | while (nextinv && nextinv->type == MONEY) |
857 | nextinv = nextinv->below; |
860 | nextinv = nextinv->below; |
858 | if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && ((curinv->type == WEAPON) || (curinv->type == BOW) || (curinv->type == ARROW))) |
861 | if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && ((curinv->type == WEAPON) || (curinv->type == BOW) || (curinv->type == ARROW))) |
859 | { |
862 | { |
860 | drop (op, curinv); |
863 | drop (op, curinv); |
|
|
864 | if (--cnt <= 0) break; |
861 | } |
865 | } |
862 | curinv = nextinv; |
866 | curinv = nextinv; |
863 | } |
867 | } |
864 | } |
868 | } |
865 | |
869 | |
… | |
… | |
871 | while (nextinv && nextinv->type == MONEY) |
875 | while (nextinv && nextinv->type == MONEY) |
872 | nextinv = nextinv->below; |
876 | nextinv = nextinv->below; |
873 | if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && ((curinv->type == ARMOUR) || curinv->type == SHIELD || curinv->type == HELMET)) |
877 | if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && ((curinv->type == ARMOUR) || curinv->type == SHIELD || curinv->type == HELMET)) |
874 | { |
878 | { |
875 | drop (op, curinv); |
879 | drop (op, curinv); |
|
|
880 | if (--cnt <= 0) break; |
876 | } |
881 | } |
877 | curinv = nextinv; |
882 | curinv = nextinv; |
878 | } |
883 | } |
879 | } |
884 | } |
880 | |
885 | |
… | |
… | |
910 | break; |
915 | break; |
911 | default: |
916 | default: |
912 | curinv = nextinv; |
917 | curinv = nextinv; |
913 | break; |
918 | break; |
914 | } |
919 | } |
|
|
920 | if (--cnt <= 0) break; |
915 | } |
921 | } |
916 | curinv = nextinv; |
922 | curinv = nextinv; |
917 | } |
923 | } |
918 | } |
924 | } |
|
|
925 | |
|
|
926 | if (cnt <= 0) |
|
|
927 | op->failmsg (format ( |
|
|
928 | "Droppped only %d items, you can't drop more than that at once.", |
|
|
929 | MAX_ITEM_PER_DROP |
|
|
930 | )); |
919 | |
931 | |
920 | op->contr->ns->floorbox_update (); |
932 | op->contr->ns->floorbox_update (); |
921 | |
933 | |
922 | /* draw_look(op);*/ |
934 | /* draw_look(op);*/ |
923 | return 0; |
935 | return 0; |
… | |
… | |
938 | new_draw_info (NDI_UNIQUE, 0, op, "Drop what?"); |
950 | new_draw_info (NDI_UNIQUE, 0, op, "Drop what?"); |
939 | return 0; |
951 | return 0; |
940 | } |
952 | } |
941 | else |
953 | else |
942 | { |
954 | { |
|
|
955 | int cnt = MAX_ITEM_PER_DROP; |
|
|
956 | |
943 | for (tmp = op->inv; tmp; tmp = next) |
957 | for (tmp = op->inv; tmp; tmp = next) |
944 | { |
958 | { |
945 | next = tmp->below; |
959 | next = tmp->below; |
946 | if (QUERY_FLAG (tmp, FLAG_NO_DROP) || tmp->invisible) |
960 | if (QUERY_FLAG (tmp, FLAG_NO_DROP) || tmp->invisible) |
947 | continue; |
961 | continue; |
|
|
962 | |
948 | if (item_matched_string (op, tmp, params)) |
963 | if (item_matched_string (op, tmp, params)) |
949 | { |
964 | { |
950 | drop (op, tmp); |
965 | drop (op, tmp); |
|
|
966 | if (--cnt <= 0) break; |
951 | did_one = 1; |
967 | did_one = 1; |
952 | } |
968 | } |
953 | } |
969 | } |
|
|
970 | |
954 | if (!did_one) |
971 | if (!did_one) |
955 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing to drop."); |
972 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing to drop."); |
|
|
973 | |
|
|
974 | if (cnt <= 0) |
|
|
975 | op->failmsg (format ( |
|
|
976 | "Droppped only %d items, you can't drop more than that at once.", |
|
|
977 | MAX_ITEM_PER_DROP |
|
|
978 | )); |
956 | } |
979 | } |
957 | if (op->type == PLAYER) |
980 | if (op->type == PLAYER) |
958 | { |
981 | { |
959 | op->contr->count = 0; |
982 | op->contr->count = 0; |
960 | op->contr->ns->floorbox_update (); |
983 | op->contr->ns->floorbox_update (); |