Changeset 652
- Timestamp:
- 01/29/08 04:25:13 (7 months ago)
- Files:
-
- trunk/src/Makefile.inc (modified) (1 diff)
- trunk/src/Makefile.src (modified) (1 diff)
- trunk/src/obj-desc.c (added)
- trunk/src/object.h (modified) (4 diffs)
- trunk/src/object1.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/Makefile.inc
r595 r652 16 16 attack.o: attack.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 17 17 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 18 defines.h option.h types.h ui.h z-type.h externs.h 18 defines.h option.h types.h ui.h z-type.h externs.h object.h 19 19 birth.o: birth.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 20 20 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 21 option.h types.h ui.h z-type.h externs.h cmds.h ui-menu.h21 option.h types.h ui.h z-type.h externs.h object.h cmds.h ui-menu.h 22 22 cave.o: cave.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 23 23 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 24 option.h types.h ui.h z-type.h externs.h game-event.h24 option.h types.h ui.h z-type.h externs.h object.h game-event.h 25 25 compress.o: compress.c compress.h h-basic.h 26 26 cmd0.o: cmd0.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 27 27 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 28 option.h types.h ui.h z-type.h externs.h cmds.h ui-menu.h 28 option.h types.h ui.h z-type.h externs.h object.h wizard.h cmds.h \ 29 ui-menu.h 29 30 cmd1.o: cmd1.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 30 31 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 31 option.h types.h ui.h z-type.h externs.h cmds.h32 option.h types.h ui.h z-type.h externs.h object.h cmds.h 32 33 cmd2.o: cmd2.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 33 34 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 34 option.h types.h ui.h z-type.h externs.h 35 option.h types.h ui.h z-type.h externs.h object.h 35 36 cmd3.o: cmd3.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 36 37 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 37 option.h types.h ui.h z-type.h externs.h 38 option.h types.h ui.h z-type.h externs.h object.h 38 39 cmd4.o: cmd4.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 39 40 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 40 option.h types.h ui.h z-type.h externs.h ui-menu.h41 option.h types.h ui.h z-type.h externs.h object.h ui-menu.h 41 42 cmd5.o: cmd5.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 42 43 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 43 option.h types.h ui.h z-type.h externs.h 44 option.h types.h ui.h z-type.h externs.h object.h 44 45 cmd6.o: cmd6.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 45 46 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 46 option.h types.h ui.h z-type.h externs.h cmds.h effects.h47 option.h types.h ui.h z-type.h externs.h object.h cmds.h effects.h 47 48 cmd-obj.o: cmd-obj.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 48 49 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 49 defines.h option.h types.h ui.h z-type.h externs.h cmds.h 50 defines.h option.h types.h ui.h z-type.h externs.h object.h cmds.h 51 death.o: death.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 52 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 53 option.h types.h ui.h z-type.h externs.h object.h ui-menu.h 50 54 debug.o: debug.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 51 55 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 52 option.h types.h ui.h z-type.h externs.h debug.h56 option.h types.h ui.h z-type.h externs.h object.h debug.h 53 57 dungeon.o: dungeon.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 54 58 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 55 defines.h option.h types.h ui.h z-type.h externs.h cmds.h59 defines.h option.h types.h ui.h z-type.h externs.h object.h cmds.h 56 60 effects.o: effects.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 57 61 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 58 defines.h option.h types.h ui.h z-type.h externs.h effects.h62 defines.h option.h types.h ui.h z-type.h externs.h object.h effects.h 59 63 files.o: files.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 60 64 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 61 option.h types.h ui.h z-type.h externs.h cmds.h65 option.h types.h ui.h z-type.h externs.h object.h ui-menu.h cmds.h 62 66 game-cmd.o: game-cmd.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 63 67 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 64 defines.h option.h types.h ui.h z-type.h externs.h game-cmd.h68 defines.h option.h types.h ui.h z-type.h externs.h object.h game-cmd.h 65 69 game-event.o: game-event.c z-virt.h h-basic.h game-event.h 66 70 generate.o: generate.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 67 71 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 68 defines.h option.h types.h ui.h z-type.h externs.h 72 defines.h option.h types.h ui.h z-type.h externs.h object.h 73 history.o: history.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 74 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 75 defines.h option.h types.h ui.h z-type.h externs.h object.h 69 76 init1.o: init1.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 70 77 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 71 option.h types.h ui.h z-type.h externs.h effects.h init.h78 option.h types.h ui.h z-type.h externs.h object.h effects.h init.h 72 79 init2.o: init2.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 73 80 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 74 option.h types.h ui.h z-type.h externs.h init.h cmds.h game-event.h \75 game- cmd.h81 option.h types.h ui.h z-type.h externs.h object.h init.h cmds.h \ 82 game-event.h game-cmd.h 76 83 load.o: load.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 77 84 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 78 option.h types.h ui.h z-type.h externs.h 85 option.h types.h ui.h z-type.h externs.h object.h 79 86 loadsave.o: loadsave.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 80 87 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 81 defines.h option.h types.h ui.h z-type.h externs.h z-blockfile.h \82 z- smap.h88 defines.h option.h types.h ui.h z-type.h externs.h object.h \ 89 z-blockfile.h z-smap.h 83 90 melee1.o: melee1.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 84 91 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 85 defines.h option.h types.h ui.h z-type.h externs.h 92 defines.h option.h types.h ui.h z-type.h externs.h object.h 86 93 melee2.o: melee2.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 87 94 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 88 defines.h option.h types.h ui.h z-type.h externs.h 95 defines.h option.h types.h ui.h z-type.h externs.h object.h 89 96 monster1.o: monster1.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 90 97 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 91 defines.h option.h types.h ui.h z-type.h externs.h 98 defines.h option.h types.h ui.h z-type.h externs.h object.h 92 99 monster2.o: monster2.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 93 100 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 94 defines.h option.h types.h ui.h z-type.h externs.h 101 defines.h option.h types.h ui.h z-type.h externs.h object.h 95 102 object1.o: object1.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 96 103 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 97 defines.h option.h types.h ui.h z-type.h externs.h randname.h104 defines.h option.h types.h ui.h z-type.h externs.h object.h randname.h 98 105 object2.o: object2.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 99 106 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 100 defines.h option.h types.h ui.h z-type.h externs.h 107 defines.h option.h types.h ui.h z-type.h externs.h object.h 108 obj-desc.o: obj-desc.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 109 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 110 defines.h option.h types.h ui.h z-type.h externs.h object.h 101 111 obj-info.o: obj-info.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 102 112 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 103 defines.h option.h types.h ui.h z-type.h externs.h effects.h cmds.h 113 defines.h option.h types.h ui.h z-type.h externs.h object.h effects.h \ 114 cmds.h 115 obj-make.o: obj-make.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 116 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 ui.h z-type.h externs.h object.h 104 118 option.o: option.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 105 119 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 106 defines.h option.h types.h ui.h z-type.h externs.h 120 defines.h option.h types.h ui.h z-type.h externs.h object.h 107 121 randart.o: randart.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 108 122 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 109 defines.h option.h types.h ui.h z-type.h externs.h init.h randname.h 123 defines.h option.h types.h ui.h z-type.h externs.h object.h init.h \ 124 randname.h 110 125 randname.o: randname.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 111 126 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 112 defines.h option.h types.h ui.h z-type.h externs.h randname.h127 defines.h option.h types.h ui.h z-type.h externs.h object.h randname.h 113 128 pathfind.o: pathfind.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 114 129 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 115 defines.h option.h types.h ui.h z-type.h externs.h 130 defines.h option.h types.h ui.h z-type.h externs.h object.h 116 131 score.o: score.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 117 132 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 118 option.h types.h ui.h z-type.h externs.h 133 option.h types.h ui.h z-type.h externs.h object.h 119 134 signals.o: signals.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 120 135 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 121 defines.h option.h types.h ui.h z-type.h externs.h 136 defines.h option.h types.h ui.h z-type.h externs.h object.h 122 137 save.o: save.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 123 138 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 124 option.h types.h ui.h z-type.h externs.h 139 option.h types.h ui.h z-type.h externs.h object.h 125 140 spells1.o: spells1.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 126 141 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 127 defines.h option.h types.h ui.h z-type.h externs.h 142 defines.h option.h types.h ui.h z-type.h externs.h object.h 128 143 spells2.o: spells2.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 129 144 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 130 defines.h option.h types.h ui.h z-type.h externs.h 145 defines.h option.h types.h ui.h z-type.h externs.h object.h 131 146 squelch.o: squelch.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 132 147 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 133 defines.h option.h types.h ui.h z-type.h externs.h cmds.h ui-menu.h 148 defines.h option.h types.h ui.h z-type.h externs.h object.h cmds.h \ 149 ui-menu.h 134 150 store.o: store.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 135 151 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 136 option.h types.h ui.h z-type.h externs.h cmds.h ui-menu.h152 option.h types.h ui.h z-type.h externs.h object.h cmds.h ui-menu.h 137 153 tables.o: tables.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 138 154 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 139 defines.h option.h types.h ui.h z-type.h externs.h 155 defines.h option.h types.h ui.h z-type.h externs.h object.h 140 156 trap.o: trap.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 141 157 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 142 option.h types.h ui.h z-type.h externs.h 158 option.h types.h ui.h z-type.h externs.h object.h 143 159 ui.o: ui.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 144 160 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 145 option.h types.h ui.h z-type.h externs.h 161 option.h types.h ui.h z-type.h externs.h object.h 146 162 ui-event.o: ui-event.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 147 163 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 148 defines.h option.h types.h ui.h z-type.h externs.h 164 defines.h option.h types.h ui.h z-type.h externs.h object.h 149 165 ui-menu.o: ui-menu.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 150 166 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 ui.h z-type.h externs.h ui-menu.h167 defines.h option.h types.h ui.h z-type.h externs.h object.h ui-menu.h 152 168 util.o: util.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 153 169 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 154 option.h types.h ui.h z-type.h externs.h randname.h170 option.h types.h ui.h z-type.h externs.h object.h randname.h 155 171 variable.o: variable.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 156 172 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 157 defines.h option.h types.h ui.h z-type.h externs.h 173 defines.h option.h types.h ui.h z-type.h externs.h object.h 158 174 wiz-spoil.o: wiz-spoil.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 159 175 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 160 defines.h option.h types.h ui.h z-type.h externs.h cmds.h176 defines.h option.h types.h ui.h z-type.h externs.h object.h cmds.h 161 177 wiz-stats.o: wiz-stats.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 162 178 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 163 defines.h option.h types.h ui.h z-type.h externs.h wizard.h179 defines.h option.h types.h ui.h z-type.h externs.h object.h wizard.h 164 180 wizard.o: wizard.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 165 181 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 166 defines.h option.h types.h ui.h z-type.h externs.h wizard.h cmds.h 182 defines.h option.h types.h ui.h z-type.h externs.h object.h wizard.h \ 183 cmds.h 167 184 x-spell.o: x-spell.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 168 185 z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 169 defines.h option.h types.h ui.h z-type.h externs.h 186 defines.h option.h types.h ui.h z-type.h externs.h object.h 170 187 xtra1.o: xtra1.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 171 188 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 172 option.h types.h ui.h z-type.h externs.h game-event.h189 option.h types.h ui.h z-type.h externs.h object.h game-event.h 173 190 xtra2.o: xtra2.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 174 191 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 175 option.h types.h ui.h z-type.h externs.h cmds.h192 option.h types.h ui.h z-type.h externs.h object.h cmds.h 176 193 xtra3.o: xtra3.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 177 194 z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 178 option.h types.h ui.h z-type.h externs.h game-event.h195 option.h types.h ui.h z-type.h externs.h object.h game-event.h 179 196 z-file.o: z-file.c z-file.h h-basic.h z-virt.h z-util.h z-form.h 180 197 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
r636 r652 80 80 object1.o \ 81 81 object2.o \ 82 obj-desc.o \ 82 83 obj-info.o \ 83 84 obj-make.o \ trunk/src/object.h
r610 r652 1 1 #ifndef INCLUDED_OBJECT_H 2 2 #define INCLUDED_OBJECT_H 3 4 5 /*** Variables ***/ 6 7 /* object1.c */ 8 9 #define MAX_TITLES 50 /* Used with scrolls (min 48) */ 10 11 /* The titles of scrolls, by sval. */ 12 extern char scroll_adj[MAX_TITLES][16]; 13 14 15 /*** Functions ***/ 3 16 4 17 /* object1.c */ 5 18 void flavor_init(void); 6 19 void reset_visuals(bool unused); 7 void object_kind_name(char *buf, size_t max, int k_idx, bool easy_know);8 20 void object_flags(const object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3); 9 21 void object_flags_known(const object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3); 10 void object_desc(char *buf, size_t max, const object_type *o_ptr, int pref, int mode);11 void object_desc_spoil(char *buf, size_t max, const object_type *o_ptr, int pref, int mode);12 22 char index_to_label(int i); 13 23 s16b label_to_inven(int c); 14 24 s16b label_to_equip(int c); 15 25 s16b wield_slot(const object_type *o_ptr); 16 c ptrmention_use(int i);17 c ptrdescribe_use(int i);26 const char *mention_use(int i); 27 const char *describe_use(int i); 18 28 bool item_tester_okay(const object_type *o_ptr); 19 29 int scan_floor(int *items, int max_size, int y, int x, int mode); … … 23 33 void show_equip(void); 24 34 void show_floor(const int *floor_list, int floor_num, bool gold); 25 bool verify_item(c ptrprompt, int item);26 bool get_item(int *cp, c ptr pmt, cptrstr, int mode);35 bool verify_item(const char *prompt, int item); 36 bool get_item(int *cp, const char *pmt, const char *str, int mode); 27 37 28 38 /* object2.c */ … … 33 43 void wipe_o_list(void); 34 44 s16b o_pop(void); 35 object_type *get_first_object(int y, int x);45 object_type *get_first_object(int y, int x); 36 46 object_type *get_next_object(const object_type *o_ptr); 37 47 void object_known(object_type *o_ptr); … … 72 82 void reduce_charges(object_type *o_ptr, int amt); 73 83 84 85 /*** obj-name.c ***/ 86 87 /** 88 * Modes for object_desc(). 89 */ 90 enum 91 { 92 ODESC_BASENAME = 0, 93 ODESC_ALL = 3, 94 ODESC_INSTORE = 4 95 }; 96 97 /** 98 * Describes item "o_ptr" into buffer "buf" of size "max". 99 * 100 * If "prefix" is TRUE, then the name will be prefixed with a pseudo-numeric 101 * indicator of the number of items in the pile. 102 * 103 * Modes ("prefix" is TRUE): 104 * OD_BASENAME -- Chain Mail of Death 105 * OD_INSTORE -- 5 Rings of Death [1,+3] (+2 to Stealth) {nifty} 106 * OD_ALL -- 5 Rings of Death [1,+3] (+2 to Stealth) {nifty} (squelch) 107 * 108 * Modes ("prefix" is FALSE): 109 * OD_BASENAME -- Chain Mail of Death 110 * OD_INSTORE -- Rings of Death [1,+3] (+2 to Stealth) {nifty} 111 * OD_ALL -- Rings of Death [1,+3] (+2 to Stealth) {nifty} (squelch) 112 */ 113 size_t object_desc(char *buf, size_t max, const object_type *o_ptr, bool prefix, int mode); 114 115 /** 116 * Describes item "o_ptr" fully into buffer "buf" of size "max". 117 * 118 * This differs from object_desc() only in that it can provide information the 119 * player isn't meant to know. 120 */ 121 void object_desc_spoil(char *buf, size_t max, const object_type *o_ptr, int pref, int mode); 122 123 /** 124 * Describe item kind "k_idx" into buffer "buf" of size "max". 125 * 126 * XXX 127 */ 128 void object_kind_name(char *buf, size_t max, int k_idx, bool easy_know); 129 130 74 131 /* obj-make.c */ 75 132 void free_obj_alloc(void); trunk/src/object1.c
r625 r652 20 20 21 21 22 /*23 * Max sizes of the following arrays.24 */25 #define MAX_TITLES 50 /* Used with scrolls (min 48) */26 27 22 28 23 /* 29 24 * Hold the titles of scrolls, 6 to 14 characters each. 30 * 31 * Also keep an array of scroll colors (always WHITE for now). 32 */ 33 34 static char scroll_adj[MAX_TITLES][16]; 25 */ 26 char scroll_adj[MAX_TITLES][16]; 35 27 36 28 … … 372 364 373 365 374 375 /*376 * Puts a very stripped-down version of an object's name into buf.377 * If easy_know is TRUE, then the IDed names are used, otherwise378 * flavours, scroll names, etc will be used.379 *380 * Just truncates if the buffer isn't big enough.381 */382 void object_kind_name(char *buf, size_t max, int k_idx, bool easy_know)383 {384 char *t;385 386 object_kind *k_ptr = &k_info[k_idx];387 388 /* If not aware, use flavor */389 if (!easy_know && !k_ptr->aware && k_ptr->flavor)390 {391 if (k_ptr->tval == TV_SCROLL)392 {393 strnfmt(buf, max, "\"%s\"", scroll_adj[k_ptr->sval]);394 }395 else if (k_ptr->tval == TV_FOOD && k_ptr->sval < SV_FOOD_MIN_FOOD)396 {397 strnfmt(buf, max, "%s Mushroom", flavor_text + flavor_info[k_ptr->flavor].text);398 }399 else400 {401 /* Plain flavour (e.g. Copper) will do. */402 my_strcpy(buf, flavor_text + flavor_info[k_ptr->flavor].text, max);403 }404 }405 406 /* Use proper name (Healing, or whatever) */407 else408 {409 cptr str = (k_name + k_ptr->name);410 411 if (k_ptr->tval == TV_FOOD && k_ptr->sval < SV_FOOD_MIN_FOOD)412 {413 my_strcpy(buf, "Mushroom of ", max);414 max -= strlen(buf);415 t = buf + strlen(buf);416 }417 else418 {419 t = buf;420 }421 422 /* Skip past leading characters */423 while ((*str == ' ') || (*str == '&')) str++;424 425 /* Copy useful chars */426 for (; *str && max > 1; str++)427 {428 /* Pluralizer for irregular plurals */429 /* Useful for languages where adjective changes for plural */430 if (*str == '|')431 {432 /* Process singular part */433 for (str++; *str != '|' && max > 1; str++)434 {435 *t++ = *str;436 max--;437 }438 439 /* Process plural part */440 for (str++; *str != '|'; str++) ;441 }442 443 /* English plural indicator can simply be skipped */444 else if (*str != '~')445 {446 *t++ = *str;447 max--;448 }449 }450 451 /* Terminate the new name */452 *t = '\0';453 }454 }455 456 457 458 /*459 * Efficient version of '(T) += sprintf((T), "%c", (C))'460 */461 #define object_desc_chr_macro(T,C) do { \462 \463 /* Copy the char */ \464 *(T)++ = (C); \465 \466 } while (0)467 468 469 470 /*471 * Efficient version of '(T) += sprintf((T), "%s", (S))'472 */473 #define object_desc_str_macro(T,S) do { \474 \475 cptr s = (S); \476 \477 /* Copy the string */ \478 while (*s) *(T)++ = *s++; \479 \480 } while (0)481 482 483 484 /*485 * Efficient version of '(T) += sprintf((T), "%u", (N))'486 */487 #define object_desc_num_macro(T,N) do { \488 \489 int n = (N); \490 \491 int p; \492 \493 /* Find "size" of "n" */ \494 for (p = 1; n >= p * 10; p = p * 10) /* loop */; \495 \496 /* Dump each digit */ \497 while (p >= 1) \498 { \499 /* Dump the digit */ \500 *(T)++ = I2D(n / p); \501 \502 /* Remove the digit */ \503 n = n % p; \504 \505 /* Process next digit */ \506 p = p / 10; \507 } \508 \509 } while (0)510 511 512 513 /*514 * Efficient version of '(T) += sprintf((T), "%+d", (I))'515 */516 #define object_desc_int_macro(T,I) do { \517 \518 int i = (I); \519 \520 /* Negative */ \521 if (i < 0) \522 { \523 /* Take the absolute value */ \524 i = 0 - i; \525 \526 /* Use a "minus" sign */ \527 *(T)++ = '-'; \528 } \529 \530 /* Positive (or zero) */ \531 else \532 { \533 /* Use a "plus" sign */ \534 *(T)++ = '+'; \535 } \536 \537 /* Dump the number itself */ \538 object_desc_num_macro(T, i); \539 \540 } while (0)541 542 543 544 545 /*546 * Creates a description of the item "o_ptr", and stores it in "buf".547 *548 * One can choose the "verbosity" of the description, including whether549 * or not the "number" of items should be described, and how much detail550 * should be used when describing the item.551 *552 * The given "buf" should be at least 80 chars long to hold the longest553 * possible description, which can get pretty long, including inscriptions,554 * such as:555 * "no more Maces of Disruption (Defender) (+10,+10) [+5] (+3 to stealth)".556 *557 * Note that the object description will be clipped to fit into the given558 * buffer size.559 *560 * Note the use of "object_desc_int_macro()" and "object_desc_num_macro()"561 * and "object_desc_str_macro()" and "object_desc_chr_macro()" as extremely562 * efficient, portable, versions of some common "sprintf()" commands (without563 * the bounds checking or termination writing), which allow a pointer to564 * efficiently move through a buffer while modifying it in various ways.565 *566 * Various improper uses and/or placements of "&" or "~" characters can567 * easily induce out-of-bounds memory accesses. Some of these could be568 * easily checked for, if efficiency was not a concern.569 *570 * Note that all ego-items (when known) append an "Ego-Item Name", unless571 * the item is also an artifact, which should never happen.572 *573 * Note that all artifacts (when known) append an "Artifact Name", so we574 * have special processing for "Specials" (artifact Lites, Rings, Amulets).575 * The "Specials" never use "modifiers" if they are "known", since they576 * have special "descriptions", such as "The Necklace of the Dwarves".577 *578 * Special Lite's use the "k_info" base-name (Phial, Star, or Arkenstone),579 * plus the artifact name, just like any other artifact, if known.580 *581 * Special Ring's and Amulet's, if not "aware", use the same code as normal582 * rings and amulets, and if "aware", use the "k_info" base-name (Ring or583 * Amulet or Necklace). They will NEVER "append" the "k_info" name. But,584 * they will append the artifact name, just like any artifact, if known.585 *586 * None of the Special Rings/Amulets are "EASY_KNOW", though they could be,587 * at least, those which have no "pluses", such as the three artifact lites.588 *589 * The "pluralization" rules are extremely hackish, in fact, for efficiency,590 * we only handle things like "torch"/"torches" and "cutlass"/"cutlasses",591 * and we would not handle "box"/"boxes", or "knife"/"knives", correctly.592 * Of course, it would be easy to add rules for these forms.593 *594 * If "pref" is true then a "numeric" prefix will be pre-pended, else is is595 * assumed that a string such as "The" or "Your" will be pre-pended later.596 *597 * Modes ("pref" is TRUE):598 * 0 -- Chain Mail of Death599 * 1 -- A Cloak of Death [1,+3]600 * 2 -- An Amulet of Death [1,+3] (+2 to Stealth)601 * 3 -- 5 Rings of Death [1,+3] (+2 to Stealth) {nifty} (squelch)602 * 4 -- 5 Rings of Death [1,+3] (+2 to Stealth) {nifty}603 *604 * Modes ("pref" is FALSE):605 * 0 -- Chain Mail of Death606 * 1 -- Cloak of Death [1,+3]607 * 2 -- Amulet of Death [1,+3] (+2 to Stealth)608 * 3 -- Rings of Death [1,+3] (+2 to Stealth) {nifty} (squelch)609 * 4 -- Rings of Death [1,+3] (+2 to Stealth) {nifty}610 */611 void object_desc(char *buf, size_t max, const object_type *o_ptr, int pref, int mode)612 {613 cptr basenm;614 cptr modstr;615 616 int power;617 618 bool aware;619 bool known;620 621 bool flavor;622 623 bool append_name;624 625 bool show_weapon;626 bool show_armour;627 628 char *b;629 630 char *t;631 632 cptr s;633 634 cptr u;635 cptr v;636 637 char p1 = '(', p2 = ')';638 char b1 = '[', b2 = ']';639 char c1 = '{', c2 = '}';640 641 char tmp_buf[128];642 643 u32b f1, f2, f3;644 645 object_kind *k_ptr = &k_info[o_ptr->k_idx];646 647 648 /* Extract some flags */649 object_flags(o_ptr, &f1, &f2, &f3);650 651 652 /* See if the object is "aware" */653 aware = (object_aware_p(o_ptr) ? TRUE : FALSE);654 655 /* See if the object is "known" */656 known = (object_known_p(o_ptr) ? TRUE : FALSE);657 658 /* See if the object is "flavored" */659 flavor = (k_ptr->flavor ? TRUE : FALSE);660 661 /* Allow flavors to be hidden when aware */662 if (aware && !show_flavors) flavor = FALSE;663 664 /* Hack -- mark-to-squelch worthless items XXX */665 if (!k_ptr->everseen && aware && OPT(squelch_worthless))666 {667 if (object_value(o_ptr) == 0)668 {669 k_ptr->squelch = TRUE;670 p_ptr->notice |= PN_SQUELCH;671 }672 }673 674 /* We've seen it at least once now we're aware of it */675 if (aware) k_ptr->everseen = TRUE;676 677 /* Object is in the inventory of a store */678 if (o_ptr->ident & IDENT_STORE)679 {680 /* Don't show flavors */681 flavor = FALSE;682 683 /* Pretend known and aware */684 aware = TRUE;685 known = TRUE;686 }687 688 689 /* XXX anything object_desc'd can be squelched */690 if (aware) k_ptr->everseen = TRUE;691 692 /* Assume no name appending */693 append_name = FALSE;694 695 /* Assume no need to show "weapon" bonuses */696 show_weapon = FALSE;697 698 /* Assume no need to show "armour" bonuses */699 show_armour = FALSE;700 701 /* Extract default "base" string */702 basenm = (k_name + k_ptr->name);703 704 /* Assume no "modifier" string */705 modstr = "";706 707 708 /* Analyze the object */709 switch (o_ptr->tval)710 {711 /* Some objects are easy to describe */712 case TV_SKELETON:713 case TV_BOTTLE:714 case TV_JUNK:715 case TV_SPIKE:716 case TV_FLASK:717 case TV_CHEST:718 {719 break;720 }721 722 /* Missiles/Bows/Weapons */723 case TV_SHOT:724 case TV_BOLT:725 case TV_ARROW:726 case TV_BOW:727 case TV_HAFTED:728 case TV_POLEARM:729 case TV_SWORD:730 case TV_DIGGING:731 {732 show_weapon = TRUE;733 break;734 }735 736 /* Armour */737 case TV_BOOTS:738 case TV_GLOVES:739 case TV_CLOAK:740 case TV_CROWN:741 case TV_HELM:742 case TV_SHIELD:743 case TV_SOFT_ARMOR:744 case TV_HARD_ARMOR:745 case TV_DRAG_ARMOR:746 {747 show_armour = TRUE;748 break;749 }750 751 /* Lites (including a few "Specials") */752 case TV_LITE:753 {754 break;755 }756 757 /* Amulets (including a few "Specials") */758 case TV_AMULET:759 {760 /* Hack -- Known artifacts */761 if (artifact_p(o_ptr) && aware) break;762 763 /* Color the object */764 modstr = flavor_text + flavor_info[k_ptr->flavor].text;765 if (aware) append_name = TRUE;766 basenm = (flavor ? "& # Amulet~" : "& Amulet~");767 768 break;769 }770 771 /* Rings (including a few "Specials") */772 case TV_RING:773 {774 /* Hack -- Known artifacts */775 if (artifact_p(o_ptr) && aware) break;776 777 /* Color the object */778 modstr = flavor_text + flavor_info[k_ptr->flavor].text;779 if (aware) append_name = TRUE;780 basenm = (flavor ? "& # Ring~" : "& Ring~");781 782 break;783 }784 785 /* Staffs */786 case TV_STAFF:787 {788 /* Color the object */789 modstr = flavor_text + flavor_info[k_ptr->flavor].text;790 if (aware) append_name = TRUE;791 basenm = (flavor ? "& # Staff~" : "& Staff~");792 793 break;794 }795 796 /* Wands */797 case TV_WAND:798 {799 /* Color the object */800 modstr = flavor_text + flavor_info[k_ptr->flavor].text;801 if (aware) append_name = TRUE;802 basenm = (flavor ? "& # Wand~" : "& Wand~");803 804 break;805 }806 807 /* Rods */808 case TV_ROD:809 {810 /* Color the object */811 modstr = flavor_text + flavor_info[k_ptr->flavor].text;812 if (aware) append_name = TRUE;813 basenm = (flavor ? "& # Rod~" : "& Rod~");814 815 break;816 }817 818 /* Scrolls */819 case TV_SCROLL:820 {821 /* Color the object */822 modstr = scroll_adj[o_ptr->sval];823 if (aware) append_name = TRUE;824 basenm = (flavor ? "& Scroll~ titled \"#\"" : "& Scroll~");825 826 break;827 }828 829 /* Potions */830 case TV_POTION:831 {832 /* Color the object */833 modstr = flavor_text + flavor_info[k_ptr->flavor].text;834 if (aware) append_name = TRUE;835 basenm = (flavor ? "& # Potion~" : "& Potion~");836 837 break;838 }839 840 /* Food */841 case TV_FOOD:842 {843 /* Ordinary food is "boring" */844 if (o_ptr->sval >= SV_FOOD_MIN_FOOD) break;845 846 /* Color the object */847 modstr = flavor_text + flavor_info[k_ptr->flavor].text;848 if (aware) append_name = TRUE;849 basenm = (flavor ? "& # Mushroom~" : "& Mushroom~");850 851 break;852 }853 854 /* Magic Books */855 case TV_MAGIC_BOOK:856 {857 modstr = basenm;858 basenm = "& Book~ of Magic Spells #";859 break;860 }861 862 /* Prayer Books */863 case TV_PRAYER_BOOK:864 {865 modstr = basenm;866 basenm = "& Holy Book~ of Prayers #";867 break;868 }869 870 /* Hack -- Gold/Gems */871 case TV_GOLD:872 {873 my_strcpy(buf, basenm, max);874 return;875 }876 877 /* Hack -- Default -- Used in the "inventory" routine */878 default:879 {880 my_strcpy(buf, "(nothing)", max);881 return;882 }883 }884 885 886 /* Start dumping the result */887 t = b = tmp_buf;888 889 /* Begin */890 s = basenm;891 892 /* Handle objects which sometimes use "a" or "an" */893 if (*s == '&')894 {895 /* Paranoia XXX XXX XXX */896 /* ASSERT(s[1] == ' '); */897 898 /* Skip the ampersand and the following space */899 s += 2;900 901 /* No prefix */902 if (!pref)903 {904 /* Nothing */905 }906 907 /* Hack -- None left */908 else if (o_ptr->number <= 0)909 {910 object_desc_str_macro(t, "no more ");911 }912 913 /* Extract the number */914 else if (o_ptr->number > 1)915 {916 object_desc_num_macro(t, o_ptr->number);917 object_desc_chr_macro(t, ' ');918 }919 920 /* Hack -- The only one of its kind */921 else if (known && artifact_p(o_ptr))922 {923 object_desc_str_macro(t, "The ");924 }925 926 /* Hack -- A single one, and next character will be a vowel */927 else if ((*s == '#') ? is_a_vowel(modstr[0]) : is_a_vowel(*s))928 {929 object_desc_str_macro(t, "an ");930 }931 932
