Changeset 137
- Timestamp:
- 05/14/07 04:47:59 (1 year ago)
- Files:
-
- trunk/src/cave.c (modified) (1 diff)
- trunk/src/cmd1.c (modified) (8 diffs)
- trunk/src/defines.h (modified) (3 diffs)
- trunk/src/dungeon.c (modified) (2 diffs)
- trunk/src/randname.c (modified) (1 diff)
- trunk/src/types.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/cave.c
r48 r137 4141 4141 } 4142 4142 4143 /* Cancel auto-pickup if badly wounded XXX XXX */ 4144 if ((p_ptr->notice & (PN_PICKUP0 | PN_PICKUP1)) && 4145 (p_ptr->chp < (p_ptr->mhp * op_ptr->hitpoint_warn / 10))) 4146 { 4147 p_ptr->auto_pickup_okay = FALSE; 4148 } 4149 4143 4150 /* Flush the input if requested */ 4144 4151 if (flush_disturb) flush(); trunk/src/cmd1.c
r124 r137 667 667 bool msg = TRUE; 668 668 669 s32b total_gold = 0L; 670 byte *treasure; 671 669 672 670 673 /* Nothing to pick up -- return */ … … 675 678 676 679 677 /* Scan the objects */ 680 /* Allocate and wipe an array of ordinary gold objects */ 681 C_MAKE(treasure, SV_GOLD_MAX, byte); 682 (void)C_WIPE(treasure, SV_GOLD_MAX, byte); 683 684 /* Pick up all the ordinary gold objects */ 678 685 for (this_o_idx = cave_o_idx[py][px]; this_o_idx; this_o_idx = next_o_idx) 679 686 { 687 int gold_type; 688 680 689 /* Get the object */ 681 690 o_ptr = &o_list[this_o_idx]; … … 687 696 if (!o_ptr->marked) continue; 688 697 698 /* Ignore if not legal treasure */ 699 if ((o_ptr->tval != TV_GOLD) || 700 (o_ptr->sval >= SV_GOLD_MAX)) continue; 701 702 /* Hack -- adjust treasure type (to avoid picking up "gold, gold, and gold") */ 703 gold_type = o_ptr->sval; 704 if ((gold_type == SV_COPPER2) || (gold_type == SV_COPPER3)) 705 gold_type = SV_COPPER1; 706 if ((gold_type == SV_SILVER2) || (gold_type == SV_SILVER3)) 707 gold_type = SV_SILVER1; 708 if ((gold_type == SV_GOLD2) || (gold_type == SV_GOLD3)) 709 gold_type = SV_GOLD1; 710 if (gold_type == SV_GARNETS2) 711 gold_type = SV_GARNETS1; 712 713 /* Note that we have this kind of treasure */ 714 treasure[gold_type]++; 715 716 /* Increment total value */ 717 total_gold += (s32b)o_ptr->pval; 718 719 /* Delete the gold */ 720 delete_object_idx(this_o_idx); 721 } 722 723 /* Pick up the gold, if present */ 724 if (total_gold) 725 { 726 char buf[1024]; 727 char tmp[80]; 728 int i, count, total, k_idx; 729 730 /* Build a message */ 731 (void)strnfmt(buf, sizeof(buf), "You have found %ld gold pieces worth of ", total_gold); 732 733 /* Count the types of treasure present */ 734 for (total = 0, i = 0; i < SV_GOLD_MAX; i++) 735 { 736 if (treasure[i]) total++; 737 } 738 739 /* List the treasure types */ 740 for (count = 0, i = 0; i < SV_GOLD_MAX; i++) 741 { 742 /* Skip if no treasure of this type */ 743 if (!treasure[i]) continue; 744 745 /* Get this object index */ 746 k_idx = lookup_kind(TV_GOLD, i); 747 748 /* Skip past errors XXX */ 749 if (k_idx <= 0) continue; 750 751 /* Get the object name */ 752 strip_name(tmp, k_idx, TRUE); 753 754 /* Build up the pickup string */ 755 my_strcat(buf, tmp, sizeof(buf)); 756 757 /* Added another kind of treasure */ 758 count++; 759 760 /* Add a comma if necessary */ 761 if ((total > 2) && (count < total)) strcat(buf, ","); 762 763 /* Add an "and" if necessary */ 764 if ((total >= 2) && (count == total-1)) strcat(buf, " and"); 765 766 /* Add a space or period if necessary */ 767 if (count < total) strcat(buf, " "); 768 else strcat(buf, "."); 769 } 770 771 /* Determine which sound to play */ 772 if (total_gold < 200) sound_msg = MSG_MONEY1; 773 else if (total_gold < 600) sound_msg = MSG_MONEY2; 774 else sound_msg = MSG_MONEY3; 775 776 /* Display the message */ 777 message_format(sound_msg, 0, "%s", buf); 778 779 /* Add gold to purse */ 780 p_ptr->au += total_gold; 781 782 /* Redraw gold */ 783 p_ptr->redraw |= (PR_GOLD); 784 785 /* Window stuff */ 786 p_ptr->window |= (PW_PLAYER_0 | PW_PLAYER_1); 787 } 788 789 /* Free the gold array */ 790 FREE(treasure); 791 792 793 /* Scan the remaining objects */ 794 for (this_o_idx = cave_o_idx[py][px]; this_o_idx; this_o_idx = next_o_idx) 795 { 796 /* Get the object */ 797 o_ptr = &o_list[this_o_idx]; 798 799 /* Get the next object */ 800 next_o_idx = o_ptr->next_o_idx; 801 802 /* Ignore all hidden objects */ 803 if (!o_ptr->marked) continue; 804 689 805 /* Paranoia -- ignore all dead objects XXX */ 690 806 if (!o_ptr->k_idx) continue; … … 694 810 695 811 696 /* Pick up gold */697 if (o_ptr->tval == TV_GOLD)698 {699 /* Determine which sound to play */700 if ((long)o_ptr->pval < 200) sound_msg = MSG_MONEY1;701 else if ((long)o_ptr->pval < 600) sound_msg = MSG_MONEY2;702 else sound_msg = MSG_MONEY3;703 704 /* Describe the object */705 object_desc(o_name, sizeof(o_name), o_ptr, TRUE, 3);706 707 /* Message */708 message_format(sound_msg, 0, "You have found %s worth %ld gold pieces.",709 o_name, (long)o_ptr->pval);710 711 /* Collect the gold */712 p_ptr->au += o_ptr->pval;713 714 /* Redraw gold */715 p_ptr->redraw |= (PR_GOLD);716 717 /* Window stuff */718 p_ptr->window |= (PW_PLAYER_0 | PW_PLAYER_1);719 720 /* Delete the gold */721 delete_object_idx(this_o_idx);722 723 /* Check the next object */724 continue;725 }726 727 812 /* Automatically pick up items into the backpack */ 728 if ((p ickup) && (auto_pickup_okay(o_ptr, TRUE)))813 if ((p_ptr->auto_pickup_okay) && (pickup) && (auto_pickup_okay(o_ptr, TRUE))) 729 814 { 730 815 /* Pick up the object (with a message) */ … … 765 850 { 766 851 /* Optionally, display more information about floor items */ 767 if ( query_floor)852 if ((query_floor) && (floor_num > 1)) 768 853 { 769 854 /* Scan all marked objects in the grid */ … … 899 984 * potentially unsafe, ask the player to confirm all pickups. 900 985 */ 901 if (( query_floor) && (pickup <= 1))986 if (((query_floor) || (!p_ptr->auto_pickup_okay)) && (pickup <= 1)) 902 987 { 903 988 /* Save screen */ … … 1591 1676 } 1592 1677 1593 /* Handle objects now. XXX XXX XXX */1594 p_ptr->energy_use += py_pickup(do_pickup) * 10;1595 1596 /*1597 * The correct thing to do is to pick up objects *after* the map1598 * display updates post-move. This involves about 30 lines of code1599 * and will be done on request. -LM-1600 */1601 1602 1678 1603 1679 /* Handle "store doors" */ … … 1613 1689 /* Free turn XXX XXX XXX */ 1614 1690 p_ptr->energy_use = 0; 1615 } 1691 1692 /* Handle objects now. XXX */ 1693 p_ptr->energy_use += py_pickup(do_pickup) * 10; 1694 } 1695 1696 /* All other grids (including traps) */ 1697 else 1698 { 1699 /* Handle objects (later) */ 1700 if (do_pickup) p_ptr->notice |= (PN_PICKUP1); 1701 else p_ptr->notice |= (PN_PICKUP0); 1702 } 1703 1616 1704 1617 1705 /* Discover invisible traps */ 1618 elseif (cave_feat[y][x] == FEAT_INVIS)1706 if (cave_feat[y][x] == FEAT_INVIS) 1619 1707 { 1620 1708 /* Disturb */ trunk/src/defines.h
r123 r137 1363 1363 #define SV_FOOD_PINT_OF_WINE 39 1364 1364 1365 /* The "sval" codes for TV_GOLD */ 1366 #define SV_COPPER1 1 1367 #define SV_COPPER2 2 1368 #define SV_COPPER3 3 1369 #define SV_SILVER1 4 1370 #define SV_SILVER2 5 1371 #define SV_SILVER3 6 1372 #define SV_GARNETS1 7 1373 #define SV_GARNETS2 8 1374 #define SV_GOLD1 9 1375 #define SV_GOLD2 10 1376 #define SV_GOLD3 11 1377 #define SV_OPALS 12 1378 #define SV_SAPPHIRES 13 1379 #define SV_RUBIES 14 1380 #define SV_DIAMONDS 15 1381 #define SV_EMERALDS 16 1382 #define SV_MITHRIL 17 1383 #define SV_ADAMANTITE 18 1384 1385 #define SV_GOLD_MAX 19 1386 1387 1365 1388 1366 1389 /* … … 1400 1423 */ 1401 1424 #define SQUELCH_NEVER 0 /* Allow pickup, defer to OPT_always_pickup */ 1402 #define NO_SQUELCH_NEVER_PICKUP 1 /* Never pickup, override OPT_always_pickup */ 1425 #define NO_SQUELCH_NEVER_PICKUP 1 /* Never pickup, override OPT_always_pickup */ 1403 1426 #define NO_SQUELCH_ALWAYS_PICKUP 2 /* Always pickup, override all other options */ 1404 1427 #define SQUELCH_ALWAYS 3 /* Destroy when player walks over */ … … 1576 1599 #define PN_REORDER 0x00000002L /* Reorder the pack */ 1577 1600 #define PN_AUTOINSCRIBE 0x00000004L /* Autoinscribe items */ 1601 #define PN_PICKUP0 0x00000008L /* Notice stuff (allow pickup) */ 1602 #define PN_PICKUP1 0x00000010L /* Pick up stuff */ 1578 1603 /* xxx (many) */ 1579 1604 trunk/src/dungeon.c
r136 r137 1262 1262 } 1263 1263 1264 /* Picking up objects */ 1265 else if (p_ptr->notice & (PN_PICKUP1)) 1266 { 1267 /* Recursively call the pickup function, use energy */ 1268 p_ptr->energy_use = py_pickup(1) * 10; 1269 p_ptr->notice &= ~(PN_PICKUP0 | PN_PICKUP1); 1270 } 1271 1272 /* Noticing objects (allow pickup) */ 1273 else if (p_ptr->notice & (PN_PICKUP0)) 1274 { 1275 /* Recursively call the pickup function, use energy */ 1276 p_ptr->energy_use = py_pickup(0) * 10; 1277 p_ptr->notice &= ~(PN_PICKUP0 | PN_PICKUP1); 1278 } 1279 1264 1280 /* Resting */ 1265 1281 else if (p_ptr->resting) … … 1455 1471 } 1456 1472 } 1473 1457 1474 while (!p_ptr->energy_use && !p_ptr->leaving); 1475 1476 1477 /* Allowed to automatically pick up things again */ 1478 p_ptr->auto_pickup_okay = TRUE; 1458 1479 } 1459 1480 trunk/src/randname.c
r116 r137 1 1 /* 2 * randname.c - random name generation3 * Copyright (c) 2007 Antony Sidwell and others,2 * File: randname.c 3 * Purpose: Random name generation 4 4 * Based on W. Sheldon Simms name generator originally in randart.c 5 5 * 6 * This file is distributed under the terms of both the Angband licence and 7 * under the GPL licence (version 2 or any later version). It may be 8 * redistributed under the terms of either licence. 6 * Copyright (c) 2007 Antony Sidwell and others 7 * 8 * This work is free software; you can redistribute it and/or modify it 9 * under the terms of either: 10 * 11 * a) the GNU General Public License as published by the Free Software 12 * Foundation, version 2, or 13 * 14 * b) the "Angband licence": 15 * This software may be copied and distributed for educational, research, 16 * and not for profit purposes provided that this copyright and statement 17 * are included in all such copies. Other copyrights may also apply. 9 18 */ 10 19 #include "angband.h" trunk/src/types.h
r117 r137 953 953 bool run_break_left; /* Looking for a break (left) */ 954 954 955 bool auto_pickup_okay; /* Allow automatic pickup */ 956 955 957 s16b command_cmd; /* Gives identity of current command */ 956 958 s16b command_arg; /* Gives argument of current command */
