Changeset 1417

Show
Ignore:
Timestamp:
05/31/09 11:15:34 (9 months ago)
Author:
ajps
Message:

Next step in abstracting game commands from the text user interface (#348).
Previous behaviour should be preserved, except for a slight tweak to destroying items.
Various issues are outstanding even on the limited scope of this change, e.g.

  • not all do_cmd_* functions affect game state, and so should be renamed to textui_cmd_*.
  • Repeated commands are still not implemented in the new system, and use the old repetition system
  • UI and game commands are still all mixed into files in an almost random fashion.
Location:
trunk/src
Files:
1 removed
30 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/Makefile.inc

    r1319 r1417  
    2020./attack.o: attack.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    2121  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    22   defines.h option.h types.h object/types.h object/object.h \ 
    23   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    24   externs.h object/tvalsval.h 
     22  defines.h option.h types.h object/constants.h object/types.h \ 
     23  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     24  ui.h z-type.h externs.h object/tvalsval.h game-cmd.h 
    2525./birth.o: birth.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    2626  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    27   option.h types.h object/types.h object/object.h monster/types.h \ 
    28   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    29   object/tvalsval.h cmds.h game-event.h game-cmd.h ui-menu.h 
     27  option.h types.h object/constants.h object/types.h object/object.h \ 
     28  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     29  externs.h object/tvalsval.h cmds.h game-cmd.h game-event.h ui-menu.h 
    3030./button.o: button.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    3131  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    32   defines.h option.h types.h object/types.h object/object.h \ 
    33   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    34   externs.h 
     32  defines.h option.h types.h object/constants.h object/types.h \ 
     33  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     34  ui.h z-type.h externs.h 
    3535./cave.o: cave.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    3636  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    37   option.h types.h object/types.h object/object.h monster/types.h \ 
    38   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    39   object/tvalsval.h game-event.h 
     37  option.h types.h object/constants.h object/types.h object/object.h \ 
     38  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     39  externs.h object/tvalsval.h game-event.h 
    4040./cmd0.o: cmd0.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    4141  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    42   option.h types.h object/types.h object/object.h monster/types.h \ 
    43   player/types.h player/player.h store.h ui.h z-type.h externs.h wizard.h \ 
    44   cmds.h ui-menu.h 
     42  option.h types.h object/constants.h object/types.h object/object.h \ 
     43  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     44  externs.h wizard.h cmds.h game-cmd.h ui-menu.h 
    4545./cmd1.o: cmd1.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    4646  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    47   option.h types.h object/types.h object/object.h monster/types.h \ 
    48   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    49   object/tvalsval.h cmds.h 
     47  option.h types.h object/constants.h object/types.h object/object.h \ 
     48  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     49  externs.h object/tvalsval.h cmds.h game-cmd.h 
    5050./cmd2.o: cmd2.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    5151  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    52   option.h types.h object/types.h object/object.h monster/types.h \ 
    53   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    54   object/tvalsval.h cmds.h 
     52  option.h types.h object/constants.h object/types.h object/object.h \ 
     53  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     54  externs.h object/tvalsval.h cmds.h game-cmd.h 
    5555./cmd3.o: cmd3.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    5656  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    57   option.h types.h object/types.h object/object.h monster/types.h \ 
    58   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    59   object/tvalsval.h cmds.h 
     57  option.h types.h object/constants.h object/types.h object/object.h \ 
     58  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     59  externs.h object/tvalsval.h cmds.h game-cmd.h 
    6060./cmd4.o: cmd4.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    6161  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    62   option.h types.h object/types.h object/object.h monster/types.h \ 
    63   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    64   object/tvalsval.h cmds.h ui-menu.h 
     62  option.h types.h object/constants.h object/types.h object/object.h \ 
     63  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     64  externs.h object/tvalsval.h cmds.h game-cmd.h ui-menu.h 
    6565./cmd5.o: cmd5.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    6666  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    67   option.h types.h object/types.h object/object.h monster/types.h \ 
    68   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    69   object/tvalsval.h 
    70 ./cmd6.o: cmd6.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    71   z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    72   option.h types.h object/types.h object/object.h monster/types.h \ 
    73   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    74   object/tvalsval.h cmds.h effects.h list-effects.h 
     67  option.h types.h object/constants.h object/types.h object/object.h \ 
     68  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     69  externs.h object/tvalsval.h game-cmd.h 
    7570./cmd-know.o: cmd-know.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    7671  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    77   defines.h option.h types.h object/types.h object/object.h \ 
    78   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    79   externs.h object/tvalsval.h ui-menu.h 
     72  defines.h option.h types.h object/constants.h object/types.h \ 
     73  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     74  ui.h z-type.h externs.h object/tvalsval.h ui-menu.h 
    8075./cmd-obj.o: cmd-obj.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    8176  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    82   defines.h option.h types.h object/types.h object/object.h \ 
    83   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    84   externs.h object/tvalsval.h cmds.h 
     77  defines.h option.h types.h object/constants.h object/types.h \ 
     78  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     79  ui.h z-type.h externs.h object/tvalsval.h game-cmd.h cmds.h effects.h \ 
     80  list-effects.h 
    8581./death.o: death.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    8682  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    87   option.h types.h object/types.h object/object.h monster/types.h \ 
    88   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    89   ui-menu.h cmds.h wizard.h 
     83  option.h types.h object/constants.h object/types.h object/object.h \ 
     84  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     85  externs.h ui-menu.h cmds.h game-cmd.h wizard.h 
    9086./debug.o: debug.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    9187  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    92   option.h types.h object/types.h object/object.h monster/types.h \ 
    93   player/types.h player/player.h store.h ui.h z-type.h externs.h debug.h 
     88  option.h types.h object/constants.h object/types.h object/object.h \ 
     89  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     90  externs.h debug.h 
    9491./dungeon.o: dungeon.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    9592  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    96   defines.h option.h types.h object/types.h object/object.h \ 
    97   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    98   externs.h object/tvalsval.h cmds.h game-event.h 
     93  defines.h option.h types.h object/constants.h object/types.h \ 
     94  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     95  ui.h z-type.h externs.h object/tvalsval.h cmds.h game-cmd.h \ 
     96  game-event.h 
    9997./effects.o: effects.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    10098  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    101   defines.h option.h types.h object/types.h object/object.h \ 
    102   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    103   externs.h effects.h list-effects.h 
     99  defines.h option.h types.h object/constants.h object/types.h \ 
     100  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     101  ui.h z-type.h externs.h effects.h list-effects.h 
    104102./files.o: files.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    105103  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    106   option.h types.h object/types.h object/object.h monster/types.h \ 
    107   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    108   object/tvalsval.h ui-menu.h cmds.h 
     104  option.h types.h object/constants.h object/types.h object/object.h \ 
     105  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     106  externs.h object/tvalsval.h ui-menu.h game-cmd.h cmds.h 
    109107./game-cmd.o: game-cmd.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    110108  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    111   defines.h option.h types.h object/types.h object/object.h \ 
    112   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    113   externs.h game-cmd.h 
     109  defines.h option.h types.h object/constants.h object/types.h \ 
     110  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     111  ui.h z-type.h externs.h game-cmd.h cmds.h 
    114112./game-event.o: game-event.c z-virt.h h-basic.h game-event.h 
    115113./generate.o: generate.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    116114  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    117   defines.h option.h types.h object/types.h object/object.h \ 
    118   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    119   externs.h object/tvalsval.h 
     115  defines.h option.h types.h object/constants.h object/types.h \ 
     116  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     117  ui.h z-type.h externs.h object/tvalsval.h 
    120118./history.o: history.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    121119  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    122   defines.h option.h types.h object/types.h object/object.h \ 
     120  defines.h option.h types.h object/constants.h object/types.h \ 
     121  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     122  ui.h z-type.h externs.h 
     123./init1.o: init1.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
     124  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
     125  option.h types.h object/constants.h object/types.h object/object.h \ 
     126  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     127  externs.h object/tvalsval.h effects.h list-effects.h \ 
     128  monster/constants.h init.h 
     129./init2.o: init2.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
     130  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
     131  option.h types.h object/constants.h object/types.h object/object.h \ 
     132  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     133  externs.h init.h cmds.h game-cmd.h game-event.h 
     134./load.o: load.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
     135  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
     136  option.h types.h object/constants.h object/types.h object/object.h \ 
     137  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     138  externs.h object/tvalsval.h savefile.h 
     139./load-old.o: load-old.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     140  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     141  defines.h option.h types.h object/constants.h object/types.h \ 
     142  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     143  ui.h z-type.h externs.h object/tvalsval.h 
     144./monster/melee1.o: monster/melee1.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     145  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     146  defines.h option.h types.h object/constants.h object/types.h \ 
     147  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     148  ui.h z-type.h externs.h object/tvalsval.h 
     149./monster/melee2.o: monster/melee2.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     150  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     151  defines.h option.h types.h object/constants.h object/types.h \ 
     152  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     153  ui.h z-type.h externs.h bitflag.h object/tvalsval.h monster/constants.h 
     154./monster/monster1.o: monster/monster1.c angband.h h-basic.h z-file.h z-form.h \ 
     155  z-util.h z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h \ 
     156  config.h defines.h option.h types.h object/constants.h object/types.h \ 
     157  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     158  ui.h z-type.h externs.h object/tvalsval.h 
     159./monster/monster2.o: monster/monster2.c angband.h h-basic.h z-file.h z-form.h \ 
     160  z-util.h z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h \ 
     161  config.h defines.h option.h types.h object/constants.h object/types.h \ 
     162  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     163  ui.h z-type.h externs.h object/tvalsval.h 
     164./object/identify.o: object/identify.c angband.h h-basic.h z-file.h z-form.h \ 
     165  z-util.h z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h \ 
     166  config.h defines.h option.h types.h object/constants.h object/types.h \ 
     167  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     168  ui.h z-type.h externs.h object/tvalsval.h 
     169./object/obj-desc.o: object/obj-desc.c angband.h h-basic.h z-file.h z-form.h \ 
     170  z-util.h z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h \ 
     171  config.h defines.h option.h types.h object/constants.h object/types.h \ 
     172  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     173  ui.h z-type.h externs.h object/tvalsval.h 
     174./object/obj-info.o: object/obj-info.c angband.h h-basic.h z-file.h z-form.h \ 
     175  z-util.h z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h \ 
     176  config.h defines.h option.h types.h object/constants.h object/types.h \ 
     177  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     178  ui.h z-type.h externs.h effects.h list-effects.h cmds.h game-cmd.h \ 
     179  object/tvalsval.h 
     180./object/obj-make.o: object/obj-make.c angband.h h-basic.h z-file.h z-form.h \ 
     181  z-util.h z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h \ 
     182  config.h defines.h option.h types.h object/constants.h object/types.h \ 
     183  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     184  ui.h z-type.h externs.h object/tvalsval.h 
     185./object/obj-power.o: object/obj-power.c angband.h h-basic.h z-file.h z-form.h \ 
     186  z-util.h z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h \ 
     187  config.h defines.h option.h types.h object/constants.h object/types.h \ 
     188  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     189  ui.h z-type.h externs.h object/tvalsval.h init.h effects.h \ 
     190  list-effects.h 
     191./object/obj-ui.o: object/obj-ui.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     192  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     193  defines.h option.h types.h object/constants.h object/types.h \ 
     194  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     195  ui.h z-type.h externs.h object/tvalsval.h 
     196./object/obj-util.o: object/obj-util.c angband.h h-basic.h z-file.h z-form.h \ 
     197  z-util.h z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h \ 
     198  config.h defines.h option.h types.h object/constants.h object/types.h \ 
     199  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     200  ui.h z-type.h externs.h randname.h object/tvalsval.h effects.h \ 
     201  list-effects.h 
     202./object/randart.o: object/randart.c angband.h h-basic.h z-file.h z-form.h \ 
     203  z-util.h z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h \ 
     204  config.h defines.h option.h types.h object/constants.h object/types.h \ 
     205  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     206  ui.h z-type.h externs.h object/tvalsval.h init.h randname.h 
     207./option.o: option.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     208  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     209  defines.h option.h types.h object/constants.h object/types.h \ 
     210  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     211  ui.h z-type.h externs.h 
     212./randname.o: randname.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     213  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     214  defines.h option.h types.h object/constants.h object/types.h \ 
     215  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     216  ui.h z-type.h externs.h randname.h 
     217./pathfind.o: pathfind.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     218  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     219  defines.h option.h types.h object/constants.h object/types.h \ 
     220  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     221  ui.h z-type.h externs.h 
     222./prefs.o: prefs.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
     223  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
     224  option.h types.h object/constants.h object/types.h object/object.h \ 
    123225  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    124226  externs.h 
    125 ./init1.o: init1.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    126   z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    127   option.h types.h object/types.h object/object.h monster/types.h \ 
    128   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    129   object/tvalsval.h effects.h list-effects.h monster/constants.h init.h 
    130 ./init2.o: init2.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    131   z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    132   option.h types.h object/types.h object/object.h monster/types.h \ 
    133   player/types.h player/player.h store.h ui.h z-type.h externs.h init.h \ 
    134   cmds.h game-event.h game-cmd.h 
    135 ./load.o: load.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    136   z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    137   option.h types.h object/types.h object/object.h monster/types.h \ 
    138   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    139   object/tvalsval.h savefile.h 
    140 ./load-old.o: load-old.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    141   z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    142   defines.h option.h types.h object/types.h object/object.h \ 
    143   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    144   externs.h object/tvalsval.h 
    145 ./monster/melee1.o: monster/melee1.c angband.h h-basic.h z-file.h h-basic.h \ 
    146   z-form.h h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h \ 
    147   h-basic.h z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h \ 
    148   config.h defines.h option.h types.h object/types.h object/object.h \ 
    149   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    150   externs.h object/tvalsval.h 
    151 ./monster/melee2.o: monster/melee2.c angband.h h-basic.h z-file.h h-basic.h \ 
    152   z-form.h h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h \ 
    153   h-basic.h z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h \ 
    154   config.h defines.h option.h types.h object/types.h object/object.h \ 
    155   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    156   externs.h bitflag.h object/tvalsval.h monster/constants.h 
    157 ./monster/monster1.o: monster/monster1.c angband.h h-basic.h z-file.h h-basic.h \ 
    158   z-form.h h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h \ 
    159   h-basic.h z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h \ 
    160   config.h defines.h option.h types.h object/types.h object/object.h \ 
    161   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    162   externs.h object/tvalsval.h 
    163 ./monster/monster2.o: monster/monster2.c angband.h h-basic.h z-file.h h-basic.h \ 
    164   z-form.h h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h \ 
    165   h-basic.h z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h \ 
    166   config.h defines.h option.h types.h object/types.h object/object.h \ 
    167   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    168   externs.h object/tvalsval.h 
    169 ./object/identify.o: object/identify.c angband.h h-basic.h z-file.h h-basic.h \ 
    170   z-form.h h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h \ 
    171   h-basic.h z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h \ 
    172   config.h defines.h option.h types.h object/types.h object/object.h \ 
    173   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    174   externs.h object/tvalsval.h 
    175 ./object/obj-desc.o: object/obj-desc.c angband.h h-basic.h z-file.h h-basic.h \ 
    176   z-form.h h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h \ 
    177   h-basic.h z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h \ 
    178   config.h defines.h option.h types.h object/types.h object/object.h \ 
    179   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    180   externs.h object/tvalsval.h 
    181 ./object/obj-info.o: object/obj-info.c angband.h h-basic.h z-file.h h-basic.h \ 
    182   z-form.h h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h \ 
    183   h-basic.h z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h \ 
    184   config.h defines.h option.h types.h object/types.h object/object.h \ 
    185   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    186   externs.h effects.h list-effects.h cmds.h object/tvalsval.h 
    187 ./object/obj-make.o: object/obj-make.c angband.h h-basic.h z-file.h h-basic.h \ 
    188   z-form.h h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h \ 
    189   h-basic.h z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h \ 
    190   config.h defines.h option.h types.h object/types.h object/object.h \ 
    191   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    192   externs.h object/tvalsval.h 
    193 ./object/obj-power.o: object/obj-power.c angband.h h-basic.h z-file.h h-basic.h \ 
    194   z-form.h h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h \ 
    195   h-basic.h z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h \ 
    196   config.h defines.h option.h types.h object/types.h object/object.h \ 
    197   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    198   externs.h object/tvalsval.h init.h h-basic.h 
    199 ./object/obj-ui.o: object/obj-ui.c angband.h h-basic.h z-file.h h-basic.h z-form.h \ 
    200   h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h h-basic.h \ 
    201   z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h config.h \ 
    202   defines.h option.h types.h object/types.h object/object.h \ 
    203   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    204   externs.h object/tvalsval.h 
    205 ./object/obj-util.o: object/obj-util.c angband.h h-basic.h z-file.h h-basic.h \ 
    206   z-form.h h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h \ 
    207   h-basic.h z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h \ 
    208   config.h defines.h option.h types.h object/types.h object/object.h \ 
    209   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    210   externs.h randname.h object/tvalsval.h 
    211 ./object/randart.o: object/randart.c angband.h h-basic.h z-file.h h-basic.h \ 
    212   z-form.h h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h \ 
    213   h-basic.h z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h \ 
    214   config.h defines.h option.h types.h object/types.h object/object.h \ 
    215   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    216   externs.h object/tvalsval.h init.h h-basic.h randname.h 
    217 ./option.o: option.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    218   z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    219   defines.h option.h types.h object/types.h object/object.h \ 
     227./player/calcs.o: player/calcs.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     228  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     229  defines.h option.h types.h object/constants.h object/types.h \ 
     230  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     231  ui.h z-type.h externs.h game-event.h object/tvalsval.h 
     232./player/timed.o: player/timed.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     233  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     234  defines.h option.h types.h object/constants.h object/types.h \ 
     235  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     236  ui.h z-type.h externs.h 
     237./player/util.o: player/util.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     238  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     239  defines.h option.h types.h object/constants.h object/types.h \ 
     240  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     241  ui.h z-type.h externs.h 
     242./score.o: score.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
     243  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
     244  option.h types.h object/constants.h object/types.h object/object.h \ 
    220245  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    221246  externs.h 
    222 ./randname.o: randname.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    223   z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    224   defines.h option.h types.h object/types.h object/object.h \ 
    225   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    226   externs.h randname.h 
    227 ./pathfind.o: pathfind.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    228   z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    229   defines.h option.h types.h object/types.h object/object.h \ 
     247./signals.o: signals.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     248  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     249  defines.h option.h types.h object/constants.h object/types.h \ 
     250  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     251  ui.h z-type.h externs.h 
     252./save.o: save.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
     253  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
     254  option.h types.h object/constants.h object/types.h object/object.h \ 
     255  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     256  externs.h savefile.h 
     257./savefile.o: savefile.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     258  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     259  defines.h option.h types.h object/constants.h object/types.h \ 
     260  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     261  ui.h z-type.h externs.h savefile.h 
     262./spells1.o: spells1.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     263  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     264  defines.h option.h types.h object/constants.h object/types.h \ 
     265  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     266  ui.h z-type.h externs.h object/tvalsval.h monster/constants.h 
     267./spells2.o: spells2.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     268  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     269  defines.h option.h types.h object/constants.h object/types.h \ 
     270  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     271  ui.h z-type.h externs.h object/tvalsval.h 
     272./squelch.o: squelch.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     273  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     274  defines.h option.h types.h object/constants.h object/types.h \ 
     275  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     276  ui.h z-type.h externs.h cmds.h game-cmd.h ui-menu.h object/tvalsval.h 
     277./store.o: store.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
     278  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
     279  option.h types.h object/constants.h object/types.h object/object.h \ 
     280  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     281  externs.h cmds.h game-cmd.h ui-menu.h game-event.h object/tvalsval.h 
     282./tables.o: tables.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     283  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     284  defines.h option.h types.h object/constants.h object/types.h \ 
     285  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     286  ui.h z-type.h externs.h object/tvalsval.h 
     287./target.o: target.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
     288  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     289  defines.h option.h types.h object/constants.h object/types.h \ 
     290  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     291  ui.h z-type.h externs.h game-cmd.h 
     292./trap.o: trap.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
     293  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
     294  option.h types.h object/constants.h object/types.h object/object.h \ 
    230295  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    231296  externs.h 
    232 ./prefs.o: prefs.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    233   z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    234   option.h types.h object/types.h object/object.h monster/types.h \ 
    235   player/types.h player/player.h store.h ui.h z-type.h externs.h 
    236 ./player/calcs.o: player/calcs.c angband.h h-basic.h z-file.h h-basic.h z-form.h \ 
    237   h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h h-basic.h \ 
    238   z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h config.h \ 
    239   defines.h option.h types.h object/types.h object/object.h \ 
    240   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    241   externs.h game-event.h object/tvalsval.h 
    242 ./player/timed.o: player/timed.c angband.h h-basic.h z-file.h h-basic.h z-form.h \ 
    243   h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h h-basic.h \ 
    244   z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h config.h \ 
    245   defines.h option.h types.h object/types.h object/object.h \ 
     297./ui.o: ui.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
     298  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
     299  option.h types.h object/constants.h object/types.h object/object.h \ 
    246300  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    247301  externs.h 
    248 ./player/util.o: player/util.c angband.h h-basic.h z-file.h h-basic.h z-form.h \ 
    249   h-basic.h z-util.h h-basic.h z-virt.h h-basic.h z-rand.h h-basic.h \ 
    250   z-term.h h-basic.h ui-event.h z-quark.h z-msg.h h-basic.h config.h \ 
    251   defines.h option.h types.h object/types.h object/object.h \ 
    252   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    253   externs.h 
    254 ./score.o: score.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    255   z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    256   option.h types.h object/types.h object/object.h monster/types.h \ 
    257   player/types.h player/player.h store.h ui.h z-type.h externs.h 
    258 ./signals.o: signals.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    259   z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    260   defines.h option.h types.h object/types.h object/object.h \ 
    261   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    262   externs.h 
    263 ./save.o: save.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    264   z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    265   option.h types.h object/types.h object/object.h monster/types.h \ 
    266   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    267   savefile.h 
    268 ./savefile.o: savefile.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    269   z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    270   defines.h option.h types.h object/types.h object/object.h \ 
    271   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    272   externs.h savefile.h 
    273 ./spells1.o: spells1.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    274   z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    275   defines.h option.h types.h object/types.h object/object.h \ 
    276   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    277   externs.h object/tvalsval.h monster/constants.h 
    278 ./spells2.o: spells2.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    279   z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    280   defines.h option.h types.h object/types.h object/object.h \ 
    281   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    282   externs.h object/tvalsval.h 
    283 ./squelch.o: squelch.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    284   z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    285   defines.h option.h types.h object/types.h object/object.h \ 
    286   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    287   externs.h cmds.h ui-menu.h object/tvalsval.h 
    288 ./store.o: store.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    289   z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    290   option.h types.h object/types.h object/object.h monster/types.h \ 
    291   player/types.h player/player.h store.h ui.h z-type.h externs.h cmds.h \ 
    292   ui-menu.h game-event.h object/tvalsval.h 
    293 ./tables.o: tables.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    294   z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    295   defines.h option.h types.h object/types.h object/object.h \ 
    296   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    297   externs.h object/tvalsval.h 
    298 ./target.o: target.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    299   z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    300   defines.h option.h types.h object/types.h object/object.h \ 
    301   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    302   externs.h cmds.h 
    303 ./trap.o: trap.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    304   z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    305   option.h types.h object/types.h object/object.h monster/types.h \ 
    306   player/types.h player/player.h store.h ui.h z-type.h externs.h 
    307 ./ui.o: ui.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    308   z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    309   option.h types.h object/types.h object/object.h monster/types.h \ 
    310   player/types.h player/player.h store.h ui.h z-type.h externs.h 
    311302./ui-birth.o: ui-birth.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    312303  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    313   defines.h option.h types.h object/types.h object/object.h \ 
    314   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    315   externs.h ui-menu.h ui-birth.h game-event.h game-cmd.h 
     304  defines.h option.h types.h object/constants.h object/types.h \ 
     305  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     306  ui.h z-type.h externs.h ui-menu.h ui-birth.h game-event.h game-cmd.h \ 
     307  cmds.h 
    316308./ui-event.o: ui-event.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    317309  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    318   defines.h option.h types.h object/types.h object/object.h \ 
    319   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    320   externs.h 
     310  defines.h option.h types.h object/constants.h object/types.h \ 
     311  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     312  ui.h z-type.h externs.h 
    321313./ui-menu.o: ui-menu.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    322314  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    323   defines.h option.h types.h object/types.h object/object.h \ 
    324   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    325   externs.h ui-menu.h 
     315  defines.h option.h types.h object/constants.h object/types.h \ 
     316  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     317  ui.h z-type.h externs.h ui-menu.h 
    326318./util.o: util.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    327319  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    328   option.h types.h object/types.h object/object.h monster/types.h \ 
    329   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    330   game-event.h randname.h 
     320  option.h types.h object/constants.h object/types.h object/object.h \ 
     321  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     322  externs.h game-event.h randname.h 
    331323./variable.o: variable.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    332324  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    333   defines.h option.h types.h object/types.h object/object.h \ 
    334   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    335   externs.h 
     325  defines.h option.h types.h object/constants.h object/types.h \ 
     326  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     327  ui.h z-type.h externs.h 
    336328./wiz-spoil.o: wiz-spoil.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    337329  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    338   defines.h option.h types.h object/types.h object/object.h \ 
    339   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    340   externs.h wizard.h cmds.h object/tvalsval.h 
     330  defines.h option.h types.h object/constants.h object/types.h \ 
     331  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     332  ui.h z-type.h externs.h wizard.h cmds.h game-cmd.h object/tvalsval.h 
    341333./wiz-stats.o: wiz-stats.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    342334  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    343   defines.h option.h types.h object/types.h object/object.h \ 
    344   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    345   externs.h cmds.h wizard.h object/tvalsval.h 
     335  defines.h option.h types.h object/constants.h object/types.h \ 
     336  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     337  ui.h z-type.h externs.h cmds.h game-cmd.h wizard.h object/tvalsval.h 
    346338./wizard.o: wizard.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    347339  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    348   defines.h option.h types.h object/types.h object/object.h \ 
    349   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    350   externs.h wizard.h cmds.h object/tvalsval.h 
     340  defines.h option.h types.h object/constants.h object/types.h \ 
     341  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     342  ui.h z-type.h externs.h wizard.h cmds.h game-cmd.h object/tvalsval.h 
    351343./x-spell.o: x-spell.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    352344  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    353   defines.h option.h types.h object/types.h object/object.h \ 
    354   monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
    355   externs.h effects.h list-effects.h object/tvalsval.h 
     345  defines.h option.h types.h object/constants.h object/types.h \ 
     346  object/object.h monster/types.h player/types.h player/player.h store.h \ 
     347  ui.h z-type.h externs.h effects.h list-effects.h object/tvalsval.h 
    356348./xtra2.o: xtra2.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    357349  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    358   option.h types.h object/types.h object/object.h monster/types.h \ 
    359   player/types.h player/player.h store.h ui.h z-type.h externs.h cmds.h \ 
    360   object/tvalsval.h 
     350  option.h types.h object/constants.h object/types.h object/object.h \ 
     351  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     352  externs.h cmds.h game-cmd.h object/tvalsval.h 
    361353./xtra3.o: xtra3.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    362354  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    363   option.h types.h object/types.h object/object.h monster/types.h \ 
    364   player/types.h player/player.h store.h ui.h z-type.h externs.h \ 
    365   game-event.h ui-birth.h object/tvalsval.h 
     355  option.h types.h object/constants.h object/types.h object/object.h \ 
     356  monster/types.h player/types.h player/player.h store.h ui.h z-type.h \ 
     357  externs.h game-event.h game-cmd.h textui.h ui-birth.h object/tvalsval.h 
    366358./z-file.o: z-file.c z-file.h h-basic.h z-virt.h z-util.h z-form.h 
    367359./z-form.o: z-form.c z-form.h h-basic.h z-type.h z-util.h z-virt.h 
  • trunk/src/Makefile.src

    r1319 r1417  
    6363        cmd4.o \ 
    6464        cmd5.o \ 
    65         cmd6.o \ 
    6665        cmd-know.o \ 
    6766        cmd-obj.o \ 
  • trunk/src/attack.c

    r1383 r1417  
    2020#include "object/object.h" 
    2121#include "object/tvalsval.h" 
    22  
     22#include "game-cmd.h" 
    2323 
    2424/** 
     
    465465 * for the damage multiplier. 
    466466 */ 
    467 void do_cmd_fire(void) 
     467void do_cmd_fire(cmd_code code, cmd_arg args[]) 
    468468{ 
    469469        int dir, item; 
     
    489489        u16b path_g[256]; 
    490490 
    491         cptr q, s; 
    492  
    493491        int msec = op_ptr->delay_factor * op_ptr->delay_factor; 
    494492 
    495  
    496         /* Get the "bow" (if any) */ 
     493        /* Get item to fire and direction to fire in. */ 
     494        item = args[0].item; 
     495        dir = args[1].direction; 
     496 
     497        /* Get the object for the ammo */ 
     498        o_ptr = object_from_item_idx(item); 
     499 
     500        /* Get the "bow" */ 
    497501        j_ptr = &inventory[INVEN_BOW]; 
    498  
    499         /* Require a usable launcher */ 
    500         if (!j_ptr->tval || !p_ptr->state.ammo_tval) 
    501         { 
    502                 msg_print("You have nothing to fire with."); 
    503                 return; 
    504         } 
    505  
    506  
    507         /* Require proper missile */ 
    508         item_tester_tval = p_ptr->state.ammo_tval; 
    509  
    510         /* Get an item */ 
    511         q = "Fire which item? "; 
    512         s = "You have nothing to fire."; 
    513         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; 
    514  
    515         /* Get the object */ 
    516         if (item >= 0) 
    517         { 
    518                 o_ptr = &inventory[item]; 
    519         } 
    520         else 
    521         { 
    522                 o_ptr = &o_list[0 - item]; 
    523         } 
    524  
    525         /* Get a direction (or cancel) */ 
    526         if (!get_aim_dir(&dir)) return; 
    527502 
    528503        /* Base range XXX XXX */ 
     
    760735} 
    761736 
    762  
     737void textui_cmd_fire(void) 
     738{ 
     739        object_type *j_ptr, *o_ptr; 
     740        int item; 
     741        int dir; 
     742        cptr q, s; 
     743 
     744 
     745        /* Get the "bow" (if any) */ 
     746        j_ptr = &inventory[INVEN_BOW]; 
     747 
     748        /* Require a usable launcher */ 
     749        if (!j_ptr->tval || !p_ptr->state.ammo_tval) 
     750        { 
     751                msg_print("You have nothing to fire with."); 
     752                return; 
     753        } 
     754 
     755        /* Require proper missile */ 
     756        item_tester_tval = p_ptr->state.ammo_tval; 
     757 
     758        /* Get an item */ 
     759        q = "Fire which item? "; 
     760        s = "You have nothing to fire."; 
     761        if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; 
     762 
     763        /* Get the object */ 
     764        o_ptr = object_from_item_idx(item); 
     765 
     766        /* Get a direction (or cancel) */ 
     767        if (!get_aim_dir(&dir)) return; 
     768 
     769        cmd_insert(CMD_FIRE, item, dir); 
     770} 
    763771 
    764772/* 
     
    771779 * the item to be destroyed?  Should it do any damage at all? 
    772780 */ 
    773 void do_cmd_throw(void) 
     781void do_cmd_throw(cmd_code code, cmd_arg args[]) 
    774782{ 
    775783        int dir, item; 
     
    794802        u16b path_g[256]; 
    795803 
    796         cptr q, s; 
    797  
    798804        int msec = op_ptr->delay_factor * op_ptr->delay_factor; 
    799805 
    800  
    801         /* Get an item */ 
    802         q = "Throw which item? "; 
    803         s = "You have nothing to throw."; 
    804         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; 
     806        /* Get item to throw and direction in which to throw it. */ 
     807        item = args[0].item; 
     808        dir = args[1].direction; 
    805809 
    806810        /* Get the object */ 
    807         if (item >= 0) 
    808         { 
    809                 o_ptr = &inventory[item]; 
    810         } 
    811         else 
    812         { 
    813                 o_ptr = &o_list[0 - item]; 
    814         } 
    815  
    816  
    817         /* Get a direction (or cancel) */ 
    818         if (!get_aim_dir(&dir)) return; 
    819  
     811        o_ptr = object_from_item_idx(item); 
    820812 
    821813        /* Get local object */ 
     
    10471039        drop_near(i_ptr, j, y, x); 
    10481040} 
     1041 
     1042void textui_cmd_throw(void) 
     1043{ 
     1044        int item, dir; 
     1045        cptr q, s; 
     1046 
     1047        /* Get an item */ 
     1048        q = "Throw which item? "; 
     1049        s = "You have nothing to throw."; 
     1050        if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; 
     1051 
     1052        /* Get a direction (or cancel) */ 
     1053        if (!get_aim_dir(&dir)) return; 
     1054 
     1055        cmd_insert(CMD_THROW, item, dir); 
     1056} 
  • trunk/src/birth.c

    r1401 r1417  
    10011001{ 
    10021002        int i; 
    1003         game_command cmd = { CMD_NULL, 0, {0} }; 
     1003        game_command cmd = { CMD_NULL, 0, {{0}} }; 
    10041004 
    10051005        int stats[A_MAX]; 
     
    10601060                else if (cmd.command == CMD_CHOOSE_SEX) 
    10611061                { 
    1062                         p_ptr->psex = cmd.params.choice;  
     1062                        p_ptr->psex = cmd.args[0].choice;  
    10631063                        generate_player(); 
    10641064                } 
    10651065                else if (cmd.command == CMD_CHOOSE_RACE) 
    10661066                { 
    1067                         p_ptr->prace = cmd.params.choice; 
     1067                        p_ptr->prace = cmd.args[0].choice; 
    10681068                        generate_player(); 
    10691069 
     
    10741074                else if (cmd.command == CMD_CHOOSE_CLASS) 
    10751075                { 
    1076                         p_ptr->pclass = cmd.params.choice; 
     1076                        p_ptr->pclass = cmd.args[0].choice; 
    10771077                        generate_player(); 
    10781078 
     
    10851085                        /* .choice is the stat to buy */ 
    10861086                        if (!rolled_stats) 
    1087                                 buy_stat(cmd.params.choice, stats, points_spent, &points_left); 
     1087                                buy_stat(cmd.args[0].choice, stats, points_spent, &points_left); 
    10881088                } 
    10891089                else if (cmd.command == CMD_SELL_STAT) 
     
    10911091                        /* .choice is the stat to sell */ 
    10921092                        if (!rolled_stats) 
    1093                                 sell_stat(cmd.params.choice, stats, points_spent, &points_left); 
     1093                                sell_stat(cmd.args[0].choice, stats, points_spent, &points_left); 
    10941094                } 
    10951095                else if (cmd.command == CMD_RESET_STATS) 
     
    10981098                        reset_stats(stats, points_spent, &points_left); 
    10991099 
    1100                         if (cmd.params.choice) 
     1100                        if (cmd.args[0].choice) 
    11011101                                generate_stats(stats, points_spent, &points_left); 
    11021102 
     
    11571157                { 
    11581158                        /* Set player name */ 
    1159                         my_strcpy(op_ptr->full_name, cmd.params.string,  
     1159                        my_strcpy(op_ptr->full_name, cmd.args[0].string,  
    11601160                                          sizeof(op_ptr->full_name)); 
    11611161                         
    1162                         string_free((void *) cmd.params.string); 
     1162                        string_free((void *) cmd.args[0].string); 
    11631163                         
    11641164                        /* Don't change savefile name.  If the UI 
     
    11671167                } 
    11681168                /* Various not-specific-to-birth commands. */ 
    1169                 else if (cmd.command == CMD_OPTIONS)  
    1170                 { 
    1171                         /* TODO: Change this to use whatever sort of message passing 
    1172                            system we eventually decide on for options.  That might 
    1173                            still be calling do_cmd_option. :) */ 
    1174                         do_cmd_options(); 
    1175                 } 
    11761169                else if (cmd.command == CMD_HELP) 
    11771170                { 
  • trunk/src/cmd-obj.c

    r1346 r1417  
    1919#include "angband.h" 
    2020#include "object/tvalsval.h" 
     21#include "object/object.h" 
     22#include "game-cmd.h" 
    2123#include "cmds.h" 
     24#include "effects.h" 
     25 
     26/*** Utility bits and bobs ***/ 
     27/* 
     28 * Check to see if the player can use a rod/wand/staff/activatable object. 
     29 */ 
     30static int check_devices(object_type *o_ptr) 
     31{ 
     32        int lev, chance; 
     33        const char *msg; 
     34        const char *what = NULL; 
     35 
     36        /* Get the right string */ 
     37        switch (o_ptr->tval) 
     38        { 
     39                case TV_ROD:   msg = "zap the rod";   break; 
     40                case TV_WAND:  msg = "use the wand";  what = "wand";  break; 
     41                case TV_STAFF: msg = "use the staff"; what = "staff"; break; 
     42                default:       msg = "activate it";  break; 
     43        } 
     44 
     45        /* Extract the item level */ 
     46        if (artifact_p(o_ptr)) 
     47                lev = a_info[o_ptr->name1].level; 
     48        else 
     49                lev = k_info[o_ptr->k_idx].level; 
     50 
     51        /* Base chance of success */ 
     52        chance = p_ptr->state.skills[SKILL_DEVICE]; 
     53 
     54        /* Confusion hurts skill */ 
     55        if (p_ptr->timed[TMD_CONFUSED] || p_ptr->timed[TMD_AMNESIA]) 
     56                chance = chance / 2; 
     57 
     58        /* High level objects are harder */ 
     59        chance -= MIN(lev, 50); 
     60 
     61        /* Give everyone a (slight) chance */ 
     62        if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1)) 
     63        { 
     64                chance = USE_DEVICE; 
     65        } 
     66 
     67        /* Roll for usage */ 
     68        if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE)) 
     69        { 
     70                if (OPT(flush_failure)) flush(); 
     71                msg_format("You failed to %s properly.", msg); 
     72                return FALSE; 
     73        } 
     74 
     75        /* Notice empty staffs */ 
     76        if (what && o_ptr->pval <= 0) 
     77        { 
     78                if (OPT(flush_failure)) flush(); 
     79                msg_format("The %s has no charges left.", what); 
     80                o_ptr->ident |= (IDENT_EMPTY); 
     81                return FALSE; 
     82        } 
     83 
     84        return TRUE; 
     85} 
     86 
     87/* 
     88 * Return the chance of an effect beaming, given a tval. 
     89 */ 
     90static int beam_chance(int tval) 
     91{ 
     92        switch (tval) 
     93        { 
     94                case TV_WAND: return 20; 
     95                case TV_ROD:  return 10; 
     96        } 
     97 
     98        return 0; 
     99} 
     100 
     101 
     102typedef enum {  
     103        ART_TAG_NONE,  
     104        ART_TAG_NAME,  
     105        ART_TAG_KIND,  
     106        ART_TAG_VERB,  
     107        ART_TAG_VERB_IS  
     108} art_tag_t; 
     109 
     110static art_tag_t art_tag_lookup(const char *tag) 
     111{ 
     112        if (strncmp(tag, "name", 4) == 0) 
     113                return ART_TAG_NAME; 
     114        else if (strncmp(tag, "kind", 4) == 0) 
     115                return ART_TAG_KIND; 
     116        else if (strncmp(tag, "s", 1) == 0) 
     117                return ART_TAG_VERB; 
     118        else if (strncmp(tag, "is", 2) == 0) 
     119                return ART_TAG_VERB_IS; 
     120        else 
     121                return ART_TAG_NONE; 
     122} 
     123 
     124/* 
     125 * Print an artifact activation message. 
     126 *  
     127 * In order to support randarts, with scrambled names, we re-write 
     128 * the message to replace instances of {name} with the artifact name 
     129 * and instances of {kind} with the type of object. 
     130 * 
     131 * This code deals with plural and singular forms of verbs correctly  
     132 * when encountering {s}, though in fact both names and kinds are  
     133 * always singular in the current code (gloves are "Set of" and boots 
     134 * are "Pair of") 
     135 */ 
     136static void activation_message(object_type *o_ptr, const char *message) 
     137{ 
     138        char buf[1024] = "\0"; 
     139        const char *next; 
     140        const char *s; 
     141        const char *tag; 
     142        const char *in_cursor; 
     143        size_t end = 0; 
     144  
     145        in_cursor = message; 
     146  
     147        next = strchr(in_cursor, '{'); 
     148        while (next) 
     149        { 
     150                /* Copy the text leading up to this { */ 
     151                strnfcat(buf, 1024, &end, "%.*s", next - in_cursor, in_cursor);  
     152 
     153                s = next + 1; 
     154                while (*s && isalpha((unsigned char) *s)) s++; 
     155 
     156                if (*s == '}')          /* Valid tag */ 
     157                { 
     158                        tag = next + 1; /* Start the tag after the { */ 
     159                        in_cursor = s + 1; 
     160  
     161                        switch(art_tag_lookup(tag)) 
     162                        { 
     163                        case ART_TAG_NAME: 
     164                                end += object_desc(buf, 1024, o_ptr, TRUE, ODESC_BASE);  
     165                                break; 
     166                        case ART_TAG_KIND: 
     167                                object_kind_name(&buf[end], 1024-end, o_ptr->k_idx, TRUE); 
     168                                end += strlen(&buf[end]); 
     169                                break; 
     170                        case ART_TAG_VERB: 
     171                                strnfcat(buf, 1024, &end, "s"); 
     172                                break; 
     173                        case ART_TAG_VERB_IS: 
     174                                if((end > 2) && (buf[end-2] == 's')) 
     175                                        strnfcat(buf, 1024, &end, "are"); 
     176                                else 
     177                                        strnfcat(buf, 1024, &end, "is"); 
     178                        default: 
     179                                break; 
     180                        } 
     181                } 
     182                else    /* An invalid tag, skip it */ 
     183                { 
     184                        in_cursor = next + 1; 
     185                }  
     186 
     187                next = strchr(in_cursor, '{'); 
     188        } 
     189        strnfcat(buf, 1024, &end, in_cursor); 
     190  
     191        msg_print(buf); 
     192}  
     193 
    22194 
    23195 
    24196/*** Inscriptions ***/ 
    25197 
    26 /* Can has inscrip pls */ 
    27 static bool obj_has_inscrip(const object_type *o_ptr) 
    28 { 
    29         return (o_ptr->note ? TRUE : FALSE); 
    30 } 
    31  
    32198/* Remove inscription */ 
    33 static void obj_uninscribe(object_type *o_ptr, int item) 
    34 { 
     199void do_cmd_uninscribe(cmd_code code, cmd_arg args[]) 
     200{ 
     201        object_type *o_ptr = object_from_item_idx(args[0].item); 
     202 
    35203        o_ptr->note = 0; 
    36204        msg_print("Inscription removed."); 
     
    41209 
    42210/* Add inscription */ 
     211void do_cmd_inscribe(cmd_code code, cmd_arg args[]) 
     212{ 
     213        object_type *o_ptr = object_from_item_idx(args[0].item); 
     214         
     215        o_ptr->note = quark_add(args[1].string); 
     216 
     217        p_ptr->notice |= (PN_COMBINE | PN_SQUELCH); 
     218        p_ptr->redraw |= (PR_INVEN | PR_EQUIP); 
     219} 
     220 
    43221static void obj_inscribe(object_type *o_ptr, int item) 
    44222{ 
     
    57235        if (get_string("Inscription: ", tmp, sizeof(tmp))) 
    58236        { 
    59                 o_ptr->note = quark_add(tmp); 
    60  
    61                 p_ptr->notice |= (PN_COMBINE | PN_SQUELCH); 
    62                 p_ptr->redraw |= (PR_INVEN | PR_EQUIP); 
     237                cmd_insert(CMD_INSCRIBE, item, tmp); 
    63238        } 
    64239} 
     
    85260/*** Taking off/putting on ***/ 
    86261 
    87 /* Can only take off non-cursed items */ 
    88 static bool obj_can_takeoff(const object_type *o_ptr) 
    89 { 
    90         return !cursed_p(o_ptr); 
    91 } 
    92  
    93 /* Can only put on wieldable items */ 
    94 static bool obj_can_wear(const object_type *o_ptr) 
    95 { 
    96         return (wield_slot(o_ptr) >= INVEN_WIELD); 
    97 } 
    98  
    99  
    100262/* Take off an item */ 
    101 static void obj_takeoff(object_type *o_ptr, int item) 
    102 { 
     263void do_cmd_takeoff(cmd_code code, cmd_arg args[]) 
     264{ 
     265        int item = args[0].item; 
     266 
    103267        (void)inven_takeoff(item, 255); 
    104268        p_ptr->energy_use = 50; 
     
    106270 
    107271/* Wield or wear an item */ 
    108 static void obj_wear(object_type *o_ptr, int item) 
     272void do_cmd_wield(cmd_code code, cmd_arg args[]) 
    109273{ 
    110274        int slot; 
     
    114278 
    115279        unsigned n; 
     280         
     281        int item = args[0].item; 
     282         
     283        object_type *o_ptr = object_from_item_idx(item); 
    116284 
    117285        /* Check the slot */ 
     
    149317 
    150318/* Drop an item */ 
    151 static void obj_drop(object_type *o_ptr, int item) 
    152 { 
     319void do_cmd_drop(cmd_code code, cmd_arg args[]) 
     320{ 
     321        int item = args[0].item; 
     322        object_type *o_ptr = object_from_item_idx(item); 
    153323        int amt; 
    154324 
     
    170340/*** Casting and browsing ***/ 
    171341 
    172 static bool obj_can_browse(const object_type *o_ptr) 
    173 { 
    174         if (o_ptr->tval != cp_ptr->spell_book) return FALSE; 
    175         return TRUE; 
    176 } 
    177  
    178  
    179342static bool obj_cast_pre(void) 
    180343{ 
     
    226389static void obj_study(object_type *o_ptr, int item) 
    227390{ 
    228         int spell; 
    229  
    230391        /* Track the object kind */ 
    231392        object_kind_track(o_ptr->k_idx); 
    232393        handle_stuff(); 
    233394 
    234         /* Choose a spell to study */ 
    235         spell = spell_choose_new(o_ptr); 
    236         if (spell < 0) return; 
    237  
    238         /* Learn the spell */ 
    239         spell_learn(spell); 
    240         p_ptr->energy_use = 100; 
     395        /* Mage -- Choose a spell to study */ 
     396        if (cp_ptr->flags & CF_CHOOSE_SPELLS) 
     397        { 
     398                int spell = get_spell(o_ptr, "study", FALSE, FALSE); 
     399                if (spell >= 0) 
     400                        cmd_insert(CMD_STUDY_SPELL, spell); 
     401        } 
     402        /* Priest -- Choose a book to study */ 
     403        else 
     404        { 
     405                cmd_insert(CMD_STUDY_BOOK, item); 
     406        } 
    241407} 
    242408 
    243409/* Cast a spell from a book */ 
     410void do_cmd_cast(cmd_code code, cmd_arg args[]) 
     411{ 
     412        int spell = args[0].choice; 
     413 
     414        /* Cast a spell */ 
     415        if (spell_cast(spell)) 
     416            p_ptr->energy_use = 100; 
     417} 
     418 
    244419static void obj_cast(object_type *o_ptr, int item) 
    245420{ 
     
    261436        } 
    262437 
    263         /* Cast a spell */ 
    264         if (spell_cast(spell)) 
    265             p_ptr->energy_use = 100; 
     438        cmd_insert(CMD_CAST, spell); 
    266439} 
    267440 
     
    299472} 
    300473 
    301 /* Basic tval testers */ 
    302 static bool obj_is_staff(const object_type *o_ptr)  { return o_ptr->tval == TV_STAFF; } 
    303 static bool obj_is_wand(const object_type *o_ptr)   { return o_ptr->tval == TV_WAND; } 
    304 static bool obj_is_potion(const object_type *o_ptr) { return o_ptr->tval == TV_POTION; } 
    305 static bool obj_is_scroll(const object_type *o_ptr) { return o_ptr->tval == TV_SCROLL; } 
    306 static bool obj_is_food(const object_type *o_ptr)   { return o_ptr->tval == TV_FOOD; } 
    307  
    308 /* Determine if an object is zappable */ 
    309 static bool obj_can_zap(const object_type *o_ptr) 
    310 { 
    311         const object_kind *k_ptr = &k_info[o_ptr->k_idx]; 
    312         if (o_ptr->tval != TV_ROD) return FALSE; 
    313  
    314         /* All still charging? */ 
    315         if (o_ptr->number <= (o_ptr->timeout + (k_ptr->time_base - 1)) / k_ptr->time_base) return FALSE; 
    316  
    317         /* Otherwise OK */ 
    318         return TRUE; 
    319 } 
    320  
    321 /* Determine if an object is activatable */ 
    322 static bool obj_can_activate(const object_type *o_ptr) 
    323 { 
    324         u32b f[OBJ_FLAG_N]; 
    325  
    326         /* Not known */ 
    327         if (!object_known_p(o_ptr)) return (FALSE); 
    328  
    329         /* Check the recharge */ 
    330         if (o_ptr->timeout) return (FALSE); 
    331  
    332         /* Extract the flags */ 
    333         object_flags(o_ptr, f); 
    334  
    335         /* Check activation flag */ 
    336         return (f[2] & TR2_ACTIVATE) ? TRUE : FALSE; 
    337 } 
    338  
    339  
    340 /* Use a staff */ 
    341 static void obj_use_staff(object_type *o_ptr, int item) 
    342 { 
    343         do_cmd_use(o_ptr, item, MSG_USE_STAFF, USE_CHARGE); 
    344 } 
    345  
    346 /* Aim a wand */ 
    347 static void obj_use_wand(object_type *o_ptr, int item) 
    348 { 
    349         do_cmd_use(o_ptr, item, MSG_ZAP_ROD, USE_CHARGE); 
    350 } 
    351  
    352 /* Zap a rod */ 
    353 static void obj_use_rod(object_type *o_ptr, int item) 
    354 { 
    355         do_cmd_use(o_ptr, item, MSG_ZAP_ROD, USE_TIMEOUT); 
    356 } 
    357  
    358 /* Activate a wielded object */ 
    359 static void obj_activate(object_type *o_ptr, int item) 
    360 { 
    361         do_cmd_use(o_ptr, item, MSG_ACT_ARTIFACT, USE_TIMEOUT); 
    362 } 
    363  
    364 /* Eat some food */ 
    365 static void obj_use_food(object_type *o_ptr, int item) 
    366 { 
    367         do_cmd_use(o_ptr, item, MSG_EAT, USE_SINGLE); 
    368 } 
    369  
    370 /* Quaff a potion (from the pack or the floor) */ 
    371 static void obj_use_potion(object_type *o_ptr, int item) 
    372 { 
    373         do_cmd_use(o_ptr, item, MSG_QUAFF, USE_SINGLE); 
    374 } 
    375  
    376 /* Read a scroll (from the pack or floor) */ 
    377 static void obj_use_scroll(object_type *o_ptr, int item) 
    378 { 
    379         do_cmd_use(o_ptr, item, MSG_GENERIC, USE_SINGLE); 
     474 
     475/* 
     476 * Use an object the right way. 
     477 * 
     478 * There may be a BIG problem with any "effect" that can cause "changes" 
     479 * to the inventory.  For example, a "scroll of recharging" can cause 
     480 * a wand/staff to "disappear", moving the inventory up.  Luckily, the 
     481 * scrolls all appear BEFORE the staffs/wands, so this is not a problem. 
     482 * But, for example, a "staff of recharging" could cause MAJOR problems. 
     483 * In such a case, it will be best to either (1) "postpone" the effect 
     484 * until the end of the function, or (2) "change" the effect, say, into 
     485 * giving a staff "negative" charges, or "turning a staff into a stick". 
     486 * It seems as though a "rod of recharging" might in fact cause problems. 
     487 * The basic problem is that the act of recharging (and destroying) an 
     488 * item causes the inducer of that action to "move", causing "o_ptr" to 
     489 * no longer point at the correct item, with horrifying results. 
     490 */ 
     491void do_cmd_use(cmd_code code, cmd_arg args[]) 
     492{ 
     493        int item = args[0].item; 
     494        object_type *o_ptr = object_from_item_idx(item); 
     495        int effect; 
     496        bool ident = FALSE, used; 
     497        bool was_aware = object_aware_p(o_ptr); 
     498        int dir = 5; 
     499        int px = p_ptr->px, py = p_ptr->py; 
     500        int snd; 
     501        use_type use; 
     502 
     503        /* Determine how this item is used. */ 
     504        if (obj_is_rod(o_ptr)) 
     505        { 
     506                use = USE_TIMEOUT; 
     507                snd = MSG_ZAP_ROD; 
     508        } 
     509        else if (obj_is_wand(o_ptr)) 
     510        { 
     511                use = USE_CHARGE; 
     512                snd = MSG_ZAP_ROD; 
     513        } 
     514        else if (obj_is_staff(o_ptr)) 
     515        {        
     516                use = USE_CHARGE; 
     517                snd = MSG_ZAP_ROD; 
     518        } 
     519        else if (obj_is_food(o_ptr)) 
     520        { 
     521                use = USE_SINGLE; 
     522                snd = MSG_EAT;           
     523        } 
     524        else if (obj_is_potion(o_ptr)) 
     525        { 
     526                use = USE_SINGLE; 
     527                snd = MSG_QUAFF;                 
     528        } 
     529        else if (obj_is_scroll(o_ptr)) 
     530        { 
     531                use = USE_SINGLE; 
     532                snd = MSG_GENERIC;               
     533        } 
     534        else if (obj_can_activate(o_ptr)) 
     535        { 
     536                use = USE_TIMEOUT; 
     537                snd = MSG_ACT_ARTIFACT;          
     538        } 
     539 
     540        /* Figure out effect to use */ 
     541        if (o_ptr->name1) 
     542                effect = a_info[o_ptr->name1].effect; 
     543        else 
     544                effect = k_info[o_ptr->k_idx].effect; 
     545 
     546        /* If the item requires a direction, get one (allow cancelling) */       
     547        if (obj_needs_aim(o_ptr)) 
     548        { 
     549                /* Get a direction, allow cancel */ 
     550                if (!get_aim_dir(&dir)) 
     551                        return; 
     552        } 
     553 
     554        /* Use energy regardless of failure */ 
     555        p_ptr->energy_use = 100; 
     556 
     557        /* Check for use */ 
     558        if (use == USE_CHARGE || use == USE_TIMEOUT) 
     559        { 
     560                if (!check_devices(o_ptr)) 
     561                        return; 
     562        } 
     563 
     564        /* Special message for artifacts */ 
     565        if (artifact_p(o_ptr)) 
     566        { 
     567                message(snd, 0, "You activate it."); 
     568                activation_message(o_ptr, a_text + a_info[o_ptr->name1].effect_msg); 
     569        } 
     570        else 
     571        { 
     572                /* Make a noise! */ 
     573                sound(snd); 
     574        } 
     575 
     576        /* A bit of a hack to make ID work better. 
     577           -- Check for "obvious" effects beforehand. */ 
     578        if (effect_obvious(effect)) object_aware(o_ptr); 
     579 
     580        /* Do effect */ 
     581        used = effect_do(effect, &ident, was_aware, dir, beam_chance(o_ptr->tval)); 
     582 
     583        /* Food feeds the player */ 
     584        if (o_ptr->tval == TV_FOOD || o_ptr->tval == TV_POTION) 
     585                (void)set_food(p_ptr->food + o_ptr->pval); 
     586 
     587        if (!used && !ident) return; 
     588 
     589        /* Mark as tried and redisplay */ 
     590        p_ptr->notice |= (PN_COMBINE | PN_REORDER); 
     591        p_ptr->redraw |= (PR_INVEN | PR_EQUIP); 
     592 
     593 
     594        /* 
     595         * If the player becomes aware of the item's function, then mark it as 
     596         * aware and reward the player with some experience.  Otherwise, mark 
     597         * it as "tried". 
     598         */ 
     599        if (ident && !was_aware) 
     600        { 
     601                /* Object level */ 
     602                int lev = k_info[o_ptr->k_idx].level; 
     603 
     604                object_aware(o_ptr); 
     605                if (o_ptr->tval == TV_ROD) object_known(o_ptr); 
     606                gain_exp((lev + (p_ptr->lev / 2)) / p_ptr->lev); 
     607                p_ptr->notice |= PN_SQUELCH; 
     608        } 
     609        else 
     610        { 
     611                object_tried(o_ptr); 
     612        } 
     613 
     614        /* Chargeables act differently to single-used items when not used up */ 
     615        if (used && use == USE_CHARGE) 
     616        { 
     617                /* Use a single charge */ 
     618                o_ptr->pval--; 
     619 
     620                /* Describe charges */ 
     621                if (item >= 0) 
     622                        inven_item_charges(item); 
     623                else 
     624                        floor_item_charges(0 - item); 
     625        } 
     626        else if (used && use == USE_TIMEOUT) 
     627        { 
     628                /* Artifacts use their own special field */ 
     629                if (o_ptr->name1) 
     630                { 
     631                        const artifact_type *a_ptr = &a_info[o_ptr->name1]; 
     632                        o_ptr->timeout = a_ptr->time_base + damroll(a_ptr->time_dice, a_ptr->time_sides); 
     633                } 
     634                else 
     635                { 
     636                        const object_kind *k_ptr = &k_info[o_ptr->k_idx]; 
     637                        o_ptr->timeout += k_ptr->time_base + damroll(k_ptr->time_dice, k_ptr->time_sides); 
     638                } 
     639        } 
     640        else if (used && use == USE_SINGLE) 
     641        { 
     642                /* Destroy a potion in the pack */ 
     643                if (item >= 0) 
     644                { 
     645                        inven_item_increase(item, -1); 
     646                        inven_item_describe(item); 
     647                        inven_item_optimize(item); 
     648                } 
     649 
     650                /* Destroy a potion on the floor */ 
     651                else 
     652                { 
     653                        floor_item_increase(0 - item, -1); 
     654                        floor_item_describe(0 - item); 
     655                        floor_item_optimize(0 - item); 
     656                } 
     657        } 
     658         
     659        /* Hack to make Glyph of Warding work properly */ 
     660        if (cave_feat[py][px] == FEAT_GLYPH) 
     661        { 
     662                /* Shift any objects to further away */ 
     663                for (o_ptr = get_first_object(py, px); o_ptr; o_ptr = get_next_object(o_ptr)) 
     664                { 
     665                        drop_near(o_ptr, 0, py, px); 
     666                } 
     667                 
     668                /* Delete the "moved" objects from their original position */ 
     669                delete_object(py, px); 
     670        } 
     671 
     672         
    380673} 
    381674 
     
    405698} 
    406699 
    407 static bool obj_can_refill(const object_type *o_ptr) 
    408 { 
    409         u32b f[OBJ_FLAG_N]; 
    410         const object_type *j_ptr = &inventory[INVEN_LITE]; 
    411  
    412         /* Get flags */ 
    413         object_flags(o_ptr, f); 
    414  
    415         if (j_ptr->sval == SV_LITE_LANTERN) 
    416         { 
    417                 /* Flasks of oil are okay */ 
    418                 if (o_ptr->tval == TV_FLASK) return (TRUE); 
    419         } 
    420  
    421         /* Non-empty, non-everburning sources are okay */ 
    422         if ((o_ptr->tval == TV_LITE) && 
    423             (o_ptr->sval == j_ptr->sval) && 
    424             (o_ptr->timeout > 0) && 
    425                 !(f[2] & TR2_NO_FUEL)) 
    426         { 
    427                 return (TRUE); 
    428         } 
    429  
    430         /* Assume not okay */ 
    431         return (FALSE); 
    432 } 
    433  
    434 static void obj_refill(object_type *o_ptr, int item) 
     700void do_cmd_refill(cmd_code code, cmd_arg args[]) 
    435701{ 
    436702        object_type *j_ptr = &inventory[INVEN_LITE]; 
     703        int item = args[0].item; 
     704        object_type *o_ptr = object_from_item_idx(item); 
    437705        p_ptr->energy_use = 50; 
    438706 
     
    448716 
    449717 
    450  
    451718/*** Handling bits ***/ 
    452719 
     
    455722{ 
    456723        void (*action)(object_type *, int); 
     724        cmd_code command; 
    457725        const char *desc; 
    458726 
     
    472740         * dangerous command to not be prompted, later. 
    473741         */ 
    474         { obj_uninscribe, "uninscribe", 
     742        { NULL, CMD_UNINSCRIBE, "uninscribe", 
    475743          "Un-inscribe which item? ", "You have nothing to un-inscribe.", 
    476744          obj_has_inscrip, (USE_EQUIP | USE_INVEN | USE_FLOOR), NULL }, 
    477745 
    478         { obj_inscribe, "inscribe", 
     746        { obj_inscribe, CMD_NULL, "inscribe", 
    479747          "Inscribe which item? ", "You have nothing to inscribe.", 
    480748          NULL, (USE_EQUIP | USE_INVEN | USE_FLOOR | IS_HARMLESS), NULL }, 
    481749 
    482         { obj_examine, "examine", 
     750        { obj_examine, CMD_NULL, "examine", 
    483751          "Examine which item? ", "You have nothing to examine.", 
    484752          NULL, (USE_EQUIP | USE_INVEN | USE_FLOOR | IS_HARMLESS), NULL }, 
    485753 
    486754        /*** Takeoff/drop/wear ***/ 
    487         { obj_takeoff, "takeoff", 
     755        { NULL, CMD_TAKEOFF, "takeoff", 
    488756          "Take off which item? ", "You are not wearing anything you can take off.", 
    489757          obj_can_takeoff, USE_EQUIP, NULL }, 
    490758 
    491         { obj_wear, "wield", 
     759        { NULL, CMD_WIELD, "wield", 
    492760          "Wear/Wield which item? ", "You have nothing you can wear or wield.", 
    493761          obj_can_wear, (USE_INVEN | USE_FLOOR), NULL }, 
    494762 
    495         { obj_drop, "drop", 
     763        { NULL, CMD_DROP, "drop", 
    496764          "Drop which item? ", "You have nothing to drop.", 
    497765          NULL, (USE_EQUIP | USE_INVEN), NULL }, 
    498766 
    499767        /*** Spellbooks ***/ 
    500         { obj_browse, "browse", 
     768        { obj_browse, CMD_NULL, "browse", 
    501769          "Browse which book? ", "You have no books that you can read.", 
    502770          obj_can_browse, (USE_INVEN | USE_FLOOR | IS_HARMLESS), NULL }, 
    503771 
    504         { obj_study, "study", 
     772        { obj_study, CMD_NULL, "study", 
    505773          "Study which book? ", "You have no books that you can read.", 
    506774          obj_can_browse, (USE_INVEN | USE_FLOOR), obj_study_pre }, 
    507775 
    508         { obj_cast, "cast", 
     776        { obj_cast, CMD_NULL, "cast", 
    509777          "Use which book? ", "You have no books that you can read.", 
    510778          obj_can_browse, (USE_INVEN | USE_FLOOR), obj_cast_pre }, 
    511779 
    512780        /*** Item usage ***/ 
    513         { obj_use_staff, "use", 
     781        { NULL, CMD_USE_STAFF, "use", 
    514782          "Use which staff? ", "You have no staff to use.", 
    515783          obj_is_staff, (USE_INVEN | USE_FLOOR), NULL }, 
    516784 
    517         { obj_use_wand, "aim", 
     785        { NULL, CMD_USE_WAND, "aim", 
    518786      "Aim which wand? ", "You have no wand to aim.", 
    519787          obj_is_wand, (USE_INVEN | USE_FLOOR), NULL }, 
    520788 
    521         { obj_use_rod, "zap", 
     789        { NULL, CMD_USE_ROD, "zap", 
    522790      "Zap which rod? ", "You have no charged rods to zap.", 
    523791          obj_can_zap, (USE_INVEN | USE_FLOOR), NULL }, 
    524792 
    525         { obj_activate, "activate", 
     793        { NULL, CMD_ACTIVATE, "activate", 
    526794      "Activate which item? ", "You have nothing to activate.", 
    527795          obj_can_activate, USE_EQUIP, NULL }, 
    528796 
    529         { obj_use_food, "eat", 
     797        { NULL, CMD_EAT, "eat", 
    530798      "Eat which item? ", "You have nothing to eat.", 
    531799          obj_is_food, (USE_INVEN | USE_FLOOR), NULL }, 
    532800 
    533         { obj_use_potion, "quaff", 
     801        { NULL, CMD_QUAFF, "quaff", 
    534802      "Quaff which potion? ", "You have no potions to quaff.", 
    535803          obj_is_potion, (USE_INVEN | USE_FLOOR), NULL }, 
    536804 
    537         { obj_use_scroll, "read", 
     805        { NULL, CMD_READ_SCROLL, "read", 
    538806      "Read which scroll? ", "You have no scrolls to read.", 
    539807          obj_is_scroll, (USE_INVEN | USE_FLOOR), obj_read_pre }, 
    540808 
    541         { obj_refill, "refill", 
     809        { NULL, CMD_REFILL, "refill", 
    542810      "Refuel with what fuel source? ", "You have nothing to refuel with.", 
    543811          obj_can_refill, (USE_INVEN | USE_FLOOR), obj_refill_pre }, 
     
    594862 
    595863        /* Get the item */ 
    596         if (item >= 0) 
    597                 o_ptr = &inventory[item]; 
     864        o_ptr = object_from_item_idx(item); 
     865 
     866        if (item_actions[act].action != NULL) 
     867                item_actions[act].action(o_ptr, item); 
    598868        else 
    599                 o_ptr = &o_list[0 - item]; 
    600  
    601         item_actions[act].action(o_ptr, item); 
     869                cmd_insert(item_actions[act].command, item);             
    602870} 
    603871 
    604872/* Wrappers */ 
    605 void do_cmd_uninscribe(void) { do_item(ACTION_UNINSCRIBE); } 
    606 void do_cmd_inscribe(void) { do_item(ACTION_INSCRIBE); } 
     873void textui_cmd_uninscribe(void) { do_item(ACTION_UNINSCRIBE); } 
     874void textui_cmd_inscribe(void) { do_item(ACTION_INSCRIBE); } 
    607875void do_cmd_observe(void) { do_item(ACTION_EXAMINE); } 
    608 void do_cmd_takeoff(void) { do_item(ACTION_TAKEOFF); } 
    609 void do_cmd_wield(void) { do_item(ACTION_WIELD); } 
    610 void do_cmd_drop(void) { do_item(ACTION_DROP); } 
     876void textui_cmd_takeoff(void) { do_item(ACTION_TAKEOFF); } 
     877void textui_cmd_wield(void) { do_item(ACTION_WIELD); } 
     878void textui_cmd_drop(void) { do_item(ACTION_DROP); } 
    611879void do_cmd_browse(void) { do_item(ACTION_BROWSE); } 
    612 void do_cmd_study(void) { do_item(ACTION_STUDY); } 
    613 void do_cmd_cast(void) { do_item(ACTION_CAST); } 
    614 void do_cmd_pray(void) { do_item(ACTION_CAST); } 
    615 void do_cmd_use_staff(void) { do_item(ACTION_USE_STAFF); } 
    616 void do_cmd_aim_wand(void) { do_item(ACTION_AIM_WAND); } 
    617 void do_cmd_zap_rod(void) { do_item(ACTION_ZAP_ROD); } 
    618 void do_cmd_activate(void) { do_item(ACTION_ACTIVATE); } 
    619 void do_cmd_eat_food(void) { do_item(ACTION_EAT_FOOD); } 
    620 void do_cmd_quaff_potion(void) { do_item(ACTION_QUAFF_POTION); } 
    621 void do_cmd_read_scroll(void) { do_item(ACTION_READ_SCROLL); } 
    622 void do_cmd_refill(void) { do_item(ACTION_REFILL); } 
     880void textui_cmd_study(void) { do_item(ACTION_STUDY); } 
     881void textui_cmd_cast(void) { do_item(ACTION_CAST); } 
     882void textui_cmd_pray(void) { do_item(ACTION_CAST); } 
     883void textui_cmd_use_staff(void) { do_item(ACTION_USE_STAFF); } 
     884void textui_cmd_aim_wand(void) { do_item(ACTION_AIM_WAND); } 
     885void textui_cmd_zap_rod(void) { do_item(ACTION_ZAP_ROD); } 
     886void textui_cmd_activate(void) { do_item(ACTION_ACTIVATE); } 
     887void textui_cmd_eat_food(void) { do_item(ACTION_EAT_FOOD); } 
     888void textui_cmd_quaff_potion(void) { do_item(ACTION_QUAFF_POTION); } 
     889void textui_cmd_read_scroll(void) { do_item(ACTION_READ_SCROLL); } 
     890void textui_cmd_refill(void) { do_item(ACTION_REFILL); } 
  • trunk/src/cmd0.c

    r1249 r1417  
    2020#include "cmds.h" 
    2121#include "ui-menu.h" 
    22  
     22#include "game-cmd.h" 
    2323 
    2424/* 
     
    4040/* Forward declare these, because they're really defined later */ 
    4141static do_cmd_type do_cmd_wizard, do_cmd_try_debug, 
    42             do_cmd_quit, do_cmd_mouseclick, do_cmd_port, 
     42            do_cmd_mouseclick, do_cmd_port, 
    4343                        do_cmd_xxx_options, do_cmd_menu, do_cmd_monlist, do_cmd_itemlist; 
    4444 
     
    4848 
    4949/* 
    50  * Holds a generic command. 
     50 * Holds a generic command - if cmd is set to other than CMD_NULL  
     51 * it simply pushes that command to the game, otherwise the hook  
     52 * function will be called. 
    5153 */ 
    5254typedef struct 
     
    5456        const char *desc; 
    5557        unsigned char key; 
     58        cmd_code cmd; 
    5659        do_cmd_type *hook; 
    5760} command_type; 
    5861 
    59  
    6062/* Magic use */ 
    6163static command_type cmd_magic[] = 
    6264{ 
    63         { "Gain new spells or prayers", 'G', do_cmd_study }, 
    64         { "Browse a book",              'b', do_cmd_browse }, 
    65         { "Cast a spell",               'm', do_cmd_cast }, 
    66         { "Pray a prayer",              'p', do_cmd_pray } 
     65        { "Gain new spells or prayers", 'G', CMD_NULL, textui_cmd_study }, 
     66        { "Browse a book",              'b', CMD_NULL, do_cmd_browse }, 
     67        { "Cast a spell",               'm', CMD_NULL, textui_cmd_cast }, 
     68        { "Pray a prayer",              'p', CMD_NULL, textui_cmd_pray } 
    6769}; 
    6870 
     
    7072static command_type cmd_action[] = 
    7173{ 
    72         { "Search for traps/doors",     's', do_cmd_search }, 
    73         { "Disarm a trap or chest",     'D', do_cmd_disarm }, 
    74         { "Rest for a while",           'R', do_cmd_rest }, 
    75         { "Look around",                'l', do_cmd_look }, 
    76         { "Target monster or location", '*', do_cmd_target }, 
    77         { "Dig a tunnel",               'T', do_cmd_tunnel }, 
    78         { "Go up staircase",            '<', do_cmd_go_up }, 
    79         { "Go down staircase",          '>', do_cmd_go_down }, 
    80         { "Toggle search mode",         'S', do_cmd_toggle_search }, 
    81         { "Open a door or a chest",     'o', do_cmd_open }, 
    82         { "Close a door",               'c', do_cmd_close }, 
    83         { "Jam a door shut",            'j', do_cmd_spike }, 
    84         { "Bash a door open",           'B', do_cmd_bash } 
     74        { "Search for traps/doors",     's', CMD_SEARCH, NULL }, 
     75        { "Disarm a trap or chest",     'D', CMD_NULL, textui_cmd_disarm }, 
     76        { "Rest for a while",           'R', CMD_NULL, textui_cmd_rest }, 
     77        { "Look around",                'l', CMD_NULL, do_cmd_look }, 
     78        { "Target monster or location", '*', CMD_NULL, do_cmd_target }, 
     79        { "Dig a tunnel",               'T', CMD_NULL, textui_cmd_tunnel }, 
     80        { "Go up staircase",            '<', CMD_GO_UP, NULL }, 
     81        { "Go down staircase",          '>', CMD_GO_DOWN, NULL }, 
     82        { "Toggle search mode",         'S', CMD_TOGGLE_SEARCH, NULL }, 
     83        { "Open a door or a chest",     'o', CMD_NULL, textui_cmd_open }, 
     84        { "Close a door",               'c', CMD_NULL, textui_cmd_close }, 
     85        { "Jam a door shut",            'j', CMD_NULL, textui_cmd_spike }, 
     86        { "Bash a door open",           'B', CMD_NULL, textui_cmd_bash } 
    8587}; 
    8688 
     
    8890static command_type cmd_item_use[] = 
    8991{ 
    90         { "Read a scroll",            'r', do_cmd_read_scroll }, 
    91         { "Quaff a potion",           'q', do_cmd_quaff_potion }, 
    92         { "Use a staff",              'u', do_cmd_use_staff }, 
    93         { "Aim a wand",               'a', do_cmd_aim_wand }, 
    94         { "Zap a rod",                'z', do_cmd_zap_rod }, 
    95         { "Activate an object",       'A', do_cmd_activate }, 
    96         { "Eat some food",            'E', do_cmd_eat_food }, 
    97         { "Fuel your light source",   'F', do_cmd_refill }, 
    98         { "Fire your missile weapon", 'f', do_cmd_fire }, 
    99         { "Throw an item",            'v', do_cmd_throw } 
     92        { "Read a scroll",            'r', CMD_NULL, textui_cmd_read_scroll }, 
     93        { "Quaff a potion",           'q', CMD_NULL, textui_cmd_quaff_potion }, 
     94        { "Use a staff",              'u', CMD_NULL, textui_cmd_use_staff }, 
     95        { "Aim a wand",               'a', CMD_NULL, textui_cmd_aim_wand }, 
     96        { "Zap a rod",                'z', CMD_NULL, textui_cmd_zap_rod }, 
     97        { "Activate an object",       'A', CMD_NULL, textui_cmd_activate }, 
     98        { "Eat some food",            'E', CMD_NULL, textui_cmd_eat_food }, 
     99        { "Fuel your light source",   'F', CMD_NULL, textui_cmd_refill }, 
     100        { "Fire your missile weapon", 'f', CMD_NULL, textui_cmd_fire }, 
     101        { "Throw an item",            'v', CMD_NULL, textui_cmd_throw } 
    100102}; 
    101103 
    102104/* Item management commands */ 
    103 static command_type cmd_item_manage[]  = 
    104 { 
    105         { "Display equipment listing", 'e', do_cmd_equip }, 
    106         { "Display inventory listing", 'i', do_cmd_inven }, 
    107         { "Pick up objects",           'g', do_cmd_pickup }, 
    108         { "Wear/wield an item",        'w', do_cmd_wield }, 
    109         { "Take/unwield off an item",  't', do_cmd_takeoff }, 
    110         { "Drop an item",              'd', do_cmd_drop }, 
    111         { "Destroy an item",           'k', do_cmd_destroy }, 
    112         { "Examine an item",           'I', do_cmd_observe }, 
    113         { "Inscribe an object",        '{', do_cmd_inscribe }, 
    114         { "Uninscribe an object",      '}', do_cmd_uninscribe } 
     105static command_type cmd_item_manage[] = 
     106{ 
     107        { "Display equipment listing", 'e', CMD_NULL, do_cmd_equip }, 
     108        { "Display inventory listing", 'i', CMD_NULL, do_cmd_inven }, 
     109        { "Pick up objects",           'g', CMD_PICKUP, NULL }, 
     110        { "Wear/wield an item",        'w', CMD_NULL, textui_cmd_wield }, 
     111        { "Take/unwield off an item",  't', CMD_NULL, textui_cmd_takeoff }, 
     112        { "Drop an item",              'd', CMD_NULL, textui_cmd_drop }, 
     113        { "Destroy an item",           'k', CMD_NULL, textui_cmd_destroy }, 
     114        { "Examine an item",           'I', CMD_NULL, do_cmd_observe }, 
     115        { "Inscribe an object",        '{', CMD_NULL, textui_cmd_inscribe }, 
     116        { "Uninscribe an object",      '}', CMD_NULL, textui_cmd_uninscribe } 
    115117}; 
    116118 
     
    118120static command_type cmd_info[] = 
    119121{ 
    120         { "Full dungeon map",             'M', do_cmd_view_map }, 
    121         { "Display visible item list",    ']', do_cmd_itemlist }, 
    122         { "Display visible monster list", '[', do_cmd_monlist }, 
    123         { "Locate player on map",         'L', do_cmd_locate }, 
    124         { "Help",                         '?', do_cmd_help }, 
    125         { "Identify symbol",              '/', do_cmd_query_symbol }, 
    126         { "Character description",        'C', do_cmd_change_name }, 
    127         { "Check knowledge",              '~', do_cmd_knowledge }, 
    128         { "Repeat level feeling",   KTRL('F'), do_cmd_feeling }, 
    129         { "Show previous message",  KTRL('O'), do_cmd_message_one }, 
    130         { "Show previous messages", KTRL('P'), do_cmd_messages } 
     122        { "Full dungeon map",             'M', CMD_NULL, do_cmd_view_map }, 
     123        { "Display visible item list",    ']', CMD_NULL, do_cmd_itemlist }, 
     124        { "Display visible monster list", '[', CMD_NULL, do_cmd_monlist }, 
     125        { "Locate player on map",         'L', CMD_NULL, do_cmd_locate }, 
     126        { "Help",                         '?', CMD_NULL, do_cmd_help }, 
     127        { "Identify symbol",              '/', CMD_NULL, do_cmd_query_symbol }, 
     128        { "Character description",        'C', CMD_NULL, do_cmd_change_name }, 
     129        { "Check knowledge",              '~', CMD_NULL, do_cmd_knowledge }, 
     130        { "Repeat level feeling",   KTRL('F'), CMD_NULL, do_cmd_feeling }, 
     131        { "Show previous message",  KTRL('O'), CMD_NULL, do_cmd_message_one }, 
     132        { "Show previous messages", KTRL('P'), CMD_NULL, do_cmd_messages } 
    131133}; 
    132134 
     
    134136static command_type cmd_util[] = 
    135137{ 
    136         { "Interact with options",        '=', do_cmd_xxx_options }, 
    137         { "Port-specific preferences",    '!', do_cmd_port }, 
    138  
    139         { "Save and don't quit",  KTRL('S'), do_cmd_save_game }, 
    140         { "Save and quit",        KTRL('X'), do_cmd_quit }, 
    141         { "Quit (commit suicide)",      'Q', do_cmd_suicide }, 
    142         { "Redraw the screen",    KTRL('R'), do_cmd_redraw }, 
    143  
    144         { "Load \"screen dump\"",       '(', do_cmd_load_screen }, 
    145         { "Save \"screen dump\"",       ')', do_cmd_save_screen } 
     138        { "Interact with options",        '=', CMD_NULL, do_cmd_xxx_options }, 
     139        { "Port-specific preferences",    '!', CMD_NULL, do_cmd_port }, 
     140 
     141        { "Save and don't quit",  KTRL('S'), CMD_SAVE, NULL }, 
     142        { "Save and quit",        KTRL('X'), CMD_QUIT, NULL }, 
     143        { "Quit (commit suicide)",      'Q', CMD_NULL, textui_cmd_suicide }, 
     144        { "Redraw the screen",    KTRL('R'), CMD_NULL, do_cmd_redraw }, 
     145 
     146        { "Load \"screen dump\"",       '(', CMD_NULL, do_cmd_load_screen }, 
     147        { "Save \"screen dump\"",       ')', CMD_NULL, do_cmd_save_screen } 
    146148}; 
    147149 
     
    149151static command_type cmd_hidden[] = 
    150152{ 
    151         { "Take notes",               ':', do_cmd_note }, 
    152         { "Version info",             'V', do_cmd_version }, 
    153         { "Load a single pref line",  '"', do_cmd_pref }, 
    154         { "Mouse click",           '\xff', do_cmd_mouseclick }, 
    155         { "Enter a store",            '_', do_cmd_store }, 
    156         { "Toggle windows",     KTRL('E'), toggle_inven_equip }, /* XXX */ 
    157         { "Alter a grid",             '+', do_cmd_alter }, 
    158         { "Walk",                     ';', do_cmd_walk }, 
    159         { "Jump into a trap",         '-', do_cmd_jump }, 
    160         { "Start running",            '.', do_cmd_run }, 
    161         { "Stand still",              ',', do_cmd_hold }, 
    162         { "Check knowledge",          '|', do_cmd_knowledge }, 
    163         { "Display menu of actions", '\n', do_cmd_menu }, 
    164         { "Display menu of actions", '\r', do_cmd_menu }, 
    165  
    166         { "Toggle wizard mode",  KTRL('W'), do_cmd_wizard }, 
     153        { "Take notes",               ':', CMD_NULL, do_cmd_note }, 
     154        { "Version info",             'V', CMD_NULL, do_cmd_version }, 
     155        { "Load a single pref line",  '"', CMD_NULL, do_cmd_pref }, 
     156        { "Mouse click",           '\xff', CMD_NULL, do_cmd_mouseclick }, 
     157        { "Enter a store",            '_', CMD_ENTER_STORE, NULL }, 
     158        { "Toggle windows",     KTRL('E'), CMD_NULL, toggle_inven_equip }, /* XXX */ 
     159        { "Alter a grid",             '+', CMD_NULL, textui_cmd_alter }, 
     160        { "Walk",                     ';', CMD_NULL, textui_cmd_walk }, 
     161        { "Jump into a trap",         '-', CMD_NULL, textui_cmd_jump }, 
     162        { "Start running",            '.', CMD_NULL, textui_cmd_run }, 
     163        { "Stand still",              ',', CMD_HOLD, NULL }, 
     164        { "Check knowledge",          '|', CMD_NULL, do_cmd_knowledge }, 
     165        { "Display menu of actions", '\n', CMD_NULL, do_cmd_menu }, 
     166        { "Display menu of actions", '\r', CMD_NULL, do_cmd_menu }, 
     167 
     168        { "Toggle wizard mode",  KTRL('W'), CMD_NULL, do_cmd_wizard }, 
    167169 
    168170#ifdef ALLOW_DEBUG 
    169         { "Debug mode commands", KTRL('A'), do_cmd_try_debug }, 
     171        { "Debug mode commands", KTRL('A'), CMD_NULL, do_cmd_try_debug }, 
    170172#endif 
    171173#ifdef ALLOW_BORG 
    172         { "Borg commands",       KTRL('Z'), do_cmd_try_borg } 
     174        { "Borg commands",       KTRL('Z'), CMD_NULL, do_cmd_try_borg } 
    173175#endif 
    174176}; 
     
    308310 * Quit the game. 
    309311 */ 
    310 static void do_cmd_quit(void) 
     312void do_cmd_quit(cmd_code code, cmd_arg args[]) 
    311313{ 
    312314        /* Stop playing */ 
     
    336338        if ((p_ptr->py == y) && (p_ptr->px == x) /* && (p_ptr->command_cmd_ex.mousebutton) */) 
    337339        { 
    338                 do_cmd_rest(); 
     340                textui_cmd_rest(); 
    339341        } 
    340342        else /* if (p_ptr->command_cmd_ex.mousebutton == 1) */ 
     
    342344                if (p_ptr->timed[TMD_CONFUSED]) 
    343345                { 
    344                         do_cmd_walk(); 
     346                        cmd_insert(CMD_WALK, DIR_UNKNOWN); 
    345347                } 
    346348                else 
    347349                { 
    348                         do_cmd_pathfind(y, x); 
     350                        cmd_insert(CMD_PATHFIND, y, x); 
    349351                } 
    350352        } 
     
    426428 
    427429/* List indexed by char */ 
    428 do_cmd_type *converted_list[UCHAR_MAX+1]; 
     430struct { 
     431        do_cmd_type *hook; 
     432        cmd_code cmd; 
     433} converted_list[UCHAR_MAX+1]; 
    429434 
    430435 
     
    552557        ui_event_data evt; 
    553558        int cursor = 0; 
    554         command_type chosen_command = { NULL, 0, NULL }; 
     559        command_type chosen_command = { NULL }; 
    555560 
    556561        /* Set up the menu */ 
     
    572577 
    573578        /* If a command was chosen, do it. */ 
    574         if (chosen_command.hook) 
     579        if (chosen_command.cmd != CMD_NULL) 
     580        { 
     581                cmd_insert(chosen_command.cmd); 
     582        } 
     583        else if (chosen_command.hook) 
    575584        { 
    576585                chosen_command.hook(); 
     
    600609                        /* Note: at present converted_list is UCHAR_MAX + 1  
    601610                           large, so 'key' is always a valid index. */ 
    602                         converted_list[key] = commands[i].hook; 
     611                        converted_list[key].hook = commands[i].hook; 
     612                        converted_list[key].cmd = commands[i].cmd; 
    603613                } 
    604614        } 
     
    619629                        default: 
    620630                        { 
    621                                 if (!converted_list[i]) 
    622                                         converted_list[i] = do_cmd_unknown; 
     631                                if (!converted_list[i].hook && !converted_list[i].cmd) 
     632                                { 
     633                                        converted_list[i].hook = do_cmd_unknown; 
     634                                        converted_list[i].cmd = CMD_NULL; 
     635                                } 
    623636                        } 
    624637                }                
     
    631644 * Give "Warning" on illegal commands. 
    632645 */ 
    633 void process_command(bool no_request) 
     646void textui_process_command(bool no_request) 
    634647{ 
    635648        if (!no_request) 
     
    648661                /* Within these boundaries, the cast to unsigned char will have the desired effect */ 
    649662                assert(p_ptr->command_cmd >= CHAR_MIN && p_ptr->command_cmd <= CHAR_MAX); 
    650  
    651663                /* Execute the command */ 
    652                 if (converted_list[(unsigned char) p_ptr->command_cmd]) 
    653                         converted_list[(unsigned char) p_ptr->command_cmd](); 
    654         } 
    655 } 
     664                if (converted_list[(unsigned char) p_ptr->command_cmd].cmd != CMD_NULL) 
     665                        cmd_insert(converted_list[(unsigned char) p_ptr->command_cmd].cmd); 
     666 
     667                else if (converted_list[(unsigned char) p_ptr->command_cmd].hook) 
     668                        converted_list[(unsigned char) p_ptr->command_cmd].hook(); 
     669        } 
     670} 
  • trunk/src/cmd1.c

    r1349 r1417  
    573573                } 
    574574 
    575                 do_cmd_alter(); 
     575                do_cmd_alter_aux(dir); 
    576576        } 
    577577 
     
    673673                        /* Disturb */ 
    674674                        disturb(0, 0); 
    675  
    676                         /* Hack -- Enter store */ 
    677                         p_ptr->command_new = '_'; 
     675                        cmd_insert(CMD_ENTER_STORE); 
    678676                } 
    679677 
  • trunk/src/cmd2.c

    r1380 r1417  
    2020 
    2121#include "cmds.h" 
     22#include "game-cmd.h" 
    2223 
    2324/* 
    2425 * Go up one level 
    2526 */ 
    26 void do_cmd_go_up(void) 
     27void do_cmd_go_up(cmd_code code, cmd_arg args[]) 
    2728{ 
    2829        /* Verify stairs */ 
     
    5859 * Go down one level 
    5960 */ 
    60 void do_cmd_go_down(void) 
     61void do_cmd_go_down(cmd_code code, cmd_arg args[]) 
    6162{ 
    6263        /* Verify stairs */ 
     
    8687 * Simple command to "search" for one turn 
    8788 */ 
    88 void do_cmd_search(void) 
     89void do_cmd_search(cmd_code code, cmd_arg args[]) 
    8990{ 
    9091        /* Allow repeated command */ 
     
    102103 * Hack -- toggle search mode 
    103104 */ 
    104 void do_cmd_toggle_search(void) 
     105void do_cmd_toggle_search(cmd_code code, cmd_arg args[]) 
    105106{ 
    106107        /* Stop searching */ 
     
    730731 * Unlocking a locked door/chest is worth one experience point. 
    731732 */ 
    732 void do_cmd_open(void) 
     733void do_cmd_open(cmd_code code, cmd_arg args[]) 
    733734{ 
    734735        int y, x, dir; 
     
    738739        bool more = FALSE; 
    739740 
    740  
    741         /* Easy Open */ 
    742         if (OPT(easy_open)) 
    743         { 
    744                 int num_doors, num_chests; 
    745  
    746                 /* Count closed doors */ 
    747                 num_doors = count_feats(&y, &x, is_closed, FALSE); 
    748  
    749                 /* Count chests (locked) */ 
    750                 num_chests = count_chests(&y, &x, FALSE); 
    751  
    752                 /* See if only one target */ 
    753                 if ((num_doors + num_chests) == 1) 
    754                 { 
    755                         p_ptr->command_dir = coords_to_dir(y, x); 
    756                 } 
    757         } 
    758  
    759         /* Get a direction (or abort) */ 
    760         if (!get_rep_dir(&dir)) return; 
     741        dir = args[0].direction; 
    761742 
    762743        /* Get location */ 
     
    818799} 
    819800 
     801void textui_cmd_open(void) 
     802{ 
     803        int y, x, dir = DIR_UNKNOWN; 
     804 
     805        /* Easy Open */ 
     806        if (OPT(easy_open)) 
     807        { 
     808                int num_doors, num_chests; 
     809 
     810                /* Count closed doors */ 
     811                num_doors = count_feats(&y, &x, is_closed, FALSE); 
     812 
     813                /* Count chests (locked) */ 
     814                num_chests = count_chests(&y, &x, FALSE); 
     815 
     816                /* See if only one target */ 
     817                if ((num_doors + num_chests) == 1) 
     818                { 
     819                        dir = coords_to_dir(y, x); 
     820                } 
     821        } 
     822 
     823        cmd_insert(CMD_OPEN, dir); 
     824} 
     825 
    820826 
    821827/* 
     
    861867        bool more = FALSE; 
    862868 
    863  
    864869        /* Verify legality */ 
    865870        if (!do_cmd_close_test(y, x)) return (FALSE); 
    866871 
    867  
    868872        /* Broken door */ 
    869873        if (cave_feat[y][x] == FEAT_BROKEN) 
     
    894898 * Close an open door. 
    895899 */ 
    896 void do_cmd_close(void) 
     900void do_cmd_close(cmd_code code, cmd_arg args[]) 
    897901{ 
    898902        int y, x, dir; 
     
    900904        bool more = FALSE; 
    901905 
    902  
    903         /* Easy Close */ 
    904         if (OPT(easy_open)) 
    905         { 
    906                 /* Count open doors */ 
    907                 if (count_feats(&y, &x, is_open, FALSE) == 1) 
    908                 { 
    909                         p_ptr->command_dir = coords_to_dir(y, x); 
    910                 } 
    911         } 
    912  
    913         /* Get a direction (or abort) */ 
    914         if (!get_rep_dir(&dir)) return; 
     906        dir = args[0].direction; 
    915907 
    916908        /* Get location */ 
     
    918910        x = p_ptr->px + ddx[dir]; 
    919911 
    920  
    921912        /* Verify legality */ 
    922913        if (!do_cmd_close_test(y, x)) return; 
    923  
    924914 
    925915        /* Take a turn */ 
     
    959949} 
    960950 
     951void textui_cmd_close(void) 
     952{ 
     953        int y, x, dir = DIR_UNKNOWN; 
     954 
     955        /* Easy Close */ 
     956        if (OPT(easy_open)) 
     957        { 
     958                /* Count open doors */ 
     959                if (count_feats(&y, &x, is_open, FALSE) == 1) 
     960                { 
     961                        dir = coords_to_dir(y, x); 
     962                } 
     963        } 
     964 
     965        cmd_insert(CMD_CLOSE, dir); 
     966} 
    961967 
    962968 
     
    12221228 * accomplished by strong players using heavy weapons. 
    12231229 */ 
    1224 void do_cmd_tunnel(void) 
     1230void do_cmd_tunnel(cmd_code code, cmd_arg args[]) 
    12251231{ 
    12261232        int y, x, dir; 
    1227  
    12281233        bool more = FALSE; 
    12291234 
    1230  
    1231         /* Get a direction (or abort) */ 
    1232         if (!get_rep_dir(&dir)) return; 
     1235        dir = args[0].direction; 
    12331236 
    12341237        /* Get location */ 
     
    12771280} 
    12781281 
     1282void textui_cmd_tunnel(void) 
     1283{ 
     1284        cmd_insert(CMD_TUNNEL, DIR_UNKNOWN); 
     1285} 
     1286 
    12791287 
    12801288/* 
     
    13971405 * Disarms a trap, or a chest 
    13981406 */ 
    1399 void do_cmd_disarm(void) 
     1407void do_cmd_disarm(cmd_code code, cmd_arg args[]) 
    14001408{ 
    14011409        int y, x, dir; 
     
    14051413        bool more = FALSE; 
    14061414 
    1407  
    1408         /* Easy Disarm */ 
    1409         if (OPT(easy_open)) 
    1410         { 
    1411                 int num_traps, num_chests; 
    1412  
    1413                 /* Count visible traps */ 
    1414                 num_traps = count_feats(&y, &x, is_trap, TRUE); 
    1415  
    1416                 /* Count chests (trapped) */ 
    1417                 num_chests = count_chests(&y, &x, TRUE); 
    1418  
    1419                 /* See if only one target */ 
    1420                 if (num_traps || num_chests) 
    1421                 { 
    1422                         if (num_traps + num_chests <= 1) 
    1423                                 p_ptr->command_dir = coords_to_dir(y, x); 
    1424                 } 
    1425         } 
    1426  
    1427         /* Get a direction (or abort) */ 
    1428         if (!get_rep_dir(&dir)) return; 
     1415        dir = args[0].direction; 
    14291416 
    14301417        /* Get location */ 
     
    14861473} 
    14871474 
     1475void textui_cmd_disarm(void) 
     1476{ 
     1477        int y, x, dir; 
     1478 
     1479        dir = DIR_UNKNOWN; 
     1480 
     1481        /* Easy Disarm */ 
     1482        if (OPT(easy_open)) 
     1483        { 
     1484                int num_traps, num_chests; 
     1485 
     1486                /* Count visible traps */ 
     1487                num_traps = count_feats(&y, &x, is_trap, TRUE); 
     1488 
     1489                /* Count chests (trapped) */ 
     1490                num_chests = count_chests(&y, &x, TRUE); 
     1491 
     1492                /* See if only one target */ 
     1493                if (num_traps || num_chests) 
     1494                { 
     1495                        if (num_traps + num_chests <= 1) 
     1496                                dir = coords_to_dir(y, x); 
     1497                } 
     1498        } 
     1499 
     1500        cmd_insert(CMD_DISARM, dir); 
     1501} 
    14881502 
    14891503/* 
     
    16141628 * Creatures can also open or bash doors, see elsewhere. 
    16151629 */ 
    1616 void do_cmd_bash(void) 
     1630void do_cmd_bash(cmd_code code, cmd_arg args[]) 
    16171631{ 
    16181632        int y, x, dir; 
    16191633 
    1620  
    1621         /* Get a direction (or abort) */ 
    1622         if (!get_rep_dir(&dir)) return; 
     1634        dir = args[0].direction; 
    16231635 
    16241636        /* Get location */ 
     
    16681680} 
    16691681 
     1682void textui_cmd_bash(void) 
     1683{ 
     1684        cmd_insert(CMD_BASH, DIR_UNKNOWN); 
     1685} 
     1686 
    16701687 
    16711688 
     
    16811698 * is confused, and it must be verified against the new grid. 
    16821699 */ 
    1683 void do_cmd_alter(void) 
    1684 { 
    1685         int y, x, dir; 
     1700void do_cmd_alter_aux(int dir) 
     1701{ 
     1702        int y, x; 
    16861703 
    16871704        int feat; 
    16881705 
    16891706        bool more = FALSE; 
    1690  
    1691  
    1692         /* Get a direction */ 
    1693         if (!get_rep_dir(&dir)) return; 
    16941707 
    16951708        /* Get location */ 
     
    17771790} 
    17781791 
     1792void do_cmd_alter(cmd_code code, cmd_arg args[]) 
     1793{ 
     1794        do_cmd_alter_aux(args[0].direction); 
     1795} 
     1796 
     1797void textui_cmd_alter(void) 
     1798{ 
     1799        cmd_insert(CMD_ALTER, DIR_UNKNOWN); 
     1800} 
    17791801 
    17801802/* 
     
    18471869 * This command may NOT be repeated 
    18481870 */ 
    1849 void do_cmd_spike(void) 
     1871void do_cmd_spike(cmd_code code, cmd_arg args[]) 
    18501872{ 
    18511873        int y, x, dir, item = 0; 
    18521874 
     1875        dir = args[0].direction; 
    18531876 
    18541877        /* Get a spike */ 
     
    18611884                return; 
    18621885        } 
    1863  
    1864  
    1865         /* Get a direction (or abort) */ 
    1866         if (!get_rep_dir(&dir)) return; 
    18671886 
    18681887        /* Get location */ 
     
    19251944} 
    19261945 
     1946void textui_cmd_spike(void) 
     1947{ 
     1948        cmd_insert(CMD_JAM, DIR_UNKNOWN); 
     1949} 
    19271950 
    19281951 
     
    19962019 
    19972020/* 
    1998  * Helper function for the "walk" command. 
    1999  */ 
    2000 static void walk(void) 
     2021 * Walk in the given direction. 
     2022 */ 
     2023void do_cmd_walk(cmd_code code, cmd_arg args[]) 
    20012024{ 
    20022025        int y, x, dir; 
    20032026 
    2004         /* Get a direction (or abort) */ 
    2005         if (!get_rep_dir(&dir)) return; 
     2027        dir = args[0].direction; 
    20062028 
    20072029        /* Get location */ 
     
    20382060 
    20392061/* 
    2040  * Walk. 
    2041  */ 
    2042 void do_cmd_walk(void) 
    2043 { 
    2044         walk(); 
    2045 } 
     2062 * Tell the game we want to walk - in future we might want to supply 
     2063 * directions here rather than rely on keymap/macro things. 
     2064 */ 
     2065void textui_cmd_walk(void) 
     2066{ 
     2067        cmd_insert(CMD_WALK, DIR_UNKNOWN); 
     2068} 
     2069 
    20462070 
    20472071/* 
     
    20502074 * What a horrible concept. 
    20512075 */ 
    2052 void do_cmd_jump(void) 
     2076void do_cmd_jump(cmd_code code, cmd_arg args[]) 
    20532077{ 
    20542078        bool old_easy_alter; 
     
    20582082        OPT(easy_alter) = FALSE; 
    20592083 
    2060         walk(); 
     2084        do_cmd_walk(code, args); 
    20612085 
    20622086        /* Restore OPT(easy_alter) */ 
     
    20642088} 
    20652089 
     2090void textui_cmd_jump(void) 
     2091{ 
     2092        cmd_insert(CMD_JUMP, DIR_UNKNOWN); 
     2093} 
    20662094 
    20672095 
     
    20712099 * Note that running while confused is not allowed. 
    20722100 */ 
    2073 void do_cmd_run(void) 
     2101void do_cmd_run(cmd_code code, cmd_arg args[]) 
    20742102{ 
    20752103        int y, x, dir; 
    20762104 
     2105        dir = args[0].direction; 
    20772106 
    20782107        /* Hack XXX XXX XXX */ 
     
    20822111                return; 
    20832112        } 
    2084  
    2085  
    2086         /* Get a direction (or abort) */ 
    2087         if (!get_rep_dir(&dir)) return; 
    20882113 
    20892114        /* Get location */ 
     
    21002125} 
    21012126 
     2127void textui_cmd_run(void) 
     2128{ 
     2129        cmd_insert(CMD_RUN, DIR_UNKNOWN); 
     2130} 
     2131 
    21022132/* 
    21032133 * Start running with pathfinder. 
     
    21052135 * Note that running while confused is not allowed. 
    21062136 */ 
    2107 void do_cmd_pathfind(int y, int x) 
     2137void do_cmd_pathfind(cmd_code code, cmd_arg args[]) 
    21082138{ 
    21092139        /* Hack XXX XXX XXX */ 
     
    21142144        } 
    21152145 
    2116         if (findpath(y, x)) 
     2146        if (findpath(args[0].point.y, args[0].point.x)) 
    21172147        { 
    21182148                p_ptr->running = 1000; 
     
    21302160 * Pick up treasure if "pickup" is true. 
    21312161 */ 
    2132 void do_cmd_hold(void) 
     2162void do_cmd_hold(cmd_code code, cmd_arg args[]) 
    21332163{ 
    21342164        /* Allow repeated command */ 
     
    21612191                disturb(0, 0); 
    21622192 
    2163                 /* Hack -- enter store */ 
    2164                 p_ptr->command_new = '_'; 
     2193                cmd_insert(CMD_ENTER_STORE); 
    21652194 
    21662195                /* Free turn XXX XXX XXX */ 
     
    21742203 * Pick up objects on the floor beneath you.  -LM- 
    21752204 */ 
    2176 void do_cmd_pickup(void) 
     2205void do_cmd_pickup(cmd_code code, cmd_arg args[]) 
    21772206{ 
    21782207        int energy_cost; 
     
    21932222 * Rest (restores hit points and mana and such) 
    21942223 */ 
    2195 void do_cmd_rest(void) 
    2196 { 
    2197         /* Prompt for time if needed */ 
     2224void do_cmd_rest(cmd_code code, cmd_arg args[]) 
     2225{ 
     2226        /* Save the rest code */ 
     2227        switch (args[0].choice) 
     2228        { 
     2229                case REST_ALL: 
     2230                { 
     2231                        p_ptr->resting = -2; 
     2232                        break; 
     2233                } 
     2234 
     2235                case REST_ALL_POINTS: 
     2236                { 
     2237                        p_ptr->resting = -1; 
     2238                        break; 
     2239                } 
     2240 
     2241                case REST_SOME_POINTS: 
     2242                { 
     2243                        p_ptr->resting = -3; 
     2244                        break; 
     2245                } 
     2246 
     2247                default: 
     2248                { 
     2249                        p_ptr->resting = p_ptr->command_arg; 
     2250                } 
     2251        } 
     2252 
     2253        /* Take a turn XXX XXX XXX (?) */ 
     2254        p_ptr->energy_use = 100; 
     2255 
     2256        /* Cancel the arg */ 
     2257        p_ptr->command_arg = 0; 
     2258 
     2259        /* Cancel searching */ 
     2260        p_ptr->searching = FALSE; 
     2261 
     2262        /* Recalculate bonuses */ 
     2263        p_ptr->update |= (PU_BONUS); 
     2264 
     2265        /* Redraw the state */ 
     2266        p_ptr->redraw |= (PR_STATE); 
     2267 
     2268        /* Handle stuff */ 
     2269        handle_stuff(); 
     2270 
     2271        /* Refresh XXX XXX XXX */ 
     2272        Term_fresh(); 
     2273} 
     2274 
     2275 
     2276void textui_cmd_rest(void) 
     2277{ 
     2278        /* Prompt for time if needed */ 
    21982279        if (p_ptr->command_arg <= 0) 
    21992280        { 
     
    22082289                if (out_val[0] == '&') 
    22092290                { 
    2210                         p_ptr->command_arg = (-2); 
     2291                        cmd_insert(CMD_REST, REST_ALL); 
    22112292                } 
    22122293 
     
    22142295                else if (out_val[0] == '*') 
    22152296                { 
    2216                         p_ptr->command_arg = (-1); 
     2297                        cmd_insert(CMD_REST, REST_ALL_POINTS); 
    22172298                } 
    22182299 
     
    22202301                else if (out_val[0] == '!') 
    22212302                { 
    2222                         p_ptr->command_arg = (-3); 
     2303                        cmd_insert(CMD_REST, REST_SOME_POINTS); 
    22232304                } 
    22242305                 
     
    22282309                        p_ptr->command_arg = atoi(out_val); 
    22292310                        if (p_ptr->command_arg <= 0) return; 
    2230                 } 
    2231         } 
    2232  
    2233  
    2234         /* Paranoia */ 
    2235         if (p_ptr->command_arg > 9999) p_ptr->command_arg = 9999; 
    2236  
    2237  
    2238         /* Take a turn XXX XXX XXX (?) */ 
    2239         p_ptr->energy_use = 100; 
    2240  
    2241         /* Save the rest code */ 
    2242         p_ptr->resting = p_ptr->command_arg; 
    2243  
    2244         /* Cancel the arg */ 
    2245         p_ptr->command_arg = 0; 
    2246  
    2247         /* Cancel searching */ 
    2248         p_ptr->searching = FALSE; 
    2249  
    2250         /* Recalculate bonuses */ 
    2251         p_ptr->update |= (PU_BONUS); 
    2252  
    2253         /* Redraw the state */ 
    2254         p_ptr->redraw |= (PR_STATE); 
    2255  
    2256         /* Handle stuff */ 
    2257         handle_stuff(); 
    2258  
    2259         /* Refresh XXX XXX XXX */ 
    2260         Term_fresh(); 
    2261 } 
     2311                        if (p_ptr->command_arg > 9999) p_ptr->command_arg = 9999; 
     2312                         
     2313                        cmd_insert(CMD_REST, REST_TURNS); 
     2314                } 
     2315        } 
     2316} 
     2317 
     2318 
     2319/* 
     2320 * Hack -- commit suicide 
     2321 */ 
     2322void do_cmd_suicide(cmd_code code, cmd_arg args[]) 
     2323{ 
     2324        /* Commit suicide */ 
     2325        p_ptr->is_dead = TRUE; 
     2326 
     2327        /* Stop playing */ 
     2328        p_ptr->playing = FALSE; 
     2329 
     2330        /* Leaving */ 
     2331        p_ptr->leaving = TRUE; 
     2332 
     2333        /* Cause of death */ 
     2334        my_strcpy(p_ptr->died_from, "Quitting", sizeof(p_ptr->died_from)); 
     2335} 
     2336 
     2337 
     2338void textui_cmd_suicide(void) 
     2339{ 
     2340        /* Flush input */ 
     2341        flush(); 
     2342 
     2343        /* Verify Retirement */ 
     2344        if (p_ptr->total_winner) 
     2345        { 
     2346                /* Verify */ 
     2347                if (!get_check("Do you want to retire? ")) return; 
     2348        } 
     2349 
     2350        /* Verify Suicide */ 
     2351        else 
     2352        { 
     2353                char ch; 
     2354 
     2355                /* Verify */ 
     2356                if (!get_check("Do you really want to commit suicide? ")) return; 
     2357 
     2358                /* Special Verification for suicide */ 
     2359                prt("Please verify SUICIDE by typing the '@' sign: ", 0, 0); 
     2360                flush(); 
     2361                ch = inkey(); 
     2362                prt("", 0, 0); 
     2363                if (ch != '@') return; 
     2364        } 
     2365 
     2366        cmd_insert(CMD_SUICIDE); 
     2367} 
     2368 
     2369void do_cmd_save_game(cmd_code code, cmd_arg args[]) 
     2370{ 
     2371        save_game(); 
     2372} 
     2373 
  • trunk/src/cmd3.c

    r1411 r1417  
    198198 * Destroy an item 
    199199 */ 
    200 void do_cmd_destroy(void) 
     200void do_cmd_destroy(cmd_code code, cmd_arg args[]) 
     201{ 
     202        int item, amt; 
     203 
     204        object_type *o_ptr; 
     205 
     206        object_type *i_ptr; 
     207        object_type object_type_body; 
     208 
     209        char o_name[120]; 
     210 
     211        item = args[0].item; 
     212        amt = args[1].number; 
     213 
     214        /* Destroying squelched items is easy. */ 
     215        if (item == ALL_SQUELCHED) 
     216        {