1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
… | |
… | |
67 | |
67 | |
68 | int tmpmatch = item_matched_string (pl, tmp, params); |
68 | int tmpmatch = item_matched_string (pl, tmp, params); |
69 | |
69 | |
70 | if (tmpmatch > match_val) |
70 | if (tmpmatch > match_val) |
71 | { |
71 | { |
72 | if ((aflag == AP_APPLY) && (QUERY_FLAG (tmp, FLAG_APPLIED))) |
72 | if ((aflag == AP_APPLY) && (tmp->flag [FLAG_APPLIED])) |
73 | continue; |
73 | continue; |
74 | |
74 | |
75 | if ((aflag == AP_UNAPPLY) && (!QUERY_FLAG (tmp, FLAG_APPLIED))) |
75 | if ((aflag == AP_UNAPPLY) && (!tmp->flag [FLAG_APPLIED])) |
76 | continue; |
76 | continue; |
77 | |
77 | |
78 | match_val = tmpmatch; |
78 | match_val = tmpmatch; |
79 | best = tmp; |
79 | best = tmp; |
80 | } |
80 | } |
… | |
… | |
150 | * as it includes the object to throw. |
150 | * as it includes the object to throw. |
151 | */ |
151 | */ |
152 | int |
152 | int |
153 | command_throw (object *op, char *params) |
153 | command_throw (object *op, char *params) |
154 | { |
154 | { |
155 | if (object *skop = find_skill_by_name (op, skill_names[SK_THROWING])) |
155 | if (object *skop = find_skill_by_name (op, shstr_throwing)) |
156 | return do_skill (op, op, skop, op->facing, params); |
156 | return do_skill (op, op, skop, op->facing, params); |
157 | else |
157 | else |
158 | new_draw_info (NDI_UNIQUE, 0, op, "You have no knowledge of the throwing skill."); |
158 | new_draw_info (NDI_UNIQUE, 0, op, "You have no knowledge of the throwing skill."); |
159 | |
159 | |
160 | return 0; |
160 | return 0; |
… | |
… | |
209 | * not need to use split_ob and stuff. |
209 | * not need to use split_ob and stuff. |
210 | */ |
210 | */ |
211 | int |
211 | int |
212 | sack_can_hold (object *pl, object *sack, object *op, uint32 nrof) |
212 | sack_can_hold (object *pl, object *sack, object *op, uint32 nrof) |
213 | { |
213 | { |
214 | if (!QUERY_FLAG (sack, FLAG_APPLIED)) |
214 | if (!sack->flag [FLAG_APPLIED]) |
215 | { |
215 | { |
216 | new_draw_info_format (NDI_UNIQUE, 0, pl, "The %s is not active.", query_name (sack)); |
216 | new_draw_info_format (NDI_UNIQUE, 0, pl, "The %s is not active.", query_name (sack)); |
217 | return 0; |
217 | return 0; |
218 | } |
218 | } |
219 | |
219 | |
… | |
… | |
264 | /* IF the player is flying & trying to take the item out of a container |
264 | /* IF the player is flying & trying to take the item out of a container |
265 | * that is in his inventory, let him. tmp->env points to the container |
265 | * that is in his inventory, let him. tmp->env points to the container |
266 | * (sack, luggage, etc), tmp->env->env then points to the player (nested |
266 | * (sack, luggage, etc), tmp->env->env then points to the player (nested |
267 | * containers not allowed as of now) |
267 | * containers not allowed as of now) |
268 | */ |
268 | */ |
269 | if ((pl->move_type & MOVE_FLYING) && !QUERY_FLAG (pl, FLAG_WIZ) && tmp->in_player () != pl) |
269 | if ((pl->move_type & MOVE_FLYING) && !pl->flag [FLAG_WIZ] && tmp->in_player () != pl) |
270 | { |
270 | { |
271 | pl->failmsg ("You are levitating, you can't reach the ground! " |
271 | pl->failmsg ("You are levitating, you can't reach the ground! " |
272 | "H<You have to stop levitating first, if you can, either by using your levitation skill, " |
272 | "H<You have to stop levitating first, if you can, either by using your levitation skill, " |
273 | "or waiting till the levitation effect wears off.>"); |
273 | "or waiting till the levitation effect wears off.>"); |
274 | return; |
274 | return; |
275 | } |
275 | } |
276 | |
276 | |
277 | if (QUERY_FLAG (tmp, FLAG_NO_DROP)) |
277 | if (tmp->flag [FLAG_NO_DROP]) |
278 | return; |
278 | return; |
279 | |
279 | |
280 | if (nrof > tmp_nrof || nrof <= 0) |
280 | if (nrof > tmp_nrof || nrof <= 0) |
281 | nrof = tmp_nrof; |
281 | nrof = tmp_nrof; |
282 | |
282 | |
… | |
… | |
294 | } |
294 | } |
295 | |
295 | |
296 | if (!can_split (pl, tmp, nrof)) |
296 | if (!can_split (pl, tmp, nrof)) |
297 | return; |
297 | return; |
298 | |
298 | |
299 | if (QUERY_FLAG (tmp, FLAG_UNPAID)) |
299 | if (tmp->flag [FLAG_UNPAID]) |
300 | { |
300 | { |
301 | tmp->flag.reset (FLAG_UNPAID); |
301 | tmp->flag.reset (FLAG_UNPAID); |
302 | new_draw_info_format (NDI_UNIQUE, 0, pl, "%s will cost you %s.", query_name (tmp), query_cost_string (tmp, pl, F_BUY | F_SHOP)); |
302 | new_draw_info_format (NDI_UNIQUE, 0, pl, "%s will cost you %s.", query_name (tmp), query_cost_string (tmp, pl, F_BUY | F_SHOP)); |
303 | tmp->flag.set (FLAG_UNPAID); |
303 | tmp->flag.set (FLAG_UNPAID); |
304 | } |
304 | } |
… | |
… | |
367 | goto leave; |
367 | goto leave; |
368 | } |
368 | } |
369 | else |
369 | else |
370 | { /* non container pickup */ |
370 | { /* non container pickup */ |
371 | for (alt = op->inv; alt; alt = alt->below) |
371 | for (alt = op->inv; alt; alt = alt->below) |
372 | if (alt->type == CONTAINER && QUERY_FLAG (alt, FLAG_APPLIED) && |
372 | if (alt->type == CONTAINER && alt->flag [FLAG_APPLIED] && |
373 | alt->race && alt->race == tmp->race && sack_can_hold (NULL, alt, tmp, count)) |
373 | alt->race && alt->race == tmp->race && sack_can_hold (NULL, alt, tmp, count)) |
374 | break; /* perfect match */ |
374 | break; /* perfect match */ |
375 | |
375 | |
376 | if (!alt) |
376 | if (!alt) |
377 | for (alt = op->inv; alt; alt = alt->below) |
377 | for (alt = op->inv; alt; alt = alt->below) |
378 | if (alt->type == CONTAINER && QUERY_FLAG (alt, FLAG_APPLIED) && sack_can_hold (NULL, alt, tmp, count)) |
378 | if (alt->type == CONTAINER && alt->flag [FLAG_APPLIED] && sack_can_hold (NULL, alt, tmp, count)) |
379 | break; /* General container comes next */ |
379 | break; /* General container comes next */ |
380 | |
380 | |
381 | if (!alt) |
381 | if (!alt) |
382 | alt = op; /* No free containers */ |
382 | alt = op; /* No free containers */ |
383 | } |
383 | } |
… | |
… | |
393 | #ifdef PICKUP_DEBUG |
393 | #ifdef PICKUP_DEBUG |
394 | LOG (llevDebug, "Pick_up(): %s picks %s (%d) and inserts it %s.\n", op->name, tmp->name, op->contr->count, alt->name); |
394 | LOG (llevDebug, "Pick_up(): %s picks %s (%d) and inserts it %s.\n", op->name, tmp->name, op->contr->count, alt->name); |
395 | #endif |
395 | #endif |
396 | |
396 | |
397 | /* startequip items are not allowed to be put into containers: */ |
397 | /* startequip items are not allowed to be put into containers: */ |
398 | if (op->type == PLAYER && alt->type == CONTAINER && QUERY_FLAG (tmp, FLAG_STARTEQUIP)) |
398 | if (op->type == PLAYER && alt->type == CONTAINER && tmp->flag [FLAG_STARTEQUIP]) |
399 | { |
399 | { |
400 | new_draw_info (NDI_UNIQUE, 0, op, "This object cannot be put into containers!"); |
400 | new_draw_info (NDI_UNIQUE, 0, op, "This object cannot be put into containers!"); |
401 | goto leave; |
401 | goto leave; |
402 | } |
402 | } |
403 | |
403 | |
… | |
… | |
517 | char buf[MAX_BUF]; |
517 | char buf[MAX_BUF]; |
518 | |
518 | |
519 | if (sack == tmp) |
519 | if (sack == tmp) |
520 | return; /* Can't put an object in itself */ |
520 | return; /* Can't put an object in itself */ |
521 | |
521 | |
522 | if (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || QUERY_FLAG (tmp, FLAG_NO_DROP)) |
522 | if (tmp->flag [FLAG_STARTEQUIP] || tmp->flag [FLAG_NO_DROP]) |
523 | { |
523 | { |
524 | new_draw_info_format (NDI_UNIQUE, 0, op, "You cannot put the %s in the %s.", query_name (tmp), query_name (sack)); |
524 | new_draw_info_format (NDI_UNIQUE, 0, op, "You cannot put the %s in the %s.", query_name (tmp), query_name (sack)); |
525 | return; |
525 | return; |
526 | } |
526 | } |
527 | |
527 | |
… | |
… | |
555 | * already checked this. |
555 | * already checked this. |
556 | */ |
556 | */ |
557 | if ((sack->type == CONTAINER) && !sack_can_hold (op, sack, tmp, (nrof ? nrof : tmp->nrof))) |
557 | if ((sack->type == CONTAINER) && !sack_can_hold (op, sack, tmp, (nrof ? nrof : tmp->nrof))) |
558 | return; |
558 | return; |
559 | |
559 | |
560 | if (QUERY_FLAG (tmp, FLAG_APPLIED)) |
560 | if (tmp->flag [FLAG_APPLIED]) |
561 | if (!op->apply (tmp, AP_UNAPPLY | AP_NO_MERGE)) |
561 | if (!op->apply (tmp, AP_UNAPPLY | AP_NO_MERGE)) |
562 | return; |
562 | return; |
563 | |
563 | |
564 | /* we want to put some portion of the item into the container */ |
564 | /* we want to put some portion of the item into the container */ |
565 | if (!can_split (op, tmp, nrof)) |
565 | if (!can_split (op, tmp, nrof)) |
… | |
… | |
586 | return; |
586 | return; |
587 | |
587 | |
588 | if (obj->destroyed () || obj->is_inserted ()) |
588 | if (obj->destroyed () || obj->is_inserted ()) |
589 | return; |
589 | return; |
590 | |
590 | |
591 | if (QUERY_FLAG (obj, FLAG_STARTEQUIP)) |
591 | if (obj->flag [FLAG_STARTEQUIP]) |
592 | { |
592 | { |
593 | dropper->statusmsg (format ("You drop the %s.", query_name (obj))); |
593 | dropper->statusmsg (format ("You drop the %s.", query_name (obj))); |
594 | dropper->statusmsg ("The god who lent it to you retrieves it."); |
594 | dropper->statusmsg ("The god who lent it to you retrieves it."); |
595 | |
595 | |
596 | obj->destroy (); |
596 | obj->destroy (); |
… | |
… | |
605 | return; |
605 | return; |
606 | |
606 | |
607 | if (obj->destroyed () || obj->is_inserted ()) |
607 | if (obj->destroyed () || obj->is_inserted ()) |
608 | return; |
608 | return; |
609 | |
609 | |
610 | if (dropper->is_in_shop () && !QUERY_FLAG (obj, FLAG_UNPAID) && obj->type != MONEY) |
610 | if (dropper->is_in_shop () && !obj->flag [FLAG_UNPAID] && obj->type != MONEY) |
611 | if (!sell_item (obj, dropper)) |
611 | if (!sell_item (obj, dropper)) |
612 | return; |
612 | return; |
613 | |
613 | |
614 | if (!obj->can_drop_at (dropper->map, dropper->x, dropper->y, dropper)) |
614 | if (!obj->can_drop_at (dropper->map, dropper->x, dropper->y, dropper)) |
615 | return; |
615 | return; |
… | |
… | |
631 | * This is used when dropping objects onto the floor. |
631 | * This is used when dropping objects onto the floor. |
632 | */ |
632 | */ |
633 | void |
633 | void |
634 | drop_object (object *op, object *tmp, uint32 nrof) |
634 | drop_object (object *op, object *tmp, uint32 nrof) |
635 | { |
635 | { |
636 | if (QUERY_FLAG (tmp, FLAG_NO_DROP)) |
636 | if (tmp->flag [FLAG_NO_DROP]) |
637 | return; |
637 | return; |
638 | |
638 | |
639 | if (QUERY_FLAG (tmp, FLAG_APPLIED)) |
639 | if (tmp->flag [FLAG_APPLIED]) |
640 | if (!op->apply (tmp, AP_UNAPPLY | AP_NO_MERGE)) |
640 | if (!op->apply (tmp, AP_UNAPPLY | AP_NO_MERGE)) |
641 | return; /* can't unapply it */ |
641 | return; /* can't unapply it */ |
642 | |
642 | |
643 | /* We are only dropping some of the items. We split the current object |
643 | /* We are only dropping some of the items. We split the current object |
644 | * off |
644 | * off |
… | |
… | |
683 | { |
683 | { |
684 | new_draw_info (NDI_UNIQUE, 0, op, "You don't have anything to drop."); |
684 | new_draw_info (NDI_UNIQUE, 0, op, "You don't have anything to drop."); |
685 | return; |
685 | return; |
686 | } |
686 | } |
687 | |
687 | |
688 | if (QUERY_FLAG (tmp, FLAG_INV_LOCKED)) |
688 | if (tmp->flag [FLAG_INV_LOCKED]) |
689 | { |
689 | { |
690 | new_draw_info (NDI_UNIQUE, 0, op, "This item is locked"); |
690 | new_draw_info (NDI_UNIQUE, 0, op, "This item is locked"); |
691 | return; |
691 | return; |
692 | } |
692 | } |
693 | |
693 | |
694 | if (QUERY_FLAG (tmp, FLAG_NO_DROP)) |
694 | if (tmp->flag [FLAG_NO_DROP]) |
695 | { |
695 | { |
696 | #if 0 |
696 | #if 0 |
697 | /* Eneq(@csd.uu.se): Objects with NO_DROP defined can't be dropped. */ |
697 | /* Eneq(@csd.uu.se): Objects with NO_DROP defined can't be dropped. */ |
698 | new_draw_info (NDI_UNIQUE, 0, op, "This item can't be dropped."); |
698 | new_draw_info (NDI_UNIQUE, 0, op, "This item can't be dropped."); |
699 | #endif |
699 | #endif |
… | |
… | |
756 | nextinv = curinv->below; |
756 | nextinv = curinv->below; |
757 | |
757 | |
758 | while (nextinv && nextinv->type == MONEY) |
758 | while (nextinv && nextinv->type == MONEY) |
759 | nextinv = nextinv->below; |
759 | nextinv = nextinv->below; |
760 | |
760 | |
761 | if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) |
761 | if (!curinv->flag [FLAG_INV_LOCKED] |
762 | && curinv->type != MONEY |
762 | && curinv->type != MONEY |
763 | && curinv->type != FOOD |
763 | && curinv->type != FOOD |
764 | && curinv->type != KEY |
764 | && curinv->type != KEY |
765 | && curinv->type != SPECIAL_KEY |
765 | && curinv->type != SPECIAL_KEY |
766 | && curinv->type != GEM |
766 | && curinv->type != GEM |
… | |
… | |
781 | nextinv = curinv->below; |
781 | nextinv = curinv->below; |
782 | |
782 | |
783 | while (nextinv && nextinv->type == MONEY) |
783 | while (nextinv && nextinv->type == MONEY) |
784 | nextinv = nextinv->below; |
784 | nextinv = nextinv->below; |
785 | |
785 | |
786 | if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && ((curinv->type == WEAPON) || (curinv->type == BOW) || (curinv->type == ARROW))) |
786 | if (!curinv->flag [FLAG_INV_LOCKED] && ((curinv->type == WEAPON) || (curinv->type == BOW) || (curinv->type == ARROW))) |
787 | { |
787 | { |
788 | drop (op, curinv); |
788 | drop (op, curinv); |
789 | if (--cnt <= 0) break; |
789 | if (--cnt <= 0) break; |
790 | } |
790 | } |
791 | |
791 | |
… | |
… | |
799 | nextinv = curinv->below; |
799 | nextinv = curinv->below; |
800 | |
800 | |
801 | while (nextinv && nextinv->type == MONEY) |
801 | while (nextinv && nextinv->type == MONEY) |
802 | nextinv = nextinv->below; |
802 | nextinv = nextinv->below; |
803 | |
803 | |
804 | if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && ((curinv->type == ARMOUR) || curinv->type == SHIELD || curinv->type == HELMET)) |
804 | if (!curinv->flag [FLAG_INV_LOCKED] && ((curinv->type == ARMOUR) || curinv->type == SHIELD || curinv->type == HELMET)) |
805 | { |
805 | { |
806 | drop (op, curinv); |
806 | drop (op, curinv); |
807 | if (--cnt <= 0) break; |
807 | if (--cnt <= 0) break; |
808 | } |
808 | } |
809 | |
809 | |
… | |
… | |
817 | nextinv = curinv->below; |
817 | nextinv = curinv->below; |
818 | |
818 | |
819 | while (nextinv && nextinv->type == MONEY) |
819 | while (nextinv && nextinv->type == MONEY) |
820 | nextinv = nextinv->below; |
820 | nextinv = nextinv->below; |
821 | |
821 | |
822 | if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && !QUERY_FLAG (curinv, FLAG_APPLIED)) |
822 | if (!curinv->flag [FLAG_INV_LOCKED] && !curinv->flag [FLAG_APPLIED]) |
823 | { |
823 | { |
824 | switch (curinv->type) |
824 | switch (curinv->type) |
825 | { |
825 | { |
826 | case HORN: |
826 | case HORN: |
827 | case BOOK: |
827 | case BOOK: |
… | |
… | |
905 | vector<object *> matched_objs; |
905 | vector<object *> matched_objs; |
906 | |
906 | |
907 | for (tmp = op->inv; tmp; tmp = next) |
907 | for (tmp = op->inv; tmp; tmp = next) |
908 | { |
908 | { |
909 | next = tmp->below; |
909 | next = tmp->below; |
910 | if (QUERY_FLAG (tmp, FLAG_NO_DROP) || tmp->invisible) |
910 | if (tmp->flag [FLAG_NO_DROP] || tmp->invisible) |
911 | continue; |
911 | continue; |
912 | |
912 | |
913 | if (item_matched_string (op, tmp, params)) |
913 | if (item_matched_string (op, tmp, params)) |
914 | matched_objs.push_back (tmp); |
914 | matched_objs.push_back (tmp); |
915 | } |
915 | } |
… | |
… | |
950 | } |
950 | } |
951 | |
951 | |
952 | return 0; |
952 | return 0; |
953 | } |
953 | } |
954 | |
954 | |
955 | /* op should be a player. |
|
|
956 | * we return the object the player has marked with the 'mark' command |
|
|
957 | * below. If no match is found (or object has changed), we return |
|
|
958 | * NULL. We leave it up to the calling function to print messages if |
|
|
959 | * nothing is found. |
|
|
960 | */ |
|
|
961 | object * |
|
|
962 | find_marked_object (object *op) |
|
|
963 | { |
|
|
964 | object *tmp; |
|
|
965 | |
|
|
966 | if (!op || !op->contr) |
|
|
967 | return NULL; |
|
|
968 | |
|
|
969 | if (!op->contr->mark) |
|
|
970 | { |
|
|
971 | /* new_draw_info(NDI_UNIQUE,0,op,"You have no marked object");*/ |
|
|
972 | return 0; |
|
|
973 | } |
|
|
974 | |
|
|
975 | /* This may seem like overkill, but we need to make sure that they |
|
|
976 | * player hasn't dropped the item. We use count on the off chance that |
|
|
977 | * an item got reincarnated at some point. |
|
|
978 | */ |
|
|
979 | for (tmp = op->inv; tmp; tmp = tmp->below) |
|
|
980 | { |
|
|
981 | if (tmp->invisible) |
|
|
982 | continue; |
|
|
983 | |
|
|
984 | if (tmp == op->contr->mark) |
|
|
985 | { |
|
|
986 | if (!tmp->destroyed ()) |
|
|
987 | return tmp; |
|
|
988 | else |
|
|
989 | { |
|
|
990 | op->contr->mark = 0; |
|
|
991 | /* new_draw_info(NDI_UNIQUE,0,op,"You have no marked object");*/ |
|
|
992 | return 0; |
|
|
993 | } |
|
|
994 | } |
|
|
995 | } |
|
|
996 | |
|
|
997 | return 0; |
|
|
998 | } |
|
|
999 | |
|
|
1000 | std::string |
955 | std::string |
1001 | object::describe_monster (object *who) |
956 | object::describe_monster (object *who) |
1002 | { |
957 | { |
1003 | dynbuf_text buf (512, 512); |
958 | dynbuf_text buf (512, 512); |
1004 | |
959 | |
1005 | object *mon = head ? head : this; |
960 | object *mon = head ? head : this; |
1006 | |
961 | |
1007 | if (QUERY_FLAG (mon, FLAG_UNDEAD)) |
962 | if (mon->flag [FLAG_UNDEAD]) |
1008 | buf << "It is an undead force.\r"; |
963 | buf << "It is an undead force.\r"; |
1009 | |
964 | |
1010 | if (mon->level > who->level) |
965 | if (mon->level > who->level) |
1011 | buf << "It is likely more powerful than you.\r"; |
966 | buf << "It is likely more powerful than you.\r"; |
1012 | else if (mon->level < who->level) |
967 | else if (mon->level < who->level) |
… | |
… | |
1069 | case SHIELD: |
1024 | case SHIELD: |
1070 | case BOOTS: |
1025 | case BOOTS: |
1071 | case GLOVES: |
1026 | case GLOVES: |
1072 | case AMULET: |
1027 | case AMULET: |
1073 | case GIRDLE: |
1028 | case GIRDLE: |
|
|
1029 | case RANGED: |
1074 | case BOW: |
1030 | case BOW: |
1075 | case ARROW: |
1031 | case ARROW: |
1076 | case CLOAK: |
1032 | case CLOAK: |
1077 | case FOOD: |
1033 | case FOOD: |
1078 | case DRINK: |
1034 | case DRINK: |
… | |
… | |
1253 | */ |
1209 | */ |
1254 | if (params == NULL) |
1210 | if (params == NULL) |
1255 | { |
1211 | { |
1256 | for (object *item = op->inv; item; item = item->below) |
1212 | for (object *item = op->inv; item; item = item->below) |
1257 | { |
1213 | { |
1258 | CLEAR_FLAG(item, FLAG_INV_LOCKED); |
1214 | item->clr_flag (FLAG_INV_LOCKED); |
1259 | //d// new_draw_info (NDI_UNIQUE, 0, op, "unlocked items with null param."); |
1215 | //d// new_draw_info (NDI_UNIQUE, 0, op, "unlocked items with null param."); |
1260 | esrv_update_item (UPD_FLAGS, op, item); |
1216 | esrv_update_item (UPD_FLAGS, op, item); |
1261 | } |
1217 | } |
1262 | return 0; |
1218 | return 0; |
1263 | } |
1219 | } |
… | |
… | |
1266 | * unlock what matches. i.e. unlock material, should unlock all the materials |
1222 | * unlock what matches. i.e. unlock material, should unlock all the materials |
1267 | */ |
1223 | */ |
1268 | for (object *item = op->inv; item; item = item->below) |
1224 | for (object *item = op->inv; item; item = item->below) |
1269 | if (item->name.contains (params)) |
1225 | if (item->name.contains (params)) |
1270 | { |
1226 | { |
1271 | CLEAR_FLAG (item, FLAG_INV_LOCKED); |
1227 | item->clr_flag (FLAG_INV_LOCKED); |
1272 | //d// new_draw_info (NDI_UNIQUE, 0, op, "unlocked items with a param."); |
1228 | //d// new_draw_info (NDI_UNIQUE, 0, op, "unlocked items with a param."); |
1273 | esrv_update_item (UPD_FLAGS, op, item); |
1229 | esrv_update_item (UPD_FLAGS, op, item); |
1274 | } |
1230 | } |
1275 | |
1231 | |
1276 | return 0; |
1232 | return 0; |
… | |
… | |
1283 | */ |
1239 | */ |
1284 | if (params == NULL) |
1240 | if (params == NULL) |
1285 | { |
1241 | { |
1286 | for (object *item = op->inv; item; item = item->below) |
1242 | for (object *item = op->inv; item; item = item->below) |
1287 | { |
1243 | { |
1288 | SET_FLAG (item, FLAG_INV_LOCKED); |
1244 | item->set_flag (FLAG_INV_LOCKED); |
1289 | //d// new_draw_info (NDI_UNIQUE, 0, op, "locked items with null param."); |
1245 | //d// new_draw_info (NDI_UNIQUE, 0, op, "locked items with null param."); |
1290 | esrv_update_item (UPD_FLAGS, op, item); |
1246 | esrv_update_item (UPD_FLAGS, op, item); |
1291 | } |
1247 | } |
1292 | return 0; |
1248 | return 0; |
1293 | } |
1249 | } |
… | |
… | |
1296 | * i.e. lock material, should lock all the materials |
1252 | * i.e. lock material, should lock all the materials |
1297 | */ |
1253 | */ |
1298 | for (object *item = op->inv; item; item = item->below) |
1254 | for (object *item = op->inv; item; item = item->below) |
1299 | if (item->name.contains (params)) |
1255 | if (item->name.contains (params)) |
1300 | { |
1256 | { |
1301 | SET_FLAG (item, FLAG_INV_LOCKED); |
1257 | item->set_flag (FLAG_INV_LOCKED); |
1302 | //d// new_draw_info (NDI_UNIQUE, 0, op, "locked items with param."); |
1258 | //d// new_draw_info (NDI_UNIQUE, 0, op, "locked items with param."); |
1303 | esrv_update_item (UPD_FLAGS, op, item); |
1259 | esrv_update_item (UPD_FLAGS, op, item); |
1304 | } |
1260 | } |
1305 | |
1261 | |
1306 | return 0; |
1262 | return 0; |
… | |
… | |
1313 | int |
1269 | int |
1314 | command_mark (object *op, char *params) |
1270 | command_mark (object *op, char *params) |
1315 | { |
1271 | { |
1316 | if (!params) |
1272 | if (!params) |
1317 | { |
1273 | { |
1318 | if (object *mark = find_marked_object (op)) |
1274 | if (object *mark = op->mark ()) |
1319 | op->statusmsg (format ("%s is marked.", query_name (mark))); |
1275 | op->statusmsg (format ("%s is marked.", query_name (mark))); |
1320 | else |
1276 | else |
1321 | op->failmsg ("You have no marked object."); |
1277 | op->failmsg ("You have no marked object."); |
1322 | } |
1278 | } |
1323 | else |
1279 | else |