Changeset 227
- Timestamp:
- 06/27/07 21:25:25 (1 year ago)
- Files:
-
- trunk/src/cave.c (modified) (1 diff)
- trunk/src/cmd0.c (modified) (1 diff)
- trunk/src/cmd1.c (modified) (9 diffs)
- trunk/src/cmd2.c (modified) (5 diffs)
- trunk/src/defines.h (modified) (1 diff)
- trunk/src/dungeon.c (modified) (1 diff)
- trunk/src/externs.h (modified) (1 diff)
- trunk/src/types.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/cave.c
r152 r227 4142 4142 4143 4143 /* Cancel auto-pickup if badly wounded XXX XXX */ 4144 if ((p_ptr->notice & (PN_PICKUP 0 | PN_PICKUP1)) &&4144 if ((p_ptr->notice & (PN_PICKUP)) && 4145 4145 (p_ptr->chp < (p_ptr->mhp * op_ptr->hitpoint_warn / 10))) 4146 4146 { trunk/src/cmd0.c
r224 r227 155 155 { "Start running", '.', do_cmd_run }, 156 156 { "Stand still", ',', do_cmd_hold }, 157 { "Jump (into a trap)", '-', do_cmd_jump },158 157 { "Check knowledge", '|', do_cmd_knowledge }, 159 158 { "Display menu of actions", '\n', do_cmd_menu }, trunk/src/cmd1.c
r224 r227 491 491 492 492 /* 493 * Determine if the object can be picked up , and has "=g" in its inscription.493 * Determine if the object can be picked up automatically. 494 494 */ 495 495 static bool auto_pickup_okay(const object_type *o_ptr, bool check_pack) … … 530 530 /* Find another '=' */ 531 531 s = strchr(s + 1, '='); 532 }533 }534 535 /* Optionally, check the backpack */536 if (check_pack)537 {538 int j;539 540 /* Look for similar and inscribed */541 for (j = 0; j < INVEN_PACK; j++)542 {543 object_type *j_ptr = &inventory[j];544 545 /* Skip non-objects */546 if (!j_ptr->k_idx) continue;547 548 /* The two items must be able to combine */549 if (!object_similar(j_ptr, o_ptr)) continue;550 551 /* The backpack item must be inscribed */552 if (!j_ptr->note) continue;553 554 /* Find a '=' */555 s = strchr(quark_str(j_ptr->note), '=');556 557 /* Process permissions */558 while (s)559 {560 /* =g ('g'et) means auto pickup */561 if (s[1] == 'g') return (TRUE);562 563 /* Find another '=' */564 s = strchr(s + 1, '=');565 }566 532 } 567 533 } … … 613 579 * 614 580 * Called with pickup: 615 * 0 to grab gold and describe non-goldobjects.581 * 0 to grab gold, auto-pickup some objects, and describe others objects. 616 582 * 1 to pick up objects either with or without displaying a menu. 617 583 * 2 to pick up objects, allowing cancel and quick pickup of single objects. 618 584 * 3 to pick up objects, forcing a menu for any number of objects. 619 *620 * Use the "p_ptr->auto_pickup_okay" variable to allow or dis-allow621 * automatically picking things up that take time. (NOT INCLUDED)622 585 * 623 586 * Scan the list of objects in that floor grid. Pick up gold automatically. … … 816 779 817 780 /* Automatically pick up items into the backpack */ 818 if ( (p_ptr->auto_pickup_okay) && (pickup) && (auto_pickup_okay(o_ptr, TRUE)))781 if (p_ptr->auto_pickup_okay && auto_pickup_okay(o_ptr, TRUE)) 819 782 { 820 783 /* Pick up the object (with a message) */ … … 1548 1511 * and also handles attempting to move into walls/doors/rubble/etc. 1549 1512 */ 1550 void move_player(int dir , int do_pickup)1513 void move_player(int dir) 1551 1514 { 1552 1515 int py = p_ptr->py; … … 1688 1651 p_ptr->command_new = '_'; 1689 1652 1690 /* Free turn XXX XXX XXX */1691 p_ptr->energy_use = 0;1692 1693 1653 /* Handle objects now. XXX */ 1694 p_ptr->energy_use += py_pickup(do_pickup) * 10; 1695 } 1654 p_ptr->energy_use = py_pickup(1) * 10; 1655 } 1656 1696 1657 1697 1658 /* All other grids (including traps) */ … … 1699 1660 { 1700 1661 /* Handle objects (later) */ 1701 if (do_pickup) p_ptr->notice |= (PN_PICKUP1); 1702 else p_ptr->notice |= (PN_PICKUP0); 1662 p_ptr->notice |= (PN_PICKUP); 1703 1663 } 1704 1664 … … 2429 2389 } 2430 2390 2391 2431 2392 /* Decrease counter */ 2432 2393 p_ptr->running--; … … 2436 2397 2437 2398 /* Move the player. Never pick up objects */ 2438 move_player(p_ptr->run_cur_dir, FALSE); 2399 p_ptr->auto_pickup_okay = FALSE; 2400 move_player(p_ptr->run_cur_dir); 2439 2401 } 2440 2441 trunk/src/cmd2.c
r156 r227 2045 2045 2046 2046 /* 2047 * Helper function for the "walk" and "jump" commands.2048 */ 2049 static void do_cmd_walk_or_jump(int do_pickup)2047 * Helper function for the "walk" command. 2048 */ 2049 void do_cmd_walk(void) 2050 2050 { 2051 2051 int y, x, dir; 2052 2053 2052 2054 2053 /* Get a direction (or abort) */ … … 2094 2093 2095 2094 /* Move the player */ 2096 move_player(dir, do_pickup); 2097 } 2098 2099 2100 /* 2101 * Walk into a grid (pick up objects as set by the auto-pickup option) 2102 */ 2103 void do_cmd_walk(void) 2104 { 2105 /* Move (usually pickup) */ 2106 do_cmd_walk_or_jump(always_pickup); 2107 } 2108 2109 2110 /* 2111 * Jump into a grid (flip pickup mode) 2112 */ 2113 void do_cmd_jump(void) 2114 { 2115 /* Move (usually do not pickup) */ 2116 do_cmd_walk_or_jump(!always_pickup); 2117 } 2095 move_player(dir); 2096 } 2097 2118 2098 2119 2099 … … 2182 2162 * Pick up treasure if "pickup" is true. 2183 2163 */ 2184 static void do_cmd_hold_or_stay(int pickup)2164 void do_cmd_hold(void) 2185 2165 { 2186 2166 /* Allow repeated command */ … … 2213 2193 2214 2194 /* Handle objects now. XXX XXX XXX */ 2215 p_ptr->energy_use += py_pickup( pickup) * 10;2195 p_ptr->energy_use += py_pickup(always_pickup) * 10; 2216 2196 2217 2197 /* Hack -- enter a store if we are on one */ … … 2228 2208 p_ptr->energy_use = 0; 2229 2209 } 2230 }2231 2232 2233 /*2234 * Hold still (usually pickup)2235 */2236 void do_cmd_hold(void)2237 {2238 /* Hold still (usually pickup) */2239 do_cmd_hold_or_stay(always_pickup);2240 2210 } 2241 2211 trunk/src/defines.h
r224 r227 1559 1559 * Bit flags for the "p_ptr->notice" variable 1560 1560 */ 1561 #define PN_COMBINE 0x00000001L /* Combine the pack */1562 #define PN_REORDER 0x00000002L /* Reorder the pack */1561 #define PN_COMBINE 0x00000001L /* Combine the pack */ 1562 #define PN_REORDER 0x00000002L /* Reorder the pack */ 1563 1563 #define PN_AUTOINSCRIBE 0x00000004L /* Autoinscribe items */ 1564 #define PN_PICKUP0 0x00000008L /* Notice stuff (allow pickup) */ 1565 #define PN_PICKUP1 0x00000010L /* Pick up stuff */ 1564 #define PN_PICKUP 0x00000008L /* Pick stuff up */ 1566 1565 /* xxx (many) */ 1567 1566 trunk/src/dungeon.c
r214 r227 1271 1271 1272 1272 /* Picking up objects */ 1273 else if (p_ptr->notice & (PN_PICKUP 1))1273 else if (p_ptr->notice & (PN_PICKUP)) 1274 1274 { 1275 1275 /* Recursively call the pickup function, use energy */ 1276 p_ptr->energy_use = py_pickup(1) * 10; 1277 p_ptr->notice &= ~(PN_PICKUP0 | PN_PICKUP1); 1278 } 1279 1280 /* Noticing objects (allow pickup) */ 1281 else if (p_ptr->notice & (PN_PICKUP0)) 1282 { 1283 /* Recursively call the pickup function, use energy */ 1284 p_ptr->energy_use = py_pickup(0) * 10; 1285 p_ptr->notice &= ~(PN_PICKUP0 | PN_PICKUP1); 1276 p_ptr->energy_use = py_pickup(always_pickup) * 10; 1277 p_ptr->notice &= ~(PN_PICKUP); 1286 1278 } 1287 1279 trunk/src/externs.h
r224 r227 305 305 extern void hit_trap(int y, int x); 306 306 extern void py_attack(int y, int x); 307 extern void move_player(int dir , int do_pickup);307 extern void move_player(int dir); 308 308 extern void run_step(int dir); 309 309 bool do_cmd_walk_test(int y, int x); trunk/src/types.h
r163 r227 199 199 200 200 u16b flavor; /* Special object flavor (or zero) */ 201 202 203 bool aware ;/* The player is "aware" of the item's effects */204 bool tried ;/* The player has "tried" one of the items */205 206 bool squelch ;/* Squelch this item? */207 bool everseen ;/* Used to despoilify squelch menus */201 u16b note; /* Autoinscription field (later) */ 202 203 bool aware : 1; /* The player is "aware" of the item's effects */ 204 bool tried : 1; /* The player has "tried" one of the items */ 205 206 bool squelch : 1; /* Squelch this item? */ 207 bool everseen : 1; /* Used to despoilify squelch menus */ 208 208 }; 209 209
