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 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
… | |
… | |
133 | { |
133 | { |
134 | new_draw_info (NDI_UNIQUE, 0, pl, "Usage: ready_skill <skill name>"); |
134 | new_draw_info (NDI_UNIQUE, 0, pl, "Usage: ready_skill <skill name>"); |
135 | return 0; |
135 | return 0; |
136 | } |
136 | } |
137 | |
137 | |
138 | skill = find_skill_by_name (pl, params); |
138 | skill = find_skill_by_name_fuzzy (pl, params); |
139 | |
139 | |
140 | if (!skill) |
140 | if (!skill) |
141 | { |
141 | { |
142 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You have no knowledge of the skill %s", params); |
142 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You have no knowledge of the skill %s", params); |
143 | return 0; |
143 | return 0; |
144 | } |
144 | } |
145 | |
145 | |
146 | pl->change_skill (0); |
146 | pl->change_skill (0); |
147 | apply_special (pl, skill, AP_APPLY); |
147 | apply_special (pl, skill, AP_APPLY); |
148 | return 1; |
148 | return 1; |
149 | } |
|
|
150 | |
|
|
151 | /* These functions (command_search, command_disarm) are really just wrappers for |
|
|
152 | * things like 'use_skill ...'). In fact, they should really be obsoleted |
|
|
153 | * and replaced with those. |
|
|
154 | */ |
|
|
155 | int |
|
|
156 | command_search (object *op, char *params) |
|
|
157 | { |
|
|
158 | return use_skill (op, skill_names[SK_FIND_TRAPS]); |
|
|
159 | } |
|
|
160 | |
|
|
161 | int |
|
|
162 | command_disarm (object *op, char *params) |
|
|
163 | { |
|
|
164 | return use_skill (op, skill_names[SK_DISARM_TRAPS]); |
|
|
165 | } |
149 | } |
166 | |
150 | |
167 | /* A little special because we do want to pass the full params along |
151 | /* A little special because we do want to pass the full params along |
168 | * as it includes the object to throw. |
152 | * as it includes the object to throw. |
169 | */ |
153 | */ |
… | |
… | |
520 | |
504 | |
521 | return 0; |
505 | return 0; |
522 | } |
506 | } |
523 | |
507 | |
524 | /* |
508 | /* |
525 | * This function was part of drop, now is own function. |
509 | * This function was part of drop, now is own function. |
526 | * Player 'op' tries to put object 'tmp' into sack 'sack', |
510 | * Player 'op' tries to put object 'tmp' into sack 'sack', |
527 | * if nrof is non zero, then nrof objects is tried to put into sack. |
511 | * if nrof is non zero, then nrof objects is tried to put into sack. |
|
|
512 | * |
528 | * Note that the 'sack' in question can now be a transport, |
513 | * Note that the 'sack' in question can now be a transport, |
529 | * so this function isn't named very good anymore. |
514 | * so this function isn't named very good anymore. |
530 | */ |
515 | */ |
531 | void |
516 | void |
532 | put_object_in_sack (object *op, object *sack, object *tmp, uint32 nrof) |
517 | put_object_in_sack (object *op, object *sack, object *tmp, uint32 nrof) |
… | |
… | |
609 | * off |
594 | * off |
610 | */ |
595 | */ |
611 | if (!can_split (op, tmp, nrof)) |
596 | if (!can_split (op, tmp, nrof)) |
612 | return; |
597 | return; |
613 | |
598 | |
|
|
599 | drop_object (op, tmp); |
|
|
600 | |
|
|
601 | if (!tmp->destroyed () && !tmp->is_inserted ()) |
|
|
602 | { |
|
|
603 | // if nothing happened with the object we give it back |
|
|
604 | op->insert (tmp); |
|
|
605 | } |
|
|
606 | } |
|
|
607 | |
|
|
608 | /* In contrast to drop_object (op, tmp, nrof) above this function takes the |
|
|
609 | * already split off object, and feeds it to the event handlers and does |
|
|
610 | * other magic with it. |
|
|
611 | * |
|
|
612 | * <droppper> is the object that dropped this object and <obj> is the |
|
|
613 | * object that was dropped. |
|
|
614 | * |
|
|
615 | * Make sure to check what happened with <obj> after this function returns! |
|
|
616 | * Otherwise you may leak this object. |
|
|
617 | */ |
|
|
618 | |
|
|
619 | void |
|
|
620 | drop_object (object *dropper, object *obj) |
|
|
621 | { |
614 | if (INVOKE_OBJECT (DROP, tmp, ARG_OBJECT (op))) |
622 | if (INVOKE_OBJECT (DROP, obj, ARG_OBJECT (dropper))) |
615 | return; |
623 | return; |
|
|
624 | |
|
|
625 | if (obj->destroyed () || obj->is_inserted ()) |
|
|
626 | return; |
616 | |
627 | |
617 | if (QUERY_FLAG (tmp, FLAG_STARTEQUIP)) |
628 | if (QUERY_FLAG (obj, FLAG_STARTEQUIP)) |
618 | { |
629 | { |
619 | op->statusmsg (format ("You drop the %s.", query_name (tmp))); |
630 | dropper->statusmsg (format ("You drop the %s.", query_name (obj))); |
620 | op->statusmsg ("The god who lent it to you retrieves it."); |
631 | dropper->statusmsg ("The god who lent it to you retrieves it."); |
621 | |
632 | |
622 | tmp->destroy (); |
633 | obj->destroy (); |
623 | op->update_stats (); |
634 | dropper->update_stats (); |
624 | return; |
635 | return; |
625 | } |
636 | } |
626 | |
637 | |
627 | /* Call this before we update the various windows/players. At least |
638 | for (object *floor = GET_MAP_OB (dropper->map, dropper->x, dropper->y); |
628 | * that we, we know the weight is correct. |
639 | floor; |
|
|
640 | floor = floor->above) |
|
|
641 | if (INVOKE_OBJECT (DROP_ON, floor, ARG_OBJECT (obj), ARG_OBJECT (dropper))) |
|
|
642 | return; |
|
|
643 | |
|
|
644 | if (obj->destroyed () || obj->is_inserted ()) |
|
|
645 | return; |
|
|
646 | |
|
|
647 | if (is_in_shop (dropper) && !QUERY_FLAG (obj, FLAG_UNPAID) && obj->type != MONEY) |
|
|
648 | if (!sell_item (obj, dropper)) |
|
|
649 | return; |
|
|
650 | |
|
|
651 | /* If nothing special happened with this object, the default action is to |
|
|
652 | * insert it below the dropper: |
629 | */ |
653 | */ |
630 | // 2007-11-26: moved op->update_stats away and calling it later after |
|
|
631 | // all items of a drop command have been processed. |
|
|
632 | |
654 | |
633 | for (object *floor = GET_MAP_OB (op->map, op->x, op->y); floor; floor = floor->above) |
655 | obj->x = dropper->x; |
634 | if (INVOKE_OBJECT (DROP_ON, floor, ARG_OBJECT (tmp), ARG_OBJECT (op))) |
656 | obj->y = dropper->y; |
635 | return; |
|
|
636 | |
657 | |
637 | if (is_in_shop (op) && !QUERY_FLAG (tmp, FLAG_UNPAID) && tmp->type != MONEY) |
|
|
638 | { |
|
|
639 | if (!sell_item (tmp, op)) |
|
|
640 | { |
|
|
641 | // if we can't sell it we don't drop it, so give it back to the seller |
|
|
642 | op->insert (tmp); |
|
|
643 | return; |
|
|
644 | } |
|
|
645 | } |
|
|
646 | |
|
|
647 | tmp->x = op->x; |
|
|
648 | tmp->y = op->y; |
|
|
649 | |
|
|
650 | insert_ob_in_map (tmp, op->map, op, INS_BELOW_ORIGINATOR); |
658 | insert_ob_in_map (obj, dropper->map, dropper, INS_BELOW_ORIGINATOR); |
651 | } |
659 | } |
652 | |
660 | |
653 | void |
661 | void |
654 | drop (object *op, object *tmp) |
662 | drop (object *op, object *tmp) |
655 | { |
663 | { |
… | |
… | |
853 | |
861 | |
854 | /* draw_look(op);*/ |
862 | /* draw_look(op);*/ |
855 | return 0; |
863 | return 0; |
856 | } |
864 | } |
857 | |
865 | |
|
|
866 | |
|
|
867 | /* This function tries to drop all objects in the <objs> vector. |
|
|
868 | * <dropper> is the object that wants to drop them. |
|
|
869 | * <cnt> can be a 0 pointer or a pointer to the maximum number of |
|
|
870 | * drop operations to perform. |
|
|
871 | * |
|
|
872 | * Returns true if at least one item was dropped. |
|
|
873 | */ |
|
|
874 | bool |
|
|
875 | drop_vector (object *dropper, vector<object *> &objs, int *cnt) |
|
|
876 | { |
|
|
877 | vector<object *>::iterator i; |
|
|
878 | |
|
|
879 | bool did_one = false; |
|
|
880 | |
|
|
881 | for (i = objs.begin (); i != objs.end (); i++) |
|
|
882 | { |
|
|
883 | drop (dropper, *i); |
|
|
884 | if (cnt && --*cnt <= 0) break; |
|
|
885 | did_one = true; |
|
|
886 | } |
|
|
887 | |
|
|
888 | return did_one; |
|
|
889 | } |
|
|
890 | |
858 | /* Object op wants to drop object(s) params. params can be a |
891 | /* Object op wants to drop object(s) params. params can be a |
859 | * comma seperated list. |
892 | * comma seperated list. |
860 | */ |
893 | */ |
861 | int |
894 | int |
862 | command_drop (object *op, char *params) |
895 | command_drop (object *op, char *params) |
… | |
… | |
869 | new_draw_info (NDI_UNIQUE, 0, op, "Drop what?"); |
902 | new_draw_info (NDI_UNIQUE, 0, op, "Drop what?"); |
870 | return 0; |
903 | return 0; |
871 | } |
904 | } |
872 | else |
905 | else |
873 | { |
906 | { |
874 | int cnt = MAX_ITEM_PER_DROP; |
907 | vector<object *> matched_objs; |
875 | |
908 | |
876 | for (tmp = op->inv; tmp; tmp = next) |
909 | for (tmp = op->inv; tmp; tmp = next) |
877 | { |
910 | { |
878 | next = tmp->below; |
911 | next = tmp->below; |
879 | if (QUERY_FLAG (tmp, FLAG_NO_DROP) || tmp->invisible) |
912 | if (QUERY_FLAG (tmp, FLAG_NO_DROP) || tmp->invisible) |
880 | continue; |
913 | continue; |
881 | |
914 | |
882 | if (item_matched_string (op, tmp, params)) |
915 | if (item_matched_string (op, tmp, params)) |
883 | { |
916 | matched_objs.push_back (tmp); |
884 | drop (op, tmp); |
|
|
885 | if (--cnt <= 0) break; |
|
|
886 | did_one = 1; |
|
|
887 | } |
917 | } |
888 | } |
|
|
889 | |
918 | |
890 | if (!did_one) |
919 | int cnt = MAX_ITEM_PER_DROP; |
|
|
920 | |
|
|
921 | if (!drop_vector (op, matched_objs, &cnt)) |
891 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing to drop."); |
922 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing to drop."); |
892 | |
923 | |
893 | if (cnt <= 0) |
924 | if (cnt <= 0) |
894 | op->failmsg ("Only dropped some items, can't drop that many items at once."); |
925 | op->failmsg ("Only dropped some items, can't drop that many items at once."); |
895 | } |
926 | } |
… | |
… | |
1025 | } |
1056 | } |
1026 | |
1057 | |
1027 | std::string |
1058 | std::string |
1028 | object::long_desc (object *who) |
1059 | object::long_desc (object *who) |
1029 | { |
1060 | { |
1030 | std::string buf (query_name (this)); |
1061 | std::string buf (query_name ()); |
1031 | |
1062 | |
1032 | switch (type) |
1063 | switch (type) |
1033 | { |
1064 | { |
1034 | case RING: |
1065 | case RING: |
1035 | case SKILL: |
1066 | case SKILL: |
… | |
… | |
1047 | case CLOAK: |
1078 | case CLOAK: |
1048 | case FOOD: |
1079 | case FOOD: |
1049 | case DRINK: |
1080 | case DRINK: |
1050 | case FLESH: |
1081 | case FLESH: |
1051 | case SKILL_TOOL: |
1082 | case SKILL_TOOL: |
|
|
1083 | case LAMP: |
1052 | case POWER_CRYSTAL: |
1084 | case POWER_CRYSTAL: |
1053 | { |
1085 | { |
1054 | const char *cp = ::describe_item (this, who); |
1086 | const char *cp = ::describe_item (this, who); |
1055 | |
1087 | |
1056 | if (*cp) |
1088 | if (*cp) |
… | |
… | |
1085 | |
1117 | |
1086 | switch (type) |
1118 | switch (type) |
1087 | { |
1119 | { |
1088 | case SPELLBOOK: |
1120 | case SPELLBOOK: |
1089 | if (flag [FLAG_IDENTIFIED] && inv) |
1121 | if (flag [FLAG_IDENTIFIED] && inv) |
1090 | buf.printf ("%s is a %s %s spell.\r", &inv->name, get_levelnumber (inv->level), &inv->skill); |
1122 | buf.printf ("%s is a level %s %s spell.\r", &inv->name, get_levelnumber (inv->level), &inv->skill); |
1091 | break; |
1123 | break; |
1092 | |
1124 | |
1093 | case BOOK: |
1125 | case BOOK: |
1094 | if (msg) |
1126 | if (msg) |
1095 | buf << "Something is written in it.\r"; |
1127 | buf << "Something is written in it.\r"; |
… | |
… | |
1113 | buf.printf ("It has %d charges left.\r", stats.food); |
1145 | buf.printf ("It has %d charges left.\r", stats.food); |
1114 | break; |
1146 | break; |
1115 | } |
1147 | } |
1116 | |
1148 | |
1117 | if (materialname && !msg) |
1149 | if (materialname && !msg) |
1118 | buf.printf ("It is made of: %s.\r", &materialname); |
1150 | buf << (nrof > 1 ? "They are made of " : "It is made of ") |
|
|
1151 | << materialname |
|
|
1152 | << '\r'; |
1119 | |
1153 | |
1120 | if (who) |
1154 | if (who) |
1121 | /* Where to wear this item */ |
1155 | /* Where to wear this item */ |
1122 | for (int i = 0; i < NUM_BODY_LOCATIONS; i++) |
1156 | for (int i = 0; i < NUM_BODY_LOCATIONS; i++) |
1123 | if (slot[i].info) |
1157 | if (slot[i].info) |
… | |
… | |
1156 | /* Does the object have a message? Don't show message for all object |
1190 | /* Does the object have a message? Don't show message for all object |
1157 | * types - especially if the first entry is a match |
1191 | * types - especially if the first entry is a match |
1158 | */ |
1192 | */ |
1159 | if (msg && type != EXIT && type != BOOK && type != CORPSE && !move_on && !has_dialogue ()) |
1193 | if (msg && type != EXIT && type != BOOK && type != CORPSE && !move_on && !has_dialogue ()) |
1160 | { |
1194 | { |
|
|
1195 | buf << '\r'; |
|
|
1196 | |
1161 | /* This is just a hack so when identifying the items, we print |
1197 | /* This is just a hack so when identifying the items, we print |
1162 | * out the extra message |
1198 | * out the extra message |
1163 | */ |
1199 | */ |
1164 | if (need_identify (this) && flag [FLAG_IDENTIFIED]) |
1200 | if (need_identify (this) && flag [FLAG_IDENTIFIED]) |
1165 | buf << "The object has a story:\r"; |
1201 | buf << "The object has a story:\r"; |
… | |
… | |
1175 | static void |
1211 | static void |
1176 | display_new_pickup (object *op) |
1212 | display_new_pickup (object *op) |
1177 | { |
1213 | { |
1178 | int i = op->contr->mode; |
1214 | int i = op->contr->mode; |
1179 | |
1215 | |
1180 | if (!(i & PU_NEWMODE)) |
|
|
1181 | return; |
|
|
1182 | |
|
|
1183 | new_draw_info_format (NDI_UNIQUE, 0, op, "%d NEWMODE", i & PU_NEWMODE ? 1 : 0); |
|
|
1184 | new_draw_info_format (NDI_UNIQUE, 0, op, "%d DEBUG", i & PU_DEBUG ? 1 : 0); |
1216 | new_draw_info_format (NDI_UNIQUE, 0, op, "%d DEBUG", i & PU_DEBUG ? 1 : 0); |
1185 | new_draw_info_format (NDI_UNIQUE, 0, op, "%d INHIBIT", i & PU_INHIBIT ? 1 : 0); |
1217 | new_draw_info_format (NDI_UNIQUE, 0, op, "%d INHIBIT", i & PU_INHIBIT ? 1 : 0); |
1186 | new_draw_info_format (NDI_UNIQUE, 0, op, "%d STOP", i & PU_STOP ? 1 : 0); |
1218 | new_draw_info_format (NDI_UNIQUE, 0, op, "%d STOP", i & PU_STOP ? 1 : 0); |
1187 | |
1219 | |
1188 | new_draw_info_format (NDI_UNIQUE, 0, op, "%d <= x pickup weight/value RATIO (0==off)", (i & PU_RATIO) * 5); |
1220 | new_draw_info_format (NDI_UNIQUE, 0, op, "%d <= x pickup weight/value RATIO (0==off)", (i & PU_RATIO) * 5); |
… | |
… | |
1239 | }; |
1271 | }; |
1240 | |
1272 | |
1241 | if (!params) |
1273 | if (!params) |
1242 | { |
1274 | { |
1243 | /* if the new mode is used, just print the settings */ |
1275 | /* if the new mode is used, just print the settings */ |
1244 | if (op->contr->mode & PU_NEWMODE) |
|
|
1245 | { |
|
|
1246 | display_new_pickup (op); |
1276 | display_new_pickup (op); |
1247 | return 1; |
|
|
1248 | } |
|
|
1249 | if (1) |
|
|
1250 | LOG (llevDebug, "command_pickup: !params\n"); |
|
|
1251 | set_pickup_mode (op, (op->contr->mode > 6) ? 0 : op->contr->mode + 1); |
|
|
1252 | return 0; |
1277 | return 0; |
1253 | } |
1278 | } |
1254 | |
1279 | |
1255 | while (*params == ' ' && *params) |
1280 | while (*params == ' ' && *params) |
1256 | params++; |
1281 | params++; |
… | |
… | |
1262 | for (mode = 0; names[mode]; mode++) |
1287 | for (mode = 0; names[mode]; mode++) |
1263 | { |
1288 | { |
1264 | if (!strcmp (names[mode], params + 1)) |
1289 | if (!strcmp (names[mode], params + 1)) |
1265 | { |
1290 | { |
1266 | i = op->contr->mode; |
1291 | i = op->contr->mode; |
1267 | if (!(i & PU_NEWMODE)) |
1292 | |
1268 | i = PU_NEWMODE; |
|
|
1269 | if (*params == '+') |
1293 | if (*params == '+') |
1270 | i = i | modes[mode]; |
1294 | i = i | modes[mode]; |
1271 | else |
1295 | else |
1272 | i = i & ~modes[mode]; |
1296 | i = i & ~modes[mode]; |
|
|
1297 | |
1273 | op->contr->mode = i; |
1298 | op->contr->mode = i; |
1274 | display_new_pickup (op); |
1299 | display_new_pickup (op); |
1275 | return 1; |
1300 | return 1; |
1276 | } |
1301 | } |
1277 | } |
1302 | } |
… | |
… | |
1279 | return 1; |
1304 | return 1; |
1280 | } |
1305 | } |
1281 | |
1306 | |
1282 | if (sscanf (params, "%u", &i) != 1) |
1307 | if (sscanf (params, "%u", &i) != 1) |
1283 | { |
1308 | { |
1284 | if (1) |
|
|
1285 | LOG (llevDebug, "command_pickup: params==NULL\n"); |
|
|
1286 | new_draw_info (NDI_UNIQUE, 0, op, "Usage: pickup <0-7> or <value_density> ."); |
1309 | new_draw_info (NDI_UNIQUE, 0, op, "Usage: pickup <value_density> or [+-]type."); |
1287 | return 1; |
1310 | return 1; |
1288 | } |
1311 | } |
1289 | set_pickup_mode (op, i); |
1312 | |
|
|
1313 | if (i <= PU_RATIO) |
|
|
1314 | i |= op->contr->mode & ~PU_RATIO; |
|
|
1315 | |
|
|
1316 | op->contr->mode = i; |
1290 | |
1317 | |
1291 | return 1; |
1318 | return 1; |
1292 | } |
|
|
1293 | |
|
|
1294 | void |
|
|
1295 | set_pickup_mode (object *op, int i) |
|
|
1296 | { |
|
|
1297 | switch (op->contr->mode = i) |
|
|
1298 | { |
|
|
1299 | case 0: |
|
|
1300 | new_draw_info (NDI_UNIQUE, 0, op, "Mode: Don't pick up."); |
|
|
1301 | break; |
|
|
1302 | case 1: |
|
|
1303 | new_draw_info (NDI_UNIQUE, 0, op, "Mode: Pick up one item."); |
|
|
1304 | break; |
|
|
1305 | case 2: |
|
|
1306 | new_draw_info (NDI_UNIQUE, 0, op, "Mode: Pick up one item and stop."); |
|
|
1307 | break; |
|
|
1308 | case 3: |
|
|
1309 | new_draw_info (NDI_UNIQUE, 0, op, "Mode: Stop before picking up."); |
|
|
1310 | break; |
|
|
1311 | case 4: |
|
|
1312 | new_draw_info (NDI_UNIQUE, 0, op, "Mode: Pick up all items."); |
|
|
1313 | break; |
|
|
1314 | case 5: |
|
|
1315 | new_draw_info (NDI_UNIQUE, 0, op, "Mode: Pick up all items and stop."); |
|
|
1316 | break; |
|
|
1317 | case 6: |
|
|
1318 | new_draw_info (NDI_UNIQUE, 0, op, "Mode: Pick up all magic items."); |
|
|
1319 | break; |
|
|
1320 | case 7: |
|
|
1321 | new_draw_info (NDI_UNIQUE, 0, op, "Mode: Pick up all coins and gems"); |
|
|
1322 | break; |
|
|
1323 | } |
|
|
1324 | } |
1319 | } |
1325 | |
1320 | |
1326 | int |
1321 | int |
1327 | command_search_items (object *op, char *params) |
1322 | command_search_items (object *op, char *params) |
1328 | { |
1323 | { |
1329 | char buf[MAX_BUF]; |
1324 | char buf[MAX_BUF]; |
1330 | |
1325 | |
1331 | if (settings.search_items == FALSE) |
|
|
1332 | return 1; |
|
|
1333 | |
|
|
1334 | if (params == NULL) |
1326 | if (params == NULL) |
1335 | { |
1327 | { |
1336 | if (op->contr->search_str[0] == '\0') |
1328 | if (op->contr->search_str[0] == '\0') |
1337 | { |
1329 | { |
1338 | new_draw_info (NDI_UNIQUE, 0, op, "Example: search magic+1"); |
1330 | new_draw_info (NDI_UNIQUE, 0, op, "Example: search-items magic+1"); |
1339 | new_draw_info (NDI_UNIQUE, 0, op, "Would automatically pick up all"); |
1331 | new_draw_info (NDI_UNIQUE, 0, op, "Would automatically pick up all"); |
1340 | new_draw_info (NDI_UNIQUE, 0, op, "items containing the word 'magic+1'."); |
1332 | new_draw_info (NDI_UNIQUE, 0, op, "items containing the word 'magic+1'."); |
1341 | return 1; |
1333 | return 1; |
1342 | } |
1334 | } |
1343 | |
1335 | |
… | |
… | |
1345 | new_draw_info (NDI_UNIQUE, 0, op, "Search mode turned off."); |
1337 | new_draw_info (NDI_UNIQUE, 0, op, "Search mode turned off."); |
1346 | op->update_stats (); |
1338 | op->update_stats (); |
1347 | return 1; |
1339 | return 1; |
1348 | } |
1340 | } |
1349 | |
1341 | |
1350 | if ((int) strlen (params) >= MAX_BUF) |
1342 | if (strlen (params) >= MAX_BUF) |
1351 | { |
1343 | { |
1352 | new_draw_info (NDI_UNIQUE, 0, op, "Search string too long."); |
1344 | new_draw_info (NDI_UNIQUE, 0, op, "Search string too long."); |
1353 | return 1; |
1345 | return 1; |
1354 | } |
1346 | } |
1355 | |
1347 | |
1356 | strcpy (op->contr->search_str, params); |
1348 | strcpy (op->contr->search_str, params); |
1357 | sprintf (buf, "Searching for '%s'.", op->contr->search_str); |
1349 | sprintf (buf, "Now searching for '%s'.", op->contr->search_str); |
1358 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1350 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1359 | op->update_stats (); |
1351 | op->update_stats (); |
|
|
1352 | |
1360 | return 1; |
1353 | return 1; |
1361 | } |
1354 | } |
1362 | |
1355 | |