OSDN Git Service

Weaponsmiths can drain lite essence according to lite radius of draining objects
[hengband/hengband.git] / src / cmd3.c
1 /* File: cmd3.c */
2
3 /* Purpose: Inventory commands */
4
5 /*
6  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
7  *
8  * This software may be copied and distributed for educational, research,
9  * and not for profit purposes provided that this copyright and statement
10  * are included in all such copies.  Other copyrights may also apply.
11  */
12
13 #include "angband.h"
14
15
16
17 /*
18  * Display inventory
19  */
20 void do_cmd_inven(void)
21 {
22         char out_val[160];
23
24
25         /* Note that we are in "inventory" mode */
26         command_wrk = FALSE;
27
28 #ifdef ALLOW_EASY_FLOOR
29
30         /* Note that we are in "inventory" mode */
31         if (easy_floor) command_wrk = (USE_INVEN);
32
33 #endif /* ALLOW_EASY_FLOOR */
34
35         /* Save screen */
36         screen_save();
37
38         /* Hack -- show empty slots */
39         item_tester_full = TRUE;
40
41         /* Display the inventory */
42         (void)show_inven(0);
43
44         /* Hack -- hide empty slots */
45         item_tester_full = FALSE;
46
47 #ifdef JP
48         sprintf(out_val, "»ý¤Áʪ¡§ ¹ç·× %3d.%1d kg (¸Â³¦¤Î%ld%%) ¥³¥Þ¥ó¥É: ",
49             (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
50             (long int)((p_ptr->total_weight * 100) / weight_limit()));
51 #else
52         sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
53             (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
54             (p_ptr->total_weight * 100) / weight_limit());
55 #endif
56
57
58         /* Get a command */
59         prt(out_val, 0, 0);
60
61         /* Get a new command */
62         command_new = inkey();
63
64         /* Load screen */
65         screen_load();
66
67
68         /* Process "Escape" */
69         if (command_new == ESCAPE)
70         {
71                 int wid, hgt;
72
73                 /* Get size */
74                 Term_get_size(&wid, &hgt);
75
76                 /* Reset stuff */
77                 command_new = 0;
78                 command_gap = wid - 30;
79         }
80
81         /* Process normal keys */
82         else
83         {
84                 /* Hack -- Use "display" mode */
85                 command_see = TRUE;
86         }
87 }
88
89
90 /*
91  * Display equipment
92  */
93 void do_cmd_equip(void)
94 {
95         char out_val[160];
96
97
98         /* Note that we are in "equipment" mode */
99         command_wrk = TRUE;
100
101 #ifdef ALLOW_EASY_FLOOR
102
103         /* Note that we are in "equipment" mode */
104         if (easy_floor) command_wrk = (USE_EQUIP);
105
106 #endif /* ALLOW_EASY_FLOOR  */
107
108         /* Save the screen */
109         screen_save();
110
111         /* Hack -- show empty slots */
112         item_tester_full = TRUE;
113
114         /* Display the equipment */
115         (void)show_equip(0);
116
117         /* Hack -- undo the hack above */
118         item_tester_full = FALSE;
119
120         /* Build a prompt */
121 #ifdef JP
122         sprintf(out_val, "ÁõÈ÷¡§ ¹ç·× %3d.%1d kg (¸Â³¦¤Î%ld%%) ¥³¥Þ¥ó¥É: ",
123             (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
124             (long int)((p_ptr->total_weight * 100) / weight_limit()));
125 #else
126         sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
127             (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
128             (long int)((p_ptr->total_weight * 100) / weight_limit()));
129 #endif
130
131
132         /* Get a command */
133         prt(out_val, 0, 0);
134
135         /* Get a new command */
136         command_new = inkey();
137
138         /* Restore the screen */
139         screen_load();
140
141
142         /* Process "Escape" */
143         if (command_new == ESCAPE)
144         {
145                 int wid, hgt;
146
147                 /* Get size */
148                 Term_get_size(&wid, &hgt);
149
150                 /* Reset stuff */
151                 command_new = 0;
152                 command_gap = wid - 30;
153         }
154
155         /* Process normal keys */
156         else
157         {
158                 /* Enter "display" mode */
159                 command_see = TRUE;
160         }
161 }
162
163
164 /*
165  * The "wearable" tester
166  */
167 static bool item_tester_hook_wear(object_type *o_ptr)
168 {
169         if ((o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ABUNAI_MIZUGI))
170                 if (p_ptr->psex == SEX_MALE) return FALSE;
171
172         /* Check for a usable slot */
173         if (wield_slot(o_ptr) >= INVEN_RARM) return (TRUE);
174
175         /* Assume not wearable */
176         return (FALSE);
177 }
178
179
180 static bool item_tester_hook_mochikae(object_type *o_ptr)
181 {
182         /* Check for a usable slot */
183         if (((o_ptr->tval >= TV_DIGGING) && (o_ptr->tval <= TV_SWORD)) ||
184             (o_ptr->tval == TV_SHIELD) || (o_ptr->tval == TV_CAPTURE) ||
185             (o_ptr->tval == TV_CARD)) return (TRUE);
186
187         /* Assume not wearable */
188         return (FALSE);
189 }
190
191
192 static bool item_tester_hook_melee_weapon(object_type *o_ptr)
193 {
194         /* Check for a usable slot */
195         if ((o_ptr->tval >= TV_DIGGING) && (o_ptr->tval <= TV_SWORD))return (TRUE);
196
197         /* Assume not wearable */
198         return (FALSE);
199 }
200
201
202 bool select_ring_slot = FALSE;
203
204 /*
205  * Wield or wear a single item from the pack or floor
206  */
207 void do_cmd_wield(void)
208 {
209         int item, slot;
210
211         object_type forge;
212         object_type *q_ptr;
213
214         object_type *o_ptr;
215
216         cptr act;
217
218         char o_name[MAX_NLEN];
219
220         cptr q, s;
221
222         int need_switch_wielding = 0;
223
224         if (p_ptr->special_defense & KATA_MUSOU)
225         {
226                 set_action(ACTION_NONE);
227         }
228
229         /* Restrict the choices */
230         item_tester_hook = item_tester_hook_wear;
231
232         /* Get an item */
233 #ifdef JP
234         q = "¤É¤ì¤òÁõÈ÷¤·¤Þ¤¹¤«? ";
235         s = "ÁõÈ÷²Äǽ¤Ê¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
236 #else
237         q = "Wear/Wield which item? ";
238         s = "You have nothing you can wear or wield.";
239 #endif
240
241         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
242
243         /* Get the item (in the pack) */
244         if (item >= 0)
245         {
246                 o_ptr = &inventory[item];
247         }
248
249         /* Get the item (on the floor) */
250         else
251         {
252                 o_ptr = &o_list[0 - item];
253         }
254
255
256         /* Check the slot */
257         slot = wield_slot(o_ptr);
258
259         switch (o_ptr->tval)
260         {
261         /* Shields and some misc. items */
262         case TV_CAPTURE:
263         case TV_SHIELD:
264         case TV_CARD:
265                 /* Dual wielding */
266                 if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM))
267                 {
268                         /* Restrict the choices */
269                         item_tester_hook = item_tester_hook_melee_weapon;
270                         item_tester_no_ryoute = TRUE;
271
272                         /* Choose a weapon from the equipment only */
273 #ifdef JP
274                         q = "¤É¤Á¤é¤ÎÉð´ï¤È¼è¤êÂؤ¨¤Þ¤¹¤«?";
275                         s = "¤ª¤Ã¤È¡£";
276 #else
277                         q = "Replace which weapon? ";
278                         s = "Oops.";
279 #endif
280
281                         if (!get_item(&slot, q, s, (USE_EQUIP))) return;
282                         if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
283                 }
284
285                 else if (buki_motteruka(INVEN_LARM)) slot = INVEN_RARM;
286
287                 /* Both arms are already used by non-weapon */
288                 else if (inventory[INVEN_RARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_RARM]) &&
289                          inventory[INVEN_LARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_LARM]))
290                 {
291                         /* Restrict the choices */
292                         item_tester_hook = item_tester_hook_mochikae;
293
294                         /* Choose a hand */
295 #ifdef JP
296                         q = "¤É¤Á¤é¤Î¼ê¤ËÁõÈ÷¤·¤Þ¤¹¤«?";
297                         s = "¤ª¤Ã¤È¡£";
298 #else
299                         q = "Equip which hand? ";
300                         s = "Oops.";
301 #endif
302
303                         if (!get_item(&slot, q, s, (USE_EQUIP))) return;
304                 }
305                 break;
306
307         /* Melee weapons */
308         case TV_DIGGING:
309         case TV_HAFTED:
310         case TV_POLEARM:
311         case TV_SWORD:
312                 /* Asking for dual wielding */
313                 if (slot == INVEN_LARM)
314                 {
315 #ifdef JP
316                         if (!get_check("ÆóÅáή¤ÇÀ襤¤Þ¤¹¤«¡©")) slot = INVEN_RARM;
317 #else
318                         if (!get_check("Dual wielding? ")) slot = INVEN_RARM;
319 #endif
320                 }
321
322                 else if (!inventory[INVEN_RARM].k_idx && buki_motteruka(INVEN_LARM))
323                 {
324 #ifdef JP
325                         if (!get_check("ÆóÅáή¤ÇÀ襤¤Þ¤¹¤«¡©")) slot = INVEN_LARM;
326 #else
327                         if (!get_check("Dual wielding? ")) slot = INVEN_LARM;
328 #endif
329                 }
330
331                 /* Both arms are already used */
332                 else if (inventory[INVEN_LARM].k_idx && inventory[INVEN_RARM].k_idx)
333                 {
334                         /* Restrict the choices */
335                         item_tester_hook = item_tester_hook_mochikae;
336
337                         /* Choose a hand */
338 #ifdef JP
339                         q = "¤É¤Á¤é¤Î¼ê¤ËÁõÈ÷¤·¤Þ¤¹¤«?";
340                         s = "¤ª¤Ã¤È¡£";
341 #else
342                         q = "Equip which hand? ";
343                         s = "Oops.";
344 #endif
345
346                         if (!get_item(&slot, q, s, (USE_EQUIP))) return;
347                         if ((slot == INVEN_LARM) && !buki_motteruka(INVEN_RARM))
348                                 need_switch_wielding = INVEN_RARM;
349                 }
350                 break;
351
352         /* Rings */
353         case TV_RING:
354                 /* Choose a ring slot */
355                 if (inventory[INVEN_LEFT].k_idx && inventory[INVEN_RIGHT].k_idx)
356                 {
357 #ifdef JP
358                         q = "¤É¤Á¤é¤Î»ØÎؤȼè¤êÂؤ¨¤Þ¤¹¤«?";
359 #else
360                         q = "Replace which ring? ";
361 #endif
362                 }
363                 else
364                 {
365 #ifdef JP
366                         q = "¤É¤Á¤é¤Î¼ê¤ËÁõÈ÷¤·¤Þ¤¹¤«?";
367 #else
368                         q = "Equip which hand? ";
369 #endif
370                 }
371
372 #ifdef JP
373                 s = "¤ª¤Ã¤È¡£";
374 #else
375                 s = "Oops.";
376 #endif
377
378                 /* Restrict the choices */
379                 select_ring_slot = TRUE;
380                 item_tester_no_ryoute = TRUE;
381
382                 if (!get_item(&slot, q, s, (USE_EQUIP)))
383                 {
384                         select_ring_slot = FALSE;
385                         return;
386                 }
387                 select_ring_slot = FALSE;
388                 break;
389         }
390
391         /* Prevent wielding into a cursed slot */
392         if (object_is_cursed(&inventory[slot]))
393         {
394                 /* Describe it */
395                 object_desc(o_name, &inventory[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
396
397                 /* Message */
398 #ifdef JP
399                 msg_format("%s%s¤Ï¼ö¤ï¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£",
400                            describe_use(slot) , o_name );
401 #else
402                 msg_format("The %s you are %s appears to be cursed.",
403                            o_name, describe_use(slot));
404 #endif
405
406                 /* Cancel the command */
407                 return;
408         }
409
410         if (confirm_wear &&
411                 ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
412                 ((o_ptr->ident & IDENT_SENSE) &&
413                         (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
414         {
415                 char dummy[MAX_NLEN+80];
416
417                 /* Describe it */
418                 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
419
420 #ifdef JP
421 sprintf(dummy, "ËÜÅö¤Ë%s{¼ö¤ï¤ì¤Æ¤¤¤ë}¤ò»È¤¤¤Þ¤¹¤«¡©", o_name);
422 #else
423                 sprintf(dummy, "Really use the %s {cursed}? ", o_name);
424 #endif
425
426                 if (!get_check(dummy)) return;
427         }
428
429         if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
430         {
431                 char dummy[MAX_NLEN+80];
432
433                 /* Describe it */
434                 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
435
436 #ifdef JP
437 sprintf(dummy, "%s¤òÁõÈ÷¤¹¤ë¤ÈµÛ·ìµ´¤Ë¤Ê¤ê¤Þ¤¹¡£¤è¤í¤·¤¤¤Ç¤¹¤«¡©", o_name);
438 #else
439                 msg_format("%s will transforms you into a vampire permanently when equiped.", o_name);
440                 sprintf(dummy, "Do you become a vampire?");
441 #endif
442
443                 if (!get_check(dummy)) return;
444         }
445
446         if (need_switch_wielding && !object_is_cursed(&inventory[need_switch_wielding]))
447         {
448                 object_type *slot_o_ptr = &inventory[slot];
449                 object_type *switch_o_ptr = &inventory[need_switch_wielding];
450                 object_type object_tmp;
451                 object_type *otmp_ptr = &object_tmp;
452                 char switch_name[MAX_NLEN];
453
454                 object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
455
456                 object_copy(otmp_ptr, switch_o_ptr);
457                 object_copy(switch_o_ptr, slot_o_ptr);
458                 object_copy(slot_o_ptr, otmp_ptr);
459 #ifdef JP
460                 msg_format("%s¤ò%s¤Ë¹½¤¨¤Ê¤ª¤·¤¿¡£", switch_name, (slot == INVEN_RARM) ? (left_hander ? "º¸¼ê" : "±¦¼ê") : (left_hander ? "±¦¼ê" : "º¸¼ê"));
461 #else
462                 msg_format("You wield %s at %s hand.", switch_name, (slot == INVEN_RARM) ? (left_hander ? "left" : "right") : (left_hander ? "right" : "left"));
463 #endif
464
465                 slot = need_switch_wielding;
466         }
467
468         check_find_art_quest_completion(o_ptr);
469
470         if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
471         {
472                 identify_item(o_ptr);
473
474                 /* Auto-inscription */
475                 autopick_alter_item(item, FALSE);
476         }
477
478         /* Take a turn */
479         energy_use = 100;
480
481         /* Get local object */
482         q_ptr = &forge;
483
484         /* Obtain local object */
485         object_copy(q_ptr, o_ptr);
486
487         /* Modify quantity */
488         q_ptr->number = 1;
489
490         /* Decrease the item (from the pack) */
491         if (item >= 0)
492         {
493                 inven_item_increase(item, -1);
494                 inven_item_optimize(item);
495         }
496
497         /* Decrease the item (from the floor) */
498         else
499         {
500                 floor_item_increase(0 - item, -1);
501                 floor_item_optimize(0 - item);
502         }
503
504         /* Access the wield slot */
505         o_ptr = &inventory[slot];
506
507         /* Take off existing item */
508         if (o_ptr->k_idx)
509         {
510                 /* Take off existing item */
511                 (void)inven_takeoff(slot, 255);
512         }
513
514         /* Wear the new stuff */
515         object_copy(o_ptr, q_ptr);
516
517         /* Player touches it */
518         o_ptr->marked |= OM_TOUCHED;
519
520         /* Increase the weight */
521         p_ptr->total_weight += q_ptr->weight;
522
523         /* Increment the equip counter by hand */
524         equip_cnt++;
525
526 #ifdef JP
527 #define STR_WIELD_RARM "%s(%c)¤ò±¦¼ê¤ËÁõÈ÷¤·¤¿¡£"
528 #define STR_WIELD_LARM "%s(%c)¤òº¸¼ê¤ËÁõÈ÷¤·¤¿¡£"
529 #define STR_WIELD_ARMS "%s(%c)¤òξ¼ê¤Ç¹½¤¨¤¿¡£"
530 #else
531 #define STR_WIELD_RARM "You are wielding %s (%c) in your right hand."
532 #define STR_WIELD_LARM "You are wielding %s (%c) in your left hand."
533 #define STR_WIELD_ARMS "You are wielding %s (%c) with both hands."
534 #endif
535
536         /* Where is the item now */
537         switch (slot)
538         {
539         case INVEN_RARM:
540                 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
541                         act = STR_WIELD_ARMS;
542                 else
543                         act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
544                 break;
545
546         case INVEN_LARM:
547                 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
548                         act = STR_WIELD_ARMS;
549                 else
550                         act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
551                 break;
552
553         case INVEN_BOW:
554 #ifdef JP
555                 act = "%s(%c)¤ò¼Í·âÍѤËÁõÈ÷¤·¤¿¡£";
556 #else
557                 act = "You are shooting with %s (%c).";
558 #endif
559                 break;
560
561         case INVEN_LITE:
562 #ifdef JP
563                 act = "%s(%c)¤ò¸÷¸»¤Ë¤·¤¿¡£";
564 #else
565                 act = "Your light source is %s (%c).";
566 #endif
567                 break;
568
569         default:
570 #ifdef JP
571                 act = "%s(%c)¤òÁõÈ÷¤·¤¿¡£";
572 #else
573                 act = "You are wearing %s (%c).";
574 #endif
575                 break;
576         }
577
578         /* Describe the result */
579         object_desc(o_name, o_ptr, 0);
580
581         /* Message */
582         msg_format(act, o_name, index_to_label(slot));
583
584
585         /* Cursed! */
586         if (object_is_cursed(o_ptr))
587         {
588                 /* Warn the player */
589 #ifdef JP
590                 msg_print("¤¦¤ï¡ª ¤¹¤µ¤Þ¤¸¤¯Î䤿¤¤¡ª");
591 #else
592                 msg_print("Oops! It feels deathly cold!");
593 #endif
594
595
596                 chg_virtue(V_HARMONY, -1);
597
598                 /* Note the curse */
599                 o_ptr->ident |= (IDENT_SENSE);
600         }
601
602         /* The Stone Mask make the player turn into a vampire! */
603         if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
604         {
605                 /* Turn into a vampire */
606                 change_race(RACE_VAMPIRE, "");
607         }
608
609         /* Recalculate bonuses */
610         p_ptr->update |= (PU_BONUS);
611
612         /* Recalculate torch */
613         p_ptr->update |= (PU_TORCH);
614
615         /* Recalculate mana */
616         p_ptr->update |= (PU_MANA);
617
618         p_ptr->redraw |= (PR_EQUIPPY);
619
620         /* Window stuff */
621         p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
622
623         calc_android_exp();
624 }
625
626
627 void kamaenaoshi(int item)
628 {
629         object_type *o_ptr, *new_o_ptr;
630         char o_name[MAX_NLEN];
631
632         if (item == INVEN_RARM)
633         {
634                 if (buki_motteruka(INVEN_LARM))
635                 {
636                         o_ptr = &inventory[INVEN_LARM];
637                         object_desc(o_name, o_ptr, 0);
638
639                         if (!object_is_cursed(o_ptr))
640                         {
641                                 new_o_ptr = &inventory[INVEN_RARM];
642                                 object_copy(new_o_ptr, o_ptr);
643                                 p_ptr->total_weight += o_ptr->weight;
644                                 inven_item_increase(INVEN_LARM, -((int)o_ptr->number));
645                                 inven_item_optimize(INVEN_LARM);
646                                 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
647 #ifdef JP
648                                         msg_format("%s¤òξ¼ê¤Ç¹½¤¨¤¿¡£", o_name);
649 #else
650                                         msg_format("You are wielding %s with both hands.", o_name);
651 #endif
652                                  else
653 #ifdef JP
654                                         msg_format("%s¤ò%s¤Ç¹½¤¨¤¿¡£", o_name, (left_hander ? "º¸¼ê" : "±¦¼ê"));
655 #else
656                                         msg_format("You are wielding %s in your %s hand.", o_name, (left_hander ? "left":"right"));
657 #endif
658                         }
659                         else
660                         {
661                                 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
662 #ifdef JP
663                                         msg_format("%s¤òξ¼ê¤Ç¹½¤¨¤¿¡£", o_name);
664 #else
665                                         msg_format("You are wielding %s with both hands.", o_name);
666 #endif
667                         }
668                 }
669         }
670         else if (item == INVEN_LARM)
671         {
672                 o_ptr = &inventory[INVEN_RARM];
673                 if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0);
674
675                 if (buki_motteruka(INVEN_RARM))
676                 {
677                         if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
678 #ifdef JP
679                                 msg_format("%s¤òξ¼ê¤Ç¹½¤¨¤¿¡£", o_name);
680 #else
681                                 msg_format("You are wielding %s with both hands.", o_name);
682 #endif
683                 }
684                 else if (!(empty_hands(FALSE) & EMPTY_HAND_RARM) && !object_is_cursed(o_ptr))
685                 {
686                         new_o_ptr = &inventory[INVEN_LARM];
687                         object_copy(new_o_ptr, o_ptr);
688                         p_ptr->total_weight += o_ptr->weight;
689                         inven_item_increase(INVEN_RARM, -((int)o_ptr->number));
690                         inven_item_optimize(INVEN_RARM);
691 #ifdef JP
692                         msg_format("%s¤ò»ý¤ÁÂؤ¨¤¿¡£", o_name);
693 #else
694                         msg_format("You switched hand of %s.", o_name);
695 #endif
696                 }
697         }
698 }
699
700
701 /*
702  * Take off an item
703  */
704 void do_cmd_takeoff(void)
705 {
706         int item;
707
708         object_type *o_ptr;
709
710         cptr q, s;
711
712         if (p_ptr->special_defense & KATA_MUSOU)
713         {
714                 set_action(ACTION_NONE);
715         }
716
717         item_tester_no_ryoute = TRUE;
718         /* Get an item */
719 #ifdef JP
720         q = "¤É¤ì¤òÁõÈ÷¤«¤é¤Ï¤º¤·¤Þ¤¹¤«? ";
721         s = "¤Ï¤º¤»¤ëÁõÈ÷¤¬¤Ê¤¤¡£";
722 #else
723         q = "Take off which item? ";
724         s = "You are not wearing anything to take off.";
725 #endif
726
727         if (!get_item(&item, q, s, (USE_EQUIP))) return;
728
729         /* Get the item (in the pack) */
730         if (item >= 0)
731         {
732                 o_ptr = &inventory[item];
733         }
734
735         /* Get the item (on the floor) */
736         else
737         {
738                 o_ptr = &o_list[0 - item];
739         }
740
741
742         /* Item is cursed */
743         if (object_is_cursed(o_ptr))
744         {
745                 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (p_ptr->pclass != CLASS_BERSERKER))
746                 {
747                         /* Oops */
748 #ifdef JP
749                         msg_print("¤Õ¡¼¤à¡¢¤É¤¦¤ä¤é¼ö¤ï¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£");
750 #else
751                         msg_print("Hmmm, it seems to be cursed.");
752 #endif
753
754                         /* Nope */
755                         return;
756                 }
757
758                 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
759                 {
760 #ifdef JP
761                         msg_print("¼ö¤ï¤ì¤¿ÁõÈ÷¤òÎϤŤ¯¤ÇÇí¤¬¤·¤¿¡ª");
762 #else
763                         msg_print("You teared a cursed equipment off by sheer strength!");
764 #endif
765
766                         /* Hack -- Assume felt */
767                         o_ptr->ident |= (IDENT_SENSE);
768
769                         o_ptr->curse_flags = 0L;
770
771                         /* Take note */
772                         o_ptr->feeling = FEEL_NONE;
773
774                         /* Recalculate the bonuses */
775                         p_ptr->update |= (PU_BONUS);
776
777                         /* Window stuff */
778                         p_ptr->window |= (PW_EQUIP);
779
780 #ifdef JP
781                         msg_print("¼ö¤¤¤òÂǤÁÇˤä¿¡£");
782 #else
783                         msg_print("You break the curse.");
784 #endif
785                 }
786                 else
787                 {
788 #ifdef JP
789                         msg_print("ÁõÈ÷¤ò³°¤»¤Ê¤«¤Ã¤¿¡£");
790 #else
791                         msg_print("You couldn't remove the equipment.");
792 #endif
793                         energy_use = 50;
794                         return;
795                 }
796         }
797
798         /* Take a partial turn */
799         energy_use = 50;
800
801         /* Take off the item */
802         (void)inven_takeoff(item, 255);
803
804         kamaenaoshi(item);
805
806         calc_android_exp();
807
808         p_ptr->redraw |= (PR_EQUIPPY);
809 }
810
811
812 /*
813  * Drop an item
814  */
815 void do_cmd_drop(void)
816 {
817         int item, amt = 1;
818
819         object_type *o_ptr;
820
821         cptr q, s;
822
823         if (p_ptr->special_defense & KATA_MUSOU)
824         {
825                 set_action(ACTION_NONE);
826         }
827
828         item_tester_no_ryoute = TRUE;
829         /* Get an item */
830 #ifdef JP
831         q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÍî¤È¤·¤Þ¤¹¤«? ";
832         s = "Íî¤È¤»¤ë¥¢¥¤¥Æ¥à¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£";
833 #else
834         q = "Drop which item? ";
835         s = "You have nothing to drop.";
836 #endif
837
838         if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN))) return;
839
840         /* Get the item (in the pack) */
841         if (item >= 0)
842         {
843                 o_ptr = &inventory[item];
844         }
845
846         /* Get the item (on the floor) */
847         else
848         {
849                 o_ptr = &o_list[0 - item];
850         }
851
852
853         /* Hack -- Cannot remove cursed items */
854         if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
855         {
856                 /* Oops */
857 #ifdef JP
858                 msg_print("¤Õ¡¼¤à¡¢¤É¤¦¤ä¤é¼ö¤ï¤ì¤Æ¤¤¤ë¤è¤¦¤À¡£");
859 #else
860                 msg_print("Hmmm, it seems to be cursed.");
861 #endif
862
863
864                 /* Nope */
865                 return;
866         }
867
868
869         /* See how many items */
870         if (o_ptr->number > 1)
871         {
872                 /* Get a quantity */
873                 amt = get_quantity(NULL, o_ptr->number);
874
875                 /* Allow user abort */
876                 if (amt <= 0) return;
877         }
878
879
880         /* Take a partial turn */
881         energy_use = 50;
882
883         /* Drop (some of) the item */
884         inven_drop(item, amt);
885
886         if (item >= INVEN_RARM)
887         {
888                 kamaenaoshi(item);
889                 calc_android_exp();
890         }
891
892         p_ptr->redraw |= (PR_EQUIPPY);
893 }
894
895
896 static bool high_level_book(object_type *o_ptr)
897 {
898         if ((o_ptr->tval == TV_LIFE_BOOK) ||
899             (o_ptr->tval == TV_SORCERY_BOOK) ||
900             (o_ptr->tval == TV_NATURE_BOOK) ||
901             (o_ptr->tval == TV_CHAOS_BOOK) ||
902             (o_ptr->tval == TV_DEATH_BOOK) ||
903             (o_ptr->tval == TV_TRUMP_BOOK) ||
904             (o_ptr->tval == TV_CRAFT_BOOK) ||
905             (o_ptr->tval == TV_DAEMON_BOOK) ||
906             (o_ptr->tval == TV_CRUSADE_BOOK) ||
907             (o_ptr->tval == TV_MUSIC_BOOK) ||
908                 (o_ptr->tval == TV_HEX_BOOK))
909         {
910                 if (o_ptr->sval > 1)
911                         return TRUE;
912                 else
913                         return FALSE;
914         }
915
916         return FALSE;
917 }
918
919
920 /*
921  * Destroy an item
922  */
923 void do_cmd_destroy(void)
924 {
925         int                     item, amt = 1;
926         int                     old_number;
927
928         bool            force = FALSE;
929
930         object_type             *o_ptr;
931         object_type             forge;
932         object_type             *q_ptr = &forge;
933
934         char            o_name[MAX_NLEN];
935
936         char            out_val[MAX_NLEN+40];
937
938         cptr q, s;
939
940         if (p_ptr->special_defense & KATA_MUSOU)
941         {
942                 set_action(ACTION_NONE);
943         }
944
945         /* Hack -- force destruction */
946         if (command_arg > 0) force = TRUE;
947
948
949         /* Get an item */
950 #ifdef JP
951         q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò²õ¤·¤Þ¤¹¤«? ";
952         s = "²õ¤»¤ë¥¢¥¤¥Æ¥à¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£";
953 #else
954         q = "Destroy which item? ";
955         s = "You have nothing to destroy.";
956 #endif
957
958         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
959
960         /* Get the item (in the pack) */
961         if (item >= 0)
962         {
963                 o_ptr = &inventory[item];
964         }
965
966         /* Get the item (on the floor) */
967         else
968         {
969                 o_ptr = &o_list[0 - item];
970         }
971
972         /* Verify unless quantity given beforehand */
973         if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
974         {
975                 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
976
977                 /* Make a verification */
978                 sprintf(out_val, 
979 #ifdef JP
980                         "ËÜÅö¤Ë%s¤ò²õ¤·¤Þ¤¹¤«? [y/n/Auto]",
981 #else
982                         "Really destroy %s? [y/n/Auto]",
983 #endif
984                         o_name);
985
986                 msg_print(NULL);
987
988                 /* HACK : Add the line to message buffer */
989                 message_add(out_val);
990                 p_ptr->window |= (PW_MESSAGE);
991                 window_stuff();
992
993                 /* Get an acceptable answer */
994                 while (TRUE)
995                 {
996                         char i;
997
998                         /* Prompt */
999                         prt(out_val, 0, 0);
1000
1001                         i = inkey();
1002
1003                         /* Erase the prompt */
1004                         prt("", 0, 0);
1005
1006
1007                         if (i == 'y' || i == 'Y')
1008                         {
1009                                 break;
1010                         }
1011                         if (i == ESCAPE || i == 'n' || i == 'N')
1012                         {
1013                                 /* Cancel */
1014                                 return;
1015                         }
1016                         if (i == 'A')
1017                         {
1018                                 /* Add an auto-destroy preference line */
1019                                 if (autopick_autoregister(o_ptr))
1020                                 {
1021                                         /* Auto-destroy it */
1022                                         autopick_alter_item(item, TRUE);
1023                                 }
1024
1025                                 /* The object is already destroyed. */
1026                                 return;
1027                         }
1028                 } /* while (TRUE) */
1029         }
1030
1031         /* See how many items */
1032         if (o_ptr->number > 1)
1033         {
1034                 /* Get a quantity */
1035                 amt = get_quantity(NULL, o_ptr->number);
1036
1037                 /* Allow user abort */
1038                 if (amt <= 0) return;
1039         }
1040
1041
1042         /* Describe the object */
1043         old_number = o_ptr->number;
1044         o_ptr->number = amt;
1045         object_desc(o_name, o_ptr, 0);
1046         o_ptr->number = old_number;
1047
1048         /* Take a turn */
1049         energy_use = 100;
1050
1051         /* Artifacts cannot be destroyed */
1052         if (!can_player_destroy_object(o_ptr))
1053         {
1054                 energy_use = 0;
1055
1056                 /* Message */
1057 #ifdef JP
1058                 msg_format("%s¤ÏÇ˲õÉÔ²Äǽ¤À¡£", o_name);
1059 #else
1060                 msg_format("You cannot destroy %s.", o_name);
1061 #endif
1062
1063                 /* Done */
1064                 return;
1065         }
1066
1067         object_copy(q_ptr, o_ptr);
1068
1069         /* Message */
1070 #ifdef JP
1071         msg_format("%s¤ò²õ¤·¤¿¡£", o_name);
1072 #else
1073         msg_format("You destroy %s.", o_name);
1074 #endif
1075
1076         sound(SOUND_DESTITEM);
1077
1078         /* Reduce the charges of rods/wands */
1079         reduce_charges(o_ptr, amt);
1080
1081         /* Eliminate the item (from the pack) */
1082         if (item >= 0)
1083         {
1084                 inven_item_increase(item, -amt);
1085                 inven_item_describe(item);
1086                 inven_item_optimize(item);
1087         }
1088
1089         /* Eliminate the item (from the floor) */
1090         else
1091         {
1092                 floor_item_increase(0 - item, -amt);
1093                 floor_item_describe(0 - item);
1094                 floor_item_optimize(0 - item);
1095         }
1096
1097         if (high_level_book(q_ptr))
1098         {
1099                 bool gain_expr = FALSE;
1100
1101                 if (p_ptr->prace == RACE_ANDROID)
1102                 {
1103                 }
1104                 else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
1105                 {
1106                         gain_expr = TRUE;
1107                 }
1108                 else if (p_ptr->pclass == CLASS_PALADIN)
1109                 {
1110                         if (is_good_realm(p_ptr->realm1))
1111                         {
1112                                 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
1113                         }
1114                         else
1115                         {
1116                                 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
1117                         }
1118                 }
1119
1120                 if (gain_expr && (p_ptr->exp < PY_MAX_EXP))
1121                 {
1122                         s32b tester_exp = p_ptr->max_exp / 20;
1123                         if (tester_exp > 10000) tester_exp = 10000;
1124                         if (q_ptr->sval < 3) tester_exp /= 4;
1125                         if (tester_exp<1) tester_exp = 1;
1126
1127 #ifdef JP
1128 msg_print("¹¹¤Ë·Ð¸³¤òÀѤó¤À¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
1129 #else
1130                         msg_print("You feel more experienced.");
1131 #endif
1132
1133                         gain_exp(tester_exp * amt);
1134                 }
1135                 if (high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
1136                 {
1137                         chg_virtue(V_UNLIFE, 1);
1138                         chg_virtue(V_VITALITY, -1);
1139                 }
1140                 else if (high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
1141                 {
1142                         chg_virtue(V_UNLIFE, -1);
1143                         chg_virtue(V_VITALITY, 1);
1144                 }
1145         
1146                 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
1147                         chg_virtue(V_ENCHANT, -1);
1148         
1149                 if (object_value_real(q_ptr) > 30000)
1150                         chg_virtue(V_SACRIFICE, 2);
1151         
1152                 else if (object_value_real(q_ptr) > 10000)
1153                         chg_virtue(V_SACRIFICE, 1);
1154         }
1155
1156         if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
1157                 chg_virtue(V_HARMONY, 1);
1158
1159         if (item >= INVEN_RARM) calc_android_exp();
1160 }
1161
1162
1163 /*
1164  * Observe an item which has been *identify*-ed
1165  */
1166 void do_cmd_observe(void)
1167 {
1168         int                     item;
1169
1170         object_type             *o_ptr;
1171
1172         char            o_name[MAX_NLEN];
1173
1174         cptr q, s;
1175
1176         item_tester_no_ryoute = TRUE;
1177         /* Get an item */
1178 #ifdef JP
1179         q = "¤É¤Î¥¢¥¤¥Æ¥à¤òÄ´¤Ù¤Þ¤¹¤«? ";
1180         s = "Ä´¤Ù¤é¤ì¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
1181 #else
1182         q = "Examine which item? ";
1183         s = "You have nothing to examine.";
1184 #endif
1185
1186         if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return;
1187
1188         /* Get the item (in the pack) */
1189         if (item >= 0)
1190         {
1191                 o_ptr = &inventory[item];
1192         }
1193
1194         /* Get the item (on the floor) */
1195         else
1196         {
1197                 o_ptr = &o_list[0 - item];
1198         }
1199
1200
1201         /* Require full knowledge */
1202         if (!(o_ptr->ident & IDENT_MENTAL))
1203         {
1204 #ifdef JP
1205                 msg_print("¤³¤Î¥¢¥¤¥Æ¥à¤Ë¤Ä¤¤¤ÆÆäËÃΤäƤ¤¤ë¤³¤È¤Ï¤Ê¤¤¡£");
1206 #else
1207                 msg_print("You have no special knowledge about that item.");
1208 #endif
1209
1210                 return;
1211         }
1212
1213
1214         /* Description */
1215         object_desc(o_name, o_ptr, 0);
1216
1217         /* Describe */
1218 #ifdef JP
1219         msg_format("%s¤òÄ´¤Ù¤Æ¤¤¤ë...", o_name);
1220 #else
1221         msg_format("Examining %s...", o_name);
1222 #endif
1223
1224         /* Describe it fully */
1225 #ifdef JP
1226         if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print("ÆäËÊѤï¤Ã¤¿¤È¤³¤í¤Ï¤Ê¤¤¤è¤¦¤À¡£");
1227 #else
1228         if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print("You see nothing special.");
1229 #endif
1230
1231 }
1232
1233
1234
1235 /*
1236  * Remove the inscription from an object
1237  * XXX Mention item (when done)?
1238  */
1239 void do_cmd_uninscribe(void)
1240 {
1241         int   item;
1242
1243         object_type *o_ptr;
1244
1245         cptr q, s;
1246
1247         item_tester_no_ryoute = TRUE;
1248         /* Get an item */
1249 #ifdef JP
1250         q = "¤É¤Î¥¢¥¤¥Æ¥à¤ÎÌäò¾Ã¤·¤Þ¤¹¤«? ";
1251         s = "Ìäò¾Ã¤»¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
1252 #else
1253         q = "Un-inscribe which item? ";
1254         s = "You have nothing to un-inscribe.";
1255 #endif
1256
1257         if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return;
1258
1259         /* Get the item (in the pack) */
1260         if (item >= 0)
1261         {
1262                 o_ptr = &inventory[item];
1263         }
1264
1265         /* Get the item (on the floor) */
1266         else
1267         {
1268                 o_ptr = &o_list[0 - item];
1269         }
1270
1271         /* Nothing to remove */
1272         if (!o_ptr->inscription)
1273         {
1274 #ifdef JP
1275                 msg_print("¤³¤Î¥¢¥¤¥Æ¥à¤Ë¤Ï¾Ã¤¹¤Ù¤­Ì䬤ʤ¤¡£");
1276 #else
1277                 msg_print("That item had no inscription to remove.");
1278 #endif
1279
1280                 return;
1281         }
1282
1283         /* Message */
1284 #ifdef JP
1285         msg_print("Ìäò¾Ã¤·¤¿¡£");
1286 #else
1287         msg_print("Inscription removed.");
1288 #endif
1289
1290
1291         /* Remove the incription */
1292         o_ptr->inscription = 0;
1293
1294         /* Combine the pack */
1295         p_ptr->notice |= (PN_COMBINE);
1296
1297         /* Window stuff */
1298         p_ptr->window |= (PW_INVEN | PW_EQUIP);
1299
1300         /* .¤ä$¤Î´Ø·¸¤Ç, ºÆ·×»»¤¬É¬ÍפʤϤº -- henkma */
1301         p_ptr->update |= (PU_BONUS);
1302
1303 }
1304
1305
1306 /*
1307  * Inscribe an object with a comment
1308  */
1309 void do_cmd_inscribe(void)
1310 {
1311         int                     item;
1312
1313         object_type             *o_ptr;
1314
1315         char            o_name[MAX_NLEN];
1316
1317         char            out_val[80];
1318
1319         cptr q, s;
1320
1321         item_tester_no_ryoute = TRUE;
1322         /* Get an item */
1323 #ifdef JP
1324         q = "¤É¤Î¥¢¥¤¥Æ¥à¤ËÌäò¹ï¤ß¤Þ¤¹¤«? ";
1325         s = "Ìäò¹ï¤á¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
1326 #else
1327         q = "Inscribe which item? ";
1328         s = "You have nothing to inscribe.";
1329 #endif
1330
1331         if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return;
1332
1333         /* Get the item (in the pack) */
1334         if (item >= 0)
1335         {
1336                 o_ptr = &inventory[item];
1337         }
1338
1339         /* Get the item (on the floor) */
1340         else
1341         {
1342                 o_ptr = &o_list[0 - item];
1343         }
1344
1345         /* Describe the activity */
1346         object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
1347
1348         /* Message */
1349 #ifdef JP
1350         msg_format("%s¤ËÌäò¹ï¤à¡£", o_name);
1351 #else
1352         msg_format("Inscribing %s.", o_name);
1353 #endif
1354
1355         msg_print(NULL);
1356
1357         /* Start with nothing */
1358         strcpy(out_val, "");
1359
1360         /* Use old inscription */
1361         if (o_ptr->inscription)
1362         {
1363                 /* Start with the old inscription */
1364                 strcpy(out_val, quark_str(o_ptr->inscription));
1365         }
1366
1367         /* Get a new inscription (possibly empty) */
1368 #ifdef JP
1369         if (get_string("ÌÃ: ", out_val, 80))
1370 #else
1371         if (get_string("Inscription: ", out_val, 80))
1372 #endif
1373         {
1374                 /* Save the inscription */
1375                 o_ptr->inscription = quark_add(out_val);
1376
1377                 /* Combine the pack */
1378                 p_ptr->notice |= (PN_COMBINE);
1379
1380                 /* Window stuff */
1381                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1382
1383                 /* .¤ä$¤Î´Ø·¸¤Ç, ºÆ·×»»¤¬É¬ÍפʤϤº -- henkma */
1384                 p_ptr->update |= (PU_BONUS);
1385         }
1386 }
1387
1388
1389
1390 /*
1391  * An "item_tester_hook" for refilling lanterns
1392  */
1393 static bool item_tester_refill_lantern(object_type *o_ptr)
1394 {
1395         /* Flasks of oil are okay */
1396         if (o_ptr->tval == TV_FLASK) return (TRUE);
1397
1398         /* Laterns are okay */
1399         if ((o_ptr->tval == TV_LITE) &&
1400             (o_ptr->sval == SV_LITE_LANTERN)) return (TRUE);
1401
1402         /* Assume not okay */
1403         return (FALSE);
1404 }
1405
1406
1407 /*
1408  * Refill the players lamp (from the pack or floor)
1409  */
1410 static void do_cmd_refill_lamp(void)
1411 {
1412         int item;
1413
1414         object_type *o_ptr;
1415         object_type *j_ptr;
1416
1417         cptr q, s;
1418
1419
1420         /* Restrict the choices */
1421         item_tester_hook = item_tester_refill_lantern;
1422
1423         /* Get an item */
1424 #ifdef JP
1425         q = "¤É¤ÎÌý¤Ä¤Ü¤«¤éÃí¤®¤Þ¤¹¤«? ";
1426         s = "Ìý¤Ä¤Ü¤¬¤Ê¤¤¡£";
1427 #else
1428         q = "Refill with which flask? ";
1429         s = "You have no flasks of oil.";
1430 #endif
1431
1432         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1433
1434         /* Get the item (in the pack) */
1435         if (item >= 0)
1436         {
1437                 o_ptr = &inventory[item];
1438         }
1439
1440         /* Get the item (on the floor) */
1441         else
1442         {
1443                 o_ptr = &o_list[0 - item];
1444         }
1445
1446
1447         /* Take a partial turn */
1448         energy_use = 50;
1449
1450         /* Access the lantern */
1451         j_ptr = &inventory[INVEN_LITE];
1452
1453         /* Refuel */
1454         j_ptr->xtra4 += o_ptr->xtra4;
1455
1456         /* Message */
1457 #ifdef JP
1458         msg_print("¥é¥ó¥×¤ËÌý¤òÃí¤¤¤À¡£");
1459 #else
1460         msg_print("You fuel your lamp.");
1461 #endif
1462
1463         /* Comment */
1464         if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1465         {
1466                 j_ptr->xtra4 = 0;
1467 #ifdef JP
1468                 msg_print("¥é¥ó¥×¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1469 #else
1470                 msg_print("Your lamp has gone out!");
1471 #endif
1472         }
1473         else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1474         {
1475                 j_ptr->xtra4 = 0;
1476 #ifdef JP
1477                 msg_print("¤·¤«¤·¥é¥ó¥×¤ÏÁ´¤¯¸÷¤é¤Ê¤¤¡£");
1478 #else
1479                 msg_print("Curiously, your lamp doesn't light.");
1480 #endif
1481         }
1482         else if (j_ptr->xtra4 >= FUEL_LAMP)
1483         {
1484                 j_ptr->xtra4 = FUEL_LAMP;
1485 #ifdef JP
1486                 msg_print("¥é¥ó¥×¤ÎÌý¤Ï°ìÇÕ¤À¡£");
1487 #else
1488                 msg_print("Your lamp is full.");
1489 #endif
1490
1491         }
1492
1493         /* Decrease the item (from the pack) */
1494         if (item >= 0)
1495         {
1496                 inven_item_increase(item, -1);
1497                 inven_item_describe(item);
1498                 inven_item_optimize(item);
1499         }
1500
1501         /* Decrease the item (from the floor) */
1502         else
1503         {
1504                 floor_item_increase(0 - item, -1);
1505                 floor_item_describe(0 - item);
1506                 floor_item_optimize(0 - item);
1507         }
1508
1509         /* Recalculate torch */
1510         p_ptr->update |= (PU_TORCH);
1511 }
1512
1513
1514 /*
1515  * An "item_tester_hook" for refilling torches
1516  */
1517 static bool item_tester_refill_torch(object_type *o_ptr)
1518 {
1519         /* Torches are okay */
1520         if ((o_ptr->tval == TV_LITE) &&
1521             (o_ptr->sval == SV_LITE_TORCH)) return (TRUE);
1522
1523         /* Assume not okay */
1524         return (FALSE);
1525 }
1526
1527
1528 /*
1529  * Refuel the players torch (from the pack or floor)
1530  */
1531 static void do_cmd_refill_torch(void)
1532 {
1533         int item;
1534
1535         object_type *o_ptr;
1536         object_type *j_ptr;
1537
1538         cptr q, s;
1539
1540
1541         /* Restrict the choices */
1542         item_tester_hook = item_tester_refill_torch;
1543
1544         /* Get an item */
1545 #ifdef JP
1546         q = "¤É¤Î¾¾ÌÀ¤ÇÌÀ¤«¤ê¤ò¶¯¤á¤Þ¤¹¤«? ";
1547         s = "¾¤Ë¾¾ÌÀ¤¬¤Ê¤¤¡£";
1548 #else
1549         q = "Refuel with which torch? ";
1550         s = "You have no extra torches.";
1551 #endif
1552
1553         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1554
1555         /* Get the item (in the pack) */
1556         if (item >= 0)
1557         {
1558                 o_ptr = &inventory[item];
1559         }
1560
1561         /* Get the item (on the floor) */
1562         else
1563         {
1564                 o_ptr = &o_list[0 - item];
1565         }
1566
1567
1568         /* Take a partial turn */
1569         energy_use = 50;
1570
1571         /* Access the primary torch */
1572         j_ptr = &inventory[INVEN_LITE];
1573
1574         /* Refuel */
1575         j_ptr->xtra4 += o_ptr->xtra4 + 5;
1576
1577         /* Message */
1578 #ifdef JP
1579         msg_print("¾¾ÌÀ¤ò·ë¹ç¤·¤¿¡£");
1580 #else
1581         msg_print("You combine the torches.");
1582 #endif
1583
1584
1585         /* Comment */
1586         if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1587         {
1588                 j_ptr->xtra4 = 0;
1589 #ifdef JP
1590                 msg_print("¾¾ÌÀ¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
1591 #else
1592                 msg_print("Your torch has gone out!");
1593 #endif
1594         }
1595         else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1596         {
1597                 j_ptr->xtra4 = 0;
1598 #ifdef JP
1599                 msg_print("¤·¤«¤·¾¾ÌÀ¤ÏÁ´¤¯¸÷¤é¤Ê¤¤¡£");
1600 #else
1601                 msg_print("Curiously, your torche don't light.");
1602 #endif
1603         }
1604         /* Over-fuel message */
1605         else if (j_ptr->xtra4 >= FUEL_TORCH)
1606         {
1607                 j_ptr->xtra4 = FUEL_TORCH;
1608 #ifdef JP
1609                 msg_print("¾¾ÌÀ¤Î¼÷Ì¿¤Ï½½Ê¬¤À¡£");
1610 #else
1611                 msg_print("Your torch is fully fueled.");
1612 #endif
1613
1614         }
1615
1616         /* Refuel message */
1617         else
1618         {
1619 #ifdef JP
1620                 msg_print("¾¾ÌÀ¤Ï¤¤¤Ã¤½¤¦ÌÀ¤ë¤¯µ±¤¤¤¿¡£");
1621 #else
1622                 msg_print("Your torch glows more brightly.");
1623 #endif
1624
1625         }
1626
1627         /* Decrease the item (from the pack) */
1628         if (item >= 0)
1629         {
1630                 inven_item_increase(item, -1);
1631                 inven_item_describe(item);
1632                 inven_item_optimize(item);
1633         }
1634
1635         /* Decrease the item (from the floor) */
1636         else
1637         {
1638                 floor_item_increase(0 - item, -1);
1639                 floor_item_describe(0 - item);
1640                 floor_item_optimize(0 - item);
1641         }
1642
1643         /* Recalculate torch */
1644         p_ptr->update |= (PU_TORCH);
1645 }
1646
1647
1648 /*
1649  * Refill the players lamp, or restock his torches
1650  */
1651 void do_cmd_refill(void)
1652 {
1653         object_type *o_ptr;
1654
1655         /* Get the light */
1656         o_ptr = &inventory[INVEN_LITE];
1657
1658         if (p_ptr->special_defense & KATA_MUSOU)
1659         {
1660                 set_action(ACTION_NONE);
1661         }
1662
1663         /* It is nothing */
1664         if (o_ptr->tval != TV_LITE)
1665         {
1666 #ifdef JP
1667                 msg_print("¸÷¸»¤òÁõÈ÷¤·¤Æ¤¤¤Ê¤¤¡£");
1668 #else
1669                 msg_print("You are not wielding a light.");
1670 #endif
1671
1672         }
1673
1674         /* It's a lamp */
1675         else if (o_ptr->sval == SV_LITE_LANTERN)
1676         {
1677                 do_cmd_refill_lamp();
1678         }
1679
1680         /* It's a torch */
1681         else if (o_ptr->sval == SV_LITE_TORCH)
1682         {
1683                 do_cmd_refill_torch();
1684         }
1685
1686         /* No torch to refill */
1687         else
1688         {
1689 #ifdef JP
1690                 msg_print("¤³¤Î¸÷¸»¤Ï¼÷Ì¿¤ò±ä¤Ð¤»¤Ê¤¤¡£");
1691 #else
1692                 msg_print("Your light cannot be refilled.");
1693 #endif
1694
1695         }
1696 }
1697
1698
1699 /*
1700  * Target command
1701  */
1702 void do_cmd_target(void)
1703 {
1704         /* Target set */
1705         if (target_set(TARGET_KILL))
1706         {
1707 #ifdef JP
1708                 msg_print("¥¿¡¼¥²¥Ã¥È·èÄê¡£");
1709 #else
1710                 msg_print("Target Selected.");
1711 #endif
1712
1713         }
1714
1715         /* Target aborted */
1716         else
1717         {
1718 #ifdef JP
1719                 msg_print("¥¿¡¼¥²¥Ã¥È²ò½ü¡£");
1720 #else
1721                 msg_print("Target Aborted.");
1722 #endif
1723
1724         }
1725 }
1726
1727
1728
1729 /*
1730  * Look command
1731  */
1732 void do_cmd_look(void)
1733 {
1734         /*TEST*/
1735         p_ptr->window |= PW_MONSTER_LIST;
1736         window_stuff();
1737         /*TEST*/
1738
1739         /* Look around */
1740         if (target_set(TARGET_LOOK))
1741         {
1742 #ifdef JP
1743                 msg_print("¥¿¡¼¥²¥Ã¥È·èÄê¡£");
1744 #else
1745                 msg_print("Target Selected.");
1746 #endif
1747
1748         }
1749 }
1750
1751
1752
1753 /*
1754  * Allow the player to examine other sectors on the map
1755  */
1756 void do_cmd_locate(void)
1757 {
1758         int             dir, y1, x1, y2, x2;
1759
1760         char    tmp_val[80];
1761
1762         char    out_val[160];
1763
1764         int wid, hgt;
1765
1766         /* Get size */
1767         get_screen_size(&wid, &hgt);
1768
1769
1770         /* Start at current panel */
1771         y2 = y1 = panel_row_min;
1772         x2 = x1 = panel_col_min;
1773
1774         /* Show panels until done */
1775         while (1)
1776         {
1777                 /* Describe the location */
1778                 if ((y2 == y1) && (x2 == x1))
1779                 {
1780 #ifdef JP
1781                         strcpy(tmp_val, "¿¿¾å");
1782 #else
1783                         tmp_val[0] = '\0';
1784 #endif
1785
1786                 }
1787                 else
1788                 {
1789 #ifdef JP
1790                         sprintf(tmp_val, "%s%s",
1791                                 ((y2 < y1) ? "ËÌ" : (y2 > y1) ? "Æî" : ""),
1792                                 ((x2 < x1) ? "À¾" : (x2 > x1) ? "Åì" : ""));
1793 #else
1794                         sprintf(tmp_val, "%s%s of",
1795                                 ((y2 < y1) ? " North" : (y2 > y1) ? " South" : ""),
1796                                 ((x2 < x1) ? " West" : (x2 > x1) ? " East" : ""));
1797 #endif
1798
1799                 }
1800
1801                 /* Prepare to ask which way to look */
1802                 sprintf(out_val,
1803 #ifdef JP
1804                         "¥Þ¥Ã¥×°ÌÃÖ [%d(%02d),%d(%02d)] (¥×¥ì¥¤¥ä¡¼¤Î%s)  Êý¸þ?",
1805 #else
1806                         "Map sector [%d(%02d),%d(%02d)], which is%s your sector.  Direction?",
1807 #endif
1808
1809                         y2 / (hgt / 2), y2 % (hgt / 2),
1810                         x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1811
1812                 /* Assume no direction */
1813                 dir = 0;
1814
1815                 /* Get a direction */
1816                 while (!dir)
1817                 {
1818                         char command;
1819
1820                         /* Get a command (or Cancel) */
1821                         if (!get_com(out_val, &command, TRUE)) break;
1822
1823                         /* Extract the action (if any) */
1824                         dir = get_keymap_dir(command);
1825
1826                         /* Error */
1827                         if (!dir) bell();
1828                 }
1829
1830                 /* No direction */
1831                 if (!dir) break;
1832
1833                 /* Apply the motion */
1834                 if (change_panel(ddy[dir], ddx[dir]))
1835                 {
1836                         y2 = panel_row_min;
1837                         x2 = panel_col_min;
1838                 }
1839         }
1840
1841
1842         /* Recenter the map around the player */
1843         verify_panel();
1844
1845         /* Update stuff */
1846         p_ptr->update |= (PU_MONSTERS);
1847
1848         /* Redraw map */
1849         p_ptr->redraw |= (PR_MAP);
1850
1851         /* Window stuff */
1852         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1853
1854         /* Handle stuff */
1855         handle_stuff();
1856 }
1857
1858
1859
1860 /*
1861  * Sorting hook -- Comp function -- see below
1862  *
1863  * We use "u" to point to array of monster indexes,
1864  * and "v" to select the type of sorting to perform on "u".
1865  */
1866 bool ang_sort_comp_hook(vptr u, vptr v, int a, int b)
1867 {
1868         u16b *who = (u16b*)(u);
1869
1870         u16b *why = (u16b*)(v);
1871
1872         int w1 = who[a];
1873         int w2 = who[b];
1874
1875         int z1, z2;
1876
1877         /* Sort by player kills */
1878         if (*why >= 4)
1879         {
1880                 /* Extract player kills */
1881                 z1 = r_info[w1].r_pkills;
1882                 z2 = r_info[w2].r_pkills;
1883
1884                 /* Compare player kills */
1885                 if (z1 < z2) return (TRUE);
1886                 if (z1 > z2) return (FALSE);
1887         }
1888
1889
1890         /* Sort by total kills */
1891         if (*why >= 3)
1892         {
1893                 /* Extract total kills */
1894                 z1 = r_info[w1].r_tkills;
1895                 z2 = r_info[w2].r_tkills;
1896
1897                 /* Compare total kills */
1898                 if (z1 < z2) return (TRUE);
1899                 if (z1 > z2) return (FALSE);
1900         }
1901
1902
1903         /* Sort by monster level */
1904         if (*why >= 2)
1905         {
1906                 /* Extract levels */
1907                 z1 = r_info[w1].level;
1908                 z2 = r_info[w2].level;
1909
1910                 /* Compare levels */
1911                 if (z1 < z2) return (TRUE);
1912                 if (z1 > z2) return (FALSE);
1913         }
1914
1915
1916         /* Sort by monster experience */
1917         if (*why >= 1)
1918         {
1919                 /* Extract experience */
1920                 z1 = r_info[w1].mexp;
1921                 z2 = r_info[w2].mexp;
1922
1923                 /* Compare experience */
1924                 if (z1 < z2) return (TRUE);
1925                 if (z1 > z2) return (FALSE);
1926         }
1927
1928
1929         /* Compare indexes */
1930         return (w1 <= w2);
1931 }
1932
1933
1934 /*
1935  * Sorting hook -- Swap function -- see below
1936  *
1937  * We use "u" to point to array of monster indexes,
1938  * and "v" to select the type of sorting to perform.
1939  */
1940 void ang_sort_swap_hook(vptr u, vptr v, int a, int b)
1941 {
1942         u16b *who = (u16b*)(u);
1943
1944         u16b holder;
1945
1946         /* Unused */
1947         (void)v;
1948
1949         /* Swap */
1950         holder = who[a];
1951         who[a] = who[b];
1952         who[b] = holder;
1953 }
1954
1955
1956
1957 /*
1958  * Identify a character, allow recall of monsters
1959  *
1960  * Several "special" responses recall "multiple" monsters:
1961  *   ^A (all monsters)
1962  *   ^U (all unique monsters)
1963  *   ^N (all non-unique monsters)
1964  *
1965  * The responses may be sorted in several ways, see below.
1966  *
1967  * Note that the player ghosts are ignored. XXX XXX XXX
1968  */
1969 void do_cmd_query_symbol(void)
1970 {
1971         int             i, n, r_idx;
1972         char    sym, query;
1973         char    buf[128];
1974
1975         bool    all = FALSE;
1976         bool    uniq = FALSE;
1977         bool    norm = FALSE;
1978         bool    ride = FALSE;
1979         char    temp[80] = "";
1980
1981         bool    recall = FALSE;
1982
1983         u16b    why = 0;
1984         u16b    *who;
1985
1986         /* Get a character, or abort */
1987 #ifdef JP
1988         if (!get_com("ÃΤꤿ¤¤Ê¸»ú¤òÆþÎϤ·¤Æ²¼¤µ¤¤(µ­¹æ or ^AÁ´,^U¥æ,^NÈó¥æ,^R¾èÇÏ,^M̾Á°): ", &sym, FALSE)) return;
1989 #else
1990         if (!get_com("Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): ", &sym, FALSE)) return;
1991 #endif
1992
1993         /* Find that character info, and describe it */
1994         for (i = 0; ident_info[i]; ++i)
1995         {
1996                 if (sym == ident_info[i][0]) break;
1997         }
1998
1999         /* Describe */
2000         if (sym == KTRL('A'))
2001         {
2002                 all = TRUE;
2003 #ifdef JP
2004                 strcpy(buf, "Á´¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
2005 #else
2006                 strcpy(buf, "Full monster list.");
2007 #endif
2008         }
2009         else if (sym == KTRL('U'))
2010         {
2011                 all = uniq = TRUE;
2012 #ifdef JP
2013                 strcpy(buf, "¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
2014 #else
2015                 strcpy(buf, "Unique monster list.");
2016 #endif
2017         }
2018         else if (sym == KTRL('N'))
2019         {
2020                 all = norm = TRUE;
2021 #ifdef JP
2022                 strcpy(buf, "¥æ¥Ë¡¼¥¯³°¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
2023 #else
2024                 strcpy(buf, "Non-unique monster list.");
2025 #endif
2026         }
2027         else if (sym == KTRL('R'))
2028         {
2029                 all = ride = TRUE;
2030 #ifdef JP
2031                 strcpy(buf, "¾èÇϲÄǽ¥â¥ó¥¹¥¿¡¼¤Î¥ê¥¹¥È");
2032 #else
2033                 strcpy(buf, "Ridable monster list.");
2034 #endif
2035         }
2036         /* XTRA HACK WHATSEARCH */
2037         else if (sym == KTRL('M'))
2038         {
2039                 all = TRUE;
2040 #ifdef JP
2041                 if (!get_string("̾Á°(±Ñ¸ì¤Î¾ì¹ç¾®Ê¸»ú¤Ç²Ä)",temp, 70))
2042 #else
2043                 if (!get_string("Enter name:",temp, 70))
2044 #endif
2045                 {
2046                         temp[0]=0;
2047                         return;
2048                 }
2049 #ifdef JP
2050                 sprintf(buf, "̾Á°:%s¤Ë¥Þ¥Ã¥Á",temp);
2051 #else
2052                 sprintf(buf, "Monsters with a name \"%s\"",temp);
2053 #endif
2054         }
2055         else if (ident_info[i])
2056         {
2057                 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
2058         }
2059         else
2060         {
2061 #ifdef JP
2062                 sprintf(buf, "%c - %s", sym, "̵¸ú¤Êʸ»ú");
2063 #else
2064                 sprintf(buf, "%c - %s.", sym, "Unknown Symbol");
2065 #endif
2066         }
2067
2068         /* Display the result */
2069         prt(buf, 0, 0);
2070
2071         /* Allocate the "who" array */
2072         C_MAKE(who, max_r_idx, u16b);
2073
2074         /* Collect matching monsters */
2075         for (n = 0, i = 1; i < max_r_idx; i++)
2076         {
2077                 monster_race *r_ptr = &r_info[i];
2078
2079                 /* Nothing to recall */
2080                 if (!cheat_know && !r_ptr->r_sights) continue;
2081
2082                 /* Require non-unique monsters if needed */
2083                 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
2084
2085                 /* Require unique monsters if needed */
2086                 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
2087
2088                 /* Require ridable monsters if needed */
2089                 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
2090
2091                 /* XTRA HACK WHATSEARCH */
2092                 if (temp[0])
2093                 {
2094                   int xx;
2095                   char temp2[80];
2096   
2097                   for (xx=0; temp[xx] && xx<80; xx++)
2098                   {
2099 #ifdef JP
2100                     if (iskanji( temp[xx])) { xx++; continue; }
2101 #endif
2102                     if (isupper(temp[xx])) temp[xx]=tolower(temp[xx]);
2103                   }
2104   
2105 #ifdef JP
2106                   strcpy(temp2, r_name+r_ptr->E_name);
2107 #else
2108                   strcpy(temp2, r_name+r_ptr->name);
2109 #endif
2110                   for (xx=0; temp2[xx] && xx<80; xx++)
2111                     if (isupper(temp2[xx])) temp2[xx]=tolower(temp2[xx]);
2112   
2113 #ifdef JP
2114                   if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp) )
2115 #else
2116                   if (my_strstr(temp2, temp))
2117 #endif
2118                           who[n++]=i;
2119                 }
2120
2121                 /* Collect "appropriate" monsters */
2122                 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
2123         }
2124
2125         /* Nothing to recall */
2126         if (!n)
2127         {
2128                 /* Free the "who" array */
2129                 C_KILL(who, max_r_idx, u16b);
2130
2131                 return;
2132         }
2133
2134
2135         /* Prompt XXX XXX XXX */
2136 #ifdef JP
2137         put_str("»×¤¤½Ð¤ò¸«¤Þ¤¹¤«? (k:»¦³²½ç/y/n): ", 0, 36);
2138 #else
2139         put_str("Recall details? (k/y/n): ", 0, 40);
2140 #endif
2141
2142
2143         /* Query */
2144         query = inkey();
2145
2146         /* Restore */
2147         prt(buf, 0, 0);
2148
2149         why = 2;
2150
2151         /* Select the sort method */
2152         ang_sort_comp = ang_sort_comp_hook;
2153         ang_sort_swap = ang_sort_swap_hook;
2154
2155         /* Sort the array */
2156         ang_sort(who, &why, n);
2157
2158         /* Sort by kills (and level) */
2159         if (query == 'k')
2160         {
2161                 why = 4;
2162                 query = 'y';
2163         }
2164
2165         /* Catch "escape" */
2166         if (query != 'y')
2167         {
2168                 /* Free the "who" array */
2169                 C_KILL(who, max_r_idx, u16b);
2170
2171                 return;
2172         }
2173
2174         /* Sort if needed */
2175         if (why == 4)
2176         {
2177                 /* Select the sort method */
2178                 ang_sort_comp = ang_sort_comp_hook;
2179                 ang_sort_swap = ang_sort_swap_hook;
2180
2181                 /* Sort the array */
2182                 ang_sort(who, &why, n);
2183         }
2184
2185
2186         /* Start at the end */
2187         i = n - 1;
2188
2189         /* Scan the monster memory */
2190         while (1)
2191         {
2192                 /* Extract a race */
2193                 r_idx = who[i];
2194
2195                 /* Hack -- Auto-recall */
2196                 monster_race_track(r_idx);
2197
2198                 /* Hack -- Handle stuff */
2199                 handle_stuff();
2200
2201                 /* Interact */
2202                 while (1)
2203                 {
2204                         /* Recall */
2205                         if (recall)
2206                         {
2207                                 /* Save the screen */
2208                                 screen_save();
2209
2210                                 /* Recall on screen */
2211                                 screen_roff(who[i], 0);
2212                         }
2213
2214                         /* Hack -- Begin the prompt */
2215                         roff_top(r_idx);
2216
2217                         /* Hack -- Complete the prompt */
2218 #ifdef JP
2219                         Term_addstr(-1, TERM_WHITE, " ['r'»×¤¤½Ð, ESC]");
2220 #else
2221                         Term_addstr(-1, TERM_WHITE, " [(r)ecall, ESC]");
2222 #endif
2223
2224                         /* Command */
2225                         query = inkey();
2226
2227                         /* Unrecall */
2228                         if (recall)
2229                         {
2230                                 /* Restore */
2231                                 screen_load();
2232                         }
2233
2234                         /* Normal commands */
2235                         if (query != 'r') break;
2236
2237                         /* Toggle recall */
2238                         recall = !recall;
2239                 }
2240
2241                 /* Stop scanning */
2242                 if (query == ESCAPE) break;
2243
2244                 /* Move to "prev" monster */
2245                 if (query == '-')
2246                 {
2247                         if (++i == n)
2248                         {
2249                                 i = 0;
2250                                 if (!expand_list) break;
2251                         }
2252                 }
2253
2254                 /* Move to "next" monster */
2255                 else
2256                 {
2257                         if (i-- == 0)
2258                         {
2259                                 i = n - 1;
2260                                 if (!expand_list) break;
2261                         }
2262                 }
2263         }
2264
2265         /* Free the "who" array */
2266         C_KILL(who, max_r_idx, u16b);
2267
2268         /* Re-display the identity */
2269         prt(buf, 0, 0);
2270 }
2271
2272