Changeset 110

Show
Ignore:
Timestamp:
05/04/07 13:43:35 (1 year ago)
Author:
takkaria
Message:

Lots of changes:

  • Fix nits from [91]. (some code from Pete Mack)
  • Reformat some code.
  • Move some constants to, and simplify, store.c
  • General Store moved to always stocking staples and nothing else -- there may be tweaking yet to do
  • Import Sangband's/Steamband's code to put chance of generating piles of items in object.txt
  • Simplify and genericise some more code in xtra1.c for subwindows and the status line
  • Update COPYING file with current licence information, incl. copy of the GPL
  • Add %b binary specifier to strnfmt for debugging purposes
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/COPYING

    r1 r110  
     1The game is currently moving to a dual-licence of the traditional Angband 
     2licence and the GPL, version 2.  All new code will only be accepted under both 
     3licences, but some code is still only under the Angband licence. 
     4 
     5At the time of release, almost all of the code is covered by both licences. 
     6The remaining people who have not yet been contacted include: 
     7 
     8 * Torbjorn Lindgren 
     9 * George W Harris 
     10 * John Rauser, monster list patch 
     11 * "Prfnoff" 
     12 * Ed Cogburn 
     13 * Peter Berger 
     14 * Roland Jay Roberts 
     15 * Ross E Becker 
     16 * Randy Hutson 
     17 * Brent Ross 
     18 * Kusunose Toru 
     19 * Takeshi Mogami 
     20 * Chris Ang 
     21 * Heiko Herold 
     22 * Jon Taylor 
     23 * Ron Anderson 
     24 * Alexander Wilkins 
     25 * David Grabiner 
     26 
     27Any information on the contact details for these people, whether online or 
     28otherwise, would be much appreciated. 
     29 
     30For more information, see <http://entai.co.uk/angband/opensource>. 
     31 
     32 
     33------------------------------------------------------------------------------ 
     34 
     35The Angband Licence is: 
     36 
    137Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke 
    238 
     
    541are included in all such copies.  Other copyrights may also apply. 
    642 
    7  
    8 All changes made by Ben Harrison, Robert Ruehlmann, and many other Angband 
    9 developers are also available under the GNU GENERAL PUBLIC LICENSE. 
    10 Note that this doesn't influence the current distribution, since parts of 
    11 the source are still only available under the old Moria/Angband license. 
    12 Until all parts of Angband are distributed under the GPL the only valid 
    13 license remains the original Moria/Angband license. 
    14  
    15 More informations about Angband and the GPL can be found at: 
    16 http://www.thangorodrim.net/development/opensource.html 
    17  
     43------------------------------------------------------------------------------ 
     44 
     45The GNU GENERAL PUBLIC LICENCE is: 
     46 
     47                    GNU GENERAL PUBLIC LICENSE 
     48                       Version 2, June 1991 
     49 
     50 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 
     51 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 
     52 Everyone is permitted to copy and distribute verbatim copies 
     53 of this license document, but changing it is not allowed. 
     54 
     55                            Preamble 
     56 
     57  The licenses for most software are designed to take away your 
     58freedom to share and change it.  By contrast, the GNU General Public 
     59License is intended to guarantee your freedom to share and change free 
     60software--to make sure the software is free for all its users.  This 
     61General Public License applies to most of the Free Software 
     62Foundation's software and to any other program whose authors commit to 
     63using it.  (Some other Free Software Foundation software is covered by 
     64the GNU Lesser General Public License instead.)  You can apply it to 
     65your programs, too. 
     66 
     67  When we speak of free software, we are referring to freedom, not 
     68price.  Our General Public Licenses are designed to make sure that you 
     69have the freedom to distribute copies of free software (and charge for 
     70this service if you wish), that you receive source code or can get it 
     71if you want it, that you can change the software or use pieces of it 
     72in new free programs; and that you know you can do these things. 
     73 
     74  To protect your rights, we need to make restrictions that forbid 
     75anyone to deny you these rights or to ask you to surrender the rights. 
     76These restrictions translate to certain responsibilities for you if you 
     77distribute copies of the software, or if you modify it. 
     78 
     79  For example, if you distribute copies of such a program, whether 
     80gratis or for a fee, you must give the recipients all the rights that 
     81you have.  You must make sure that they, too, receive or can get the 
     82source code.  And you must show them these terms so they know their 
     83rights. 
     84 
     85  We protect your rights with two steps: (1) copyright the software, and 
     86(2) offer you this license which gives you legal permission to copy, 
     87distribute and/or modify the software. 
     88 
     89  Also, for each author's protection and ours, we want to make certain 
     90that everyone understands that there is no warranty for this free 
     91software.  If the software is modified by someone else and passed on, we 
     92want its recipients to know that what they have is not the original, so 
     93that any problems introduced by others will not reflect on the original 
     94authors' reputations. 
     95 
     96  Finally, any free program is threatened constantly by software 
     97patents.  We wish to avoid the danger that redistributors of a free 
     98program will individually obtain patent licenses, in effect making the 
     99program proprietary.  To prevent this, we have made it clear that any 
     100patent must be licensed for everyone's free use or not licensed at all. 
     101 
     102  The precise terms and conditions for copying, distribution and 
     103modification follow. 
     104 
     105                    GNU GENERAL PUBLIC LICENSE 
     106   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 
     107 
     108  0. This License applies to any program or other work which contains 
     109a notice placed by the copyright holder saying it may be distributed 
     110under the terms of this General Public License.  The "Program", below, 
     111refers to any such program or work, and a "work based on the Program" 
     112means either the Program or any derivative work under copyright law: 
     113that is to say, a work containing the Program or a portion of it, 
     114either verbatim or with modifications and/or translated into another 
     115language.  (Hereinafter, translation is included without limitation in 
     116the term "modification".)  Each licensee is addressed as "you". 
     117 
     118Activities other than copying, distribution and modification are not 
     119covered by this License; they are outside its scope.  The act of 
     120running the Program is not restricted, and the output from the Program 
     121is covered only if its contents constitute a work based on the 
     122Program (independent of having been made by running the Program). 
     123Whether that is true depends on what the Program does. 
     124 
     125  1. You may copy and distribute verbatim copies of the Program's 
     126source code as you receive it, in any medium, provided that you 
     127conspicuously and appropriately publish on each copy an appropriate 
     128copyright notice and disclaimer of warranty; keep intact all the 
     129notices that refer to this License and to the absence of any warranty; 
     130and give any other recipients of the Program a copy of this License 
     131along with the Program. 
     132 
     133You may charge a fee for the physical act of transferring a copy, and 
     134you may at your option offer warranty protection in exchange for a fee. 
     135 
     136  2. You may modify your copy or copies of the Program or any portion 
     137of it, thus forming a work based on the Program, and copy and 
     138distribute such modifications or work under the terms of Section 1 
     139above, provided that you also meet all of these conditions: 
     140 
     141    a) You must cause the modified files to carry prominent notices 
     142    stating that you changed the files and the date of any change. 
     143 
     144    b) You must cause any work that you distribute or publish, that in 
     145    whole or in part contains or is derived from the Program or any 
     146    part thereof, to be licensed as a whole at no charge to all third 
     147    parties under the terms of this License. 
     148 
     149    c) If the modified program normally reads commands interactively 
     150    when run, you must cause it, when started running for such 
     151    interactive use in the most ordinary way, to print or display an 
     152    announcement including an appropriate copyright notice and a 
     153    notice that there is no warranty (or else, saying that you provide 
     154    a warranty) and that users may redistribute the program under 
     155    these conditions, and telling the user how to view a copy of this 
     156    License.  (Exception: if the Program itself is interactive but 
     157    does not normally print such an announcement, your work based on 
     158    the Program is not required to print an announcement.) 
     159 
     160These requirements apply to the modified work as a whole.  If 
     161identifiable sections of that work are not derived from the Program, 
     162and can be reasonably considered independent and separate works in 
     163themselves, then this License, and its terms, do not apply to those 
     164sections when you distribute them as separate works.  But when you 
     165distribute the same sections as part of a whole which is a work based 
     166on the Program, the distribution of the whole must be on the terms of 
     167this License, whose permissions for other licensees extend to the 
     168entire whole, and thus to each and every part regardless of who wrote it. 
     169 
     170Thus, it is not the intent of this section to claim rights or contest 
     171your rights to work written entirely by you; rather, the intent is to 
     172exercise the right to control the distribution of derivative or 
     173collective works based on the Program. 
     174 
     175In addition, mere aggregation of another work not based on the Program 
     176with the Program (or with a work based on the Program) on a volume of 
     177a storage or distribution medium does not bring the other work under 
     178the scope of this License. 
     179 
     180  3. You may copy and distribute the Program (or a work based on it, 
     181under Section 2) in object code or executable form under the terms of 
     182Sections 1 and 2 above provided that you also do one of the following: 
     183 
     184    a) Accompany it with the complete corresponding machine-readable 
     185    source code, which must be distributed under the terms of Sections 
     186    1 and 2 above on a medium customarily used for software interchange; or, 
     187 
     188    b) Accompany it with a written offer, valid for at least three 
     189    years, to give any third party, for a charge no more than your 
     190    cost of physically performing source distribution, a complete 
     191    machine-readable copy of the corresponding source code, to be 
     192    distributed under the terms of Sections 1 and 2 above on a medium 
     193    customarily used for software interchange; or, 
     194 
     195    c) Accompany it with the information you received as to the offer 
     196    to distribute corresponding source code.  (This alternative is 
     197    allowed only for noncommercial distribution and only if you 
     198    received the program in object code or executable form with such 
     199    an offer, in accord with Subsection b above.) 
     200 
     201The source code for a work means the preferred form of the work for 
     202making modifications to it.  For an executable work, complete source 
     203code means all the source code for all modules it contains, plus any 
     204associated interface definition files, plus the scripts used to 
     205control compilation and installation of the executable.  However, as a 
     206special exception, the source code distributed need not include 
     207anything that is normally distributed (in either source or binary 
     208form) with the major components (compiler, kernel, and so on) of the 
     209operating system on which the executable runs, unless that component 
     210itself accompanies the executable. 
     211 
     212If distribution of executable or object code is made by offering 
     213access to copy from a designated place, then offering equivalent 
     214access to copy the source code from the same place counts as 
     215distribution of the source code, even though third parties are not 
     216compelled to copy the source along with the object code. 
     217 
     218  4. You may not copy, modify, sublicense, or distribute the Program 
     219except as expressly provided under this License.  Any attempt 
     220otherwise to copy, modify, sublicense or distribute the Program is 
     221void, and will automatically terminate your rights under this License. 
     222However, parties who have received copies, or rights, from you under 
     223this License will not have their licenses terminated so long as such 
     224parties remain in full compliance. 
     225 
     226  5. You are not required to accept this License, since you have not 
     227signed it.  However, nothing else grants you permission to modify or 
     228distribute the Program or its derivative works.  These actions are 
     229prohibited by law if you do not accept this License.  Therefore, by 
     230modifying or distributing the Program (or any work based on the 
     231Program), you indicate your acceptance of this License to do so, and 
     232all its terms and conditions for copying, distributing or modifying 
     233the Program or works based on it. 
     234 
     235  6. Each time you redistribute the Program (or any work based on the 
     236Program), the recipient automatically receives a license from the 
     237original licensor to copy, distribute or modify the Program subject to 
     238these terms and conditions.  You may not impose any further 
     239restrictions on the recipients' exercise of the rights granted herein. 
     240You are not responsible for enforcing compliance by third parties to 
     241this License. 
     242 
     243  7. If, as a consequence of a court judgment or allegation of patent 
     244infringement or for any other reason (not limited to patent issues), 
     245conditions are imposed on you (whether by court order, agreement or 
     246otherwise) that contradict the conditions of this License, they do not 
     247excuse you from the conditions of this License.  If you cannot 
     248distribute so as to satisfy simultaneously your obligations under this 
     249License and any other pertinent obligations, then as a consequence you 
     250may not distribute the Program at all.  For example, if a patent 
     251license would not permit royalty-free redistribution of the Program by 
     252all those who receive copies directly or indirectly through you, then 
     253the only way you could satisfy both it and this License would be to 
     254refrain entirely from distribution of the Program. 
     255 
     256If any portion of this section is held invalid or unenforceable under 
     257any particular circumstance, the balance of the section is intended to 
     258apply and the section as a whole is intended to apply in other 
     259circumstances. 
     260 
     261It is not the purpose of this section to induce you to infringe any 
     262patents or other property right claims or to contest validity of any 
     263such claims; this section has the sole purpose of protecting the 
     264integrity of the free software distribution system, which is 
     265implemented by public license practices.  Many people have made 
     266generous contributions to the wide range of software distributed 
     267through that system in reliance on consistent application of that 
     268system; it is up to the author/donor to decide if he or she is willing 
     269to distribute software through any other system and a licensee cannot 
     270impose that choice. 
     271 
     272This section is intended to make thoroughly clear what is believed to 
     273be a consequence of the rest of this License. 
     274 
     275  8. If the distribution and/or use of the Program is restricted in 
     276certain countries either by patents or by copyrighted interfaces, the 
     277original copyright holder who places the Program under this License 
     278may add an explicit geographical distribution limitation excluding 
     279those countries, so that distribution is permitted only in or among 
     280countries not thus excluded.  In such case, this License incorporates 
     281the limitation as if written in the body of this License. 
     282 
     283  9. The Free Software Foundation may publish revised and/or new versions 
     284of the General Public License from time to time.  Such new versions will 
     285be similar in spirit to the present version, but may differ in detail to 
     286address new problems or concerns. 
     287 
     288Each version is given a distinguishing version number.  If the Program 
     289specifies a version number of this License which applies to it and "any 
     290later version", you have the option of following the terms and conditions 
     291either of that version or of any later version published by the Free 
     292Software Foundation.  If the Program does not specify a version number of 
     293this License, you may choose any version ever published by the Free Software 
     294Foundation. 
     295 
     296  10. If you wish to incorporate parts of the Program into other free 
     297programs whose distribution conditions are different, write to the author 
     298to ask for permission.  For software which is copyrighted by the Free 
     299Software Foundation, write to the Free Software Foundation; we sometimes 
     300make exceptions for this.  Our decision will be guided by the two goals 
     301of preserving the free status of all derivatives of our free software and 
     302of promoting the sharing and reuse of software generally. 
     303 
     304                            NO WARRANTY 
     305 
     306  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 
     307FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN 
     308OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 
     309PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 
     310OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
     311MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS 
     312TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE 
     313PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 
     314REPAIR OR CORRECTION. 
     315 
     316  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 
     317WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 
     318REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 
     319INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 
     320OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 
     321TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 
     322YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 
     323PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 
     324POSSIBILITY OF SUCH DAMAGES. 
     325 
     326                     END OF TERMS AND CONDITIONS 
     327 
     328            How to Apply These Terms to Your New Programs 
     329 
     330  If you develop a new program, and you want it to be of the greatest 
     331possible use to the public, the best way to achieve this is to make it 
     332free software which everyone can redistribute and change under these terms. 
     333 
     334  To do so, attach the following notices to the program.  It is safest 
     335to attach them to the start of each source file to most effectively 
     336convey the exclusion of warranty; and each file should have at least 
     337the "copyright" line and a pointer to where the full notice is found. 
     338 
     339    <one line to give the program's name and a brief idea of what it does.> 
     340    Copyright (C) <year>  <name of author> 
     341 
     342    This program is free software; you can redistribute it and/or modify 
     343    it under the terms of the GNU General Public License as published by 
     344    the Free Software Foundation; either version 2 of the License, or 
     345    (at your option) any later version. 
     346 
     347    This program is distributed in the hope that it will be useful, 
     348    but WITHOUT ANY WARRANTY; without even the implied warranty of 
     349    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     350    GNU General Public License for more details. 
     351 
     352    You should have received a copy of the GNU General Public License along 
     353    with this program; if not, write to the Free Software Foundation, Inc., 
     354    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
     355 
     356Also add information on how to contact you by electronic and paper mail. 
     357 
     358If the program is interactive, make it output a short notice like this 
     359when it starts in an interactive mode: 
     360 
     361    Gnomovision version 69, Copyright (C) year name of author 
     362    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 
     363    This is free software, and you are welcome to redistribute it 
     364    under certain conditions; type `show c' for details. 
     365 
     366The hypothetical commands `show w' and `show c' should show the appropriate 
     367parts of the General Public License.  Of course, the commands you use may 
     368be called something other than `show w' and `show c'; they could even be 
     369mouse-clicks or menu items--whatever suits your program. 
     370 
     371You should also get your employer (if you work as a programmer) or your 
     372school, if any, to sign a "copyright disclaimer" for the program, if 
     373necessary.  Here is a sample; alter the names: 
     374 
     375  Yoyodyne, Inc., hereby disclaims all copyright interest in the program 
     376  `Gnomovision' (which makes passes at compilers) written by James Hacker. 
     377 
     378  <signature of Ty Coon>, 1 April 1989 
     379  Ty Coon, President of Vice 
     380 
     381This General Public License does not permit incorporating your program into 
     382proprietary programs.  If your program is a subroutine library, you may 
     383consider it more useful to permit linking proprietary applications with the 
     384library.  If this is what you want to do, use the GNU Lesser General 
     385Public License instead of this License. 
  • trunk/lib/edit/object.txt

    r60 r110  
    2020# A: depth/rarity : depth/rarity : etc 
    2121# C: charges 
     22# M: chance of being generated in a pile : dice for number of items 
    2223# F: flag | flag | etc 
    2324# D: description 
     
    764765I:17:1:0 
    765766W:3:0:2:1 
     767M:100:6d7 
    766768A:3/1:15/1:50/1 
    767769P:0:1d4:0:0:0 
     
    774776W:55:0:2:20 
    775777A:55/2:80/2 
     778M:100:6d7 
    776779P:0:4d4:0:0:0 
    777780F:SHOW_MODS 
     
    782785I:18:1:0 
    783786W:3:0:3:2 
     787M:100:6d7 
    784788A:3/1:25/1:60/1 
    785789P:0:1d5:0:0:0 
     
    791795I:18:2:0 
    792796W:65:0:3:25 
     797M:100:6d7 
    793798A:65/2:90/2 
    794799P:0:4d5:0:0:0 
     
    800805I:16:0:0 
    801806W:0:0:4:1 
     807M:100:6d7 
    802808A:0/1:10/2 
    803809P:0:1d2:0:0:0 
     
    809815I:16:1:0 
    810816W:3:0:5:2 
     817M:100:6d7 
    811818A:3/1:40/2 
    812819P:0:1d4:0:0:0 
     
    31073114I:5:0:0 
    31083115W:1:0:10:1 
     3116M:100:6d7 
    31093117A:1/1 
    31103118P:0:1d1:0:0:0 
     
    39143922I:16:2:0 
    39153923W:40:0:4:20 
     3924M:100:6d7 
    39163925A:40/4:65/1 
    39173926P:0:2d4:5:5:0 
     
    39233932I:17:3:0 
    39243933W:55:0:2:25 
     3934M:100:6d7 
    39253935A:50/4:90/3 
    39263936P:0:3d4:0:0:0 
     
    39323942I:18:3:0 
    39333943W:50:0:2:30 
     3944M:100:6d7 
    39343945A:60/4:95/3 
    39353946P:0:3d5:0:0:0 
  • trunk/src/cmd4.c

    r104 r110  
    16551655} 
    16561656 
    1657 void do_cmd_resize() { 
     1657void do_cmd_resize() 
     1658
    16581659        /* Escape to main screen on resize */ 
    16591660        Term_key_push(ESCAPE); 
     
    17121713                                { 
    17131714                                        if (file_character(ftmp, FALSE)) 
    1714                                         { 
    17151715                                                msg_print("Character dump failed!"); 
    1716                                         } 
    17171716                                        else 
    1718                                         { 
    17191717                                                msg_print("Character dump successful."); 
    1720                                         } 
    17211718                                } 
    17221719                        } 
     
    17241721 
    17251722                /* Toggle mode */ 
    1726                 else if ((ke.key == 'h') || (ke.key == '\xff') || ke.key == '4') 
     1723                else if ((ke.key == 'h') || (ke.key == '\xff') || 
     1724                         (ke.key == ARROW_LEFT) || (ke.key == ' ')) 
    17271725                { 
    17281726                        mode = (mode + 1) % INFO_SCREENS; 
     
    17301728 
    17311729                /* Toggle mode */ 
    1732                 else if ((ke.key == 'l') || ke.key == '6'
    1733                 { 
    1734                         mode = (mode + 6 - 1) % INFO_SCREENS; 
     1730                else if ((ke.key == 'l') || ke.key == ARROW_RIGHT
     1731                { 
     1732                        mode = (mode - 1) % INFO_SCREENS; 
    17351733                } 
    17361734 
     
    17381736                /* Oops */ 
    17391737                else 
    1740                  
    1741                     bell(NULL); 
    1742                  
     1738               
     1739                       bell(NULL); 
     1740               
    17431741 
    17441742                /* Flush messages */ 
  • trunk/src/defines.h

    r82 r110  
    253253 * Store constants 
    254254 * 
    255  * Special note about STORE_MAX_KEEP; not only must it be below 
    256  * STORE_INVEN_MAX, it must actually be below (STORE_INVEN_MAX - maximum 
    257  * staple items across all stores); i.e. if the General Store has three 
    258  * staple items (and no other store has more than three staple items), 
    259  * then STORE_MAX_KEEP > (STORE_INVEN_MAX - 3), or > 21 (in this case). 
     255 * STORE_MAX_KEEP must be < STORE_INVEN_MAX. 
     256 * 
    260257 */ 
    261258#define STORE_INVEN_MAX 24              /* Max number of discrete objs in inven */ 
    262 #define STORE_OBJ_LEVEL 5               /* Magic Level for normal stores */ 
    263 #define STORE_TURNOVER  9               /* Normal shop turnover, per day */ 
    264 #define STORE_MIN_KEEP  6               /* Min slots to "always" keep full - 
    265                                            must be above 0 */ 
    266 #define STORE_MAX_KEEP  18              /* Max slots to "always" keep full */ 
     259#define STORE_TURNS             1000    /* Number of turns between turnovers */ 
    267260#define STORE_SHUFFLE   25              /* 1/Chance (per day) of an owner changing */ 
    268 #define STORE_TURNS             1000    /* Number of turns between turnovers */ 
    269261#define STORE_CHOICES   32              /* Number of choices in the store selection table */ 
    270262 
     
    489481#define SEX_MALE                1 
    490482 
    491  
    492 /*** Screen Locations ***/ 
    493  
    494 /* 
    495  * Some screen locations for various display routines 
    496  */ 
    497 #define ROW_HUNGRY              (Term->hgt - 1) 
    498 #define COL_HUNGRY              0       /* "Weak" / "Hungry" / "Full" / "Gorged" */ 
    499  
    500 #define ROW_BLIND               (Term->hgt - 1) 
    501 #define COL_BLIND               7       /* "Blind" */ 
    502  
    503 #define ROW_CONFUSED    (Term->hgt - 1) 
    504 #define COL_CONFUSED    13      /* "Confused" */ 
    505  
    506 #define ROW_AFRAID              (Term->hgt - 1) 
    507 #define COL_AFRAID              22      /* "Afraid" */ 
    508  
    509 #define ROW_POISONED    (Term->hgt - 1) 
    510 #define COL_POISONED    29      /* "Poisoned" */ 
    511  
    512 #define ROW_STATE               (Term->hgt - 1) 
    513 #define COL_STATE               38      /* <state> */ 
    514  
    515 #define ROW_SPEED               (Term->hgt - 1) 
    516 #define COL_SPEED               49      /* "Slow (-NN)" or "Fast (+NN)" */ 
    517  
    518 #define ROW_STUDY               (Term->hgt - 1) 
    519 #define COL_STUDY               64      /* "Study" */ 
    520  
    521 #define ROW_DEPTH               (Term->hgt - 1) 
    522 #define COL_DEPTH               70      /* "Lev NNN" / "NNNN ft" */ 
    523  
    524 #define ROW_OPPOSE_ELEMENTS     (Term->hgt - 1) 
    525 #define COL_OPPOSE_ELEMENTS     80      /* "Acid Elec Fire Cold Pois" */ 
    526483 
    527484 
     
    16671624 
    16681625/* 
    1669  * Bit flags for the "p_ptr->window" variable (etc) 
     1626 * Bit flags for the "p_ptr->window" variable. 
    16701627 */ 
    16711628#define PW_INVEN            0x00000001L /* Display inven/equip */ 
     
    16811638#define PW_MONLIST          0x00000400L /* Display monster list */ 
    16821639#define PW_STATUS           0x00000800L /* Display status */ 
    1683 #define PW_SCRIPT_VARS      0x00001000L /* Display script variables */ 
    1684 #define PW_SCRIPT_SOURCE    0x00002000L /* Display script source */ 
     1640/* xxx */ 
    16851641#define PW_BORG_1           0x00004000L /* Display borg messages */ 
    16861642#define PW_BORG_2           0x00008000L /* Display borg status */ 
  • trunk/src/init1.c

    r103 r110  
    14121412                        return (PARSE_ERROR_GENERIC); 
    14131413                } 
     1414        } 
     1415 
     1416        /* Process 'M' for "Multiple quantity" (one line only) */ 
     1417        else if (buf[0] == 'M') 
     1418        { 
     1419                int prob, dice, side; 
     1420 
     1421                /* There better be a current k_ptr */ 
     1422                if (!k_ptr) return (PARSE_ERROR_MISSING_RECORD_HEADER); 
     1423 
     1424                /* Scan for the values */ 
     1425                if (3 != sscanf(buf+2, "%d:%dd%d", &prob, &dice, &side)) 
     1426                        return (PARSE_ERROR_GENERIC); 
     1427 
     1428                /* Sanity check */ 
     1429                if (!(dice * side)) prob = dice = side = 0; 
     1430 
     1431                /* Save the values */ 
     1432                k_ptr->gen_mult_prob = prob; 
     1433                k_ptr->gen_dice = dice; 
     1434                k_ptr->gen_side = side; 
    14141435        } 
    14151436 
  • trunk/src/object2.c

    r86 r110  
    29042904{ 
    29052905        int prob, base; 
     2906        object_kind *k_ptr; 
    29062907 
    29072908 
     
    29512952        apply_magic(j_ptr, object_level, TRUE, good, great); 
    29522953 
    2953         /* Hack -- generate multiple spikes/missiles */ 
    2954         switch (j_ptr->tval) 
    2955         { 
    2956                 case TV_SPIKE: 
    2957                 case TV_SHOT: 
    2958                 case TV_ARROW: 
    2959                 case TV_BOLT: 
    2960                 { 
    2961                         j_ptr->number = damroll(6, 7); 
    2962                 } 
    2963         } 
     2954 
     2955        /* Generate multiple items */ 
     2956        /* Imported from Steamband and Sangband */ 
     2957        /* XXX Will probably not work so well for stacks of potions (yet) */ 
     2958        k_ptr = &k_info[j_ptr->k_idx]; 
     2959 
     2960        if (k_ptr->gen_mult_prob >= 100 || 
     2961            k_ptr->gen_mult_prob >= randint(100)) 
     2962        { 
     2963                j_ptr->number = damroll(k_ptr->gen_dice, k_ptr->gen_side); 
     2964        } 
     2965 
    29642966 
    29652967        /* Notice "okay" out-of-depth objects */ 
  • trunk/src/randname.c

    r42 r110  
    281281        assert(name_type > 0 && name_type < RANDNAME_NUM_TYPES); 
    282282 
    283         /* To allow for a terminating character */ 
     283       /* To allow for a terminating character */ 
    284284        assert(buflen > max); 
    285285 
  • trunk/src/store.c

    <
    r102 r110  
    4343/* Compound flag for the initial display of a store */ 
    4444#define STORE_INIT_CHANGE               (STORE_FRAME_CHANGE | STORE_GOLD_CHANGE) 
     45 
     46 
     47 
     48/* Some local constants */ 
     49#define STORE_TURNOVER  9       /* Normal shop turnover, per day */ 
     50#define STORE_OBJ_LEVEL 5       /* Magic Level for normal stores */ 
     51#define STORE_MIN_KEEP  6       /* Min slots to "always" keep full (>0) */ 
     52#define STORE_MAX_KEEP  18      /* Max slots to "always" keep full */ 
     53 
    4554 
    4655 
     
    389398 * "greed" value is always something (?). 
    390399 */ 
    391 static s32b price_item(const object_type *o_ptr, bool flip
     400static s32b price_item(const object_type *o_ptr, bool store_buying
    392401{ 
    393402        int factor; 
     
    416425 
    417426        /* Shop is buying */ 
    418         if (flip
     427        if (store_buying
    419428        { 
    420429                /* Adjust for greed */ 
     
    426435                /* Mega-Hack -- Black market sucks */ 
    427436                if (store_current == STORE_B_MARKET) price = price / 2; 
     437 
     438                /* Now limit the price to the purse limit */ 
     439                if (price > ot_ptr->max_cost) price = ot_ptr->max_cost; 
    428440        } 
    429441 
     
    11391151 
    11401152/* 
    1141  * Helper function: create an item with the given tval,sval pair, add it to the 
    1142  * store st.  Return the slot in the inventory. 
    1143  */ 
    1144 static int store_create_item(int st, int tval, int sval) 
    1145 { 
    1146         object_type object; 
    1147         int k_idx; 
    1148  
    1149         /* Resolve tval,sval pair into an index */ 
    1150         k_idx = lookup_kind(tval, sval); 
    1151  
    1152         /* Validation - do something more substantial here? XXX */ 
    1153         if (!k_idx) 
    1154         { 
    1155                 msg_print("No object in store_create_item()."); 
    1156                 return -1; 
    1157         } 
    1158  
    1159         /* Wipe this object */ 
    1160         object_wipe(&object); 
    1161  
    1162         /* Create a new object of the chosen kind */ 
    1163         object_prep(&object, k_idx); 
    1164  
    1165         /* The object is "known" */ 
    1166         object_known(&object); 
    1167  
    1168         /* Item belongs to a store */ 
    1169         object.ident |= IDENT_STORE; 
    1170  
    1171         /* Charge lights */ 
    1172         if (object.tval == TV_LITE) 
    1173         { 
    1174                 if (object.sval == SV_LITE_TORCH)        object.timeout = FUEL_TORCH / 2; 
    1175                 else if (object.sval == SV_LITE_LANTERN) object.timeout = FUEL_LAMP / 2; 
    1176         } 
    1177  
    1178         /* Mass produce and/or apply discount */ 
    1179         mass_produce(&object); 
    1180  
    1181         /* Attempt to carry the object */ 
    1182         return store_carry(st, &object); 
    1183 } 
    1184  
    1185 /* 
    11861153 * Find tval, sval from k_idx. 
    11871154 * XXX Should be in object2.c; is here for low impact. 
     
    13221289} 
    13231290 
    1324  
    1325 static struct 
    1326 
    1327         int store; 
    1328         int tval; 
    1329         int sval; 
    1330         int likelihood; 
     1291/* 
     1292 * Staple definitions. 
     1293 */ 
     1294typedef enum { MAKE_SINGLE, MAKE_NORMAL, MAKE_MAX } create_mode; 
     1295 
     1296static struct staple_type 
     1297
     1298        int tval, sval; 
     1299        create_mode mode; 
    13311300} staples[] = 
    13321301{ 
    1333         { STORE_GENERAL, TV_FOOD,  SV_FOOD_RATION, 100 }, 
    1334         { STORE_GENERAL, TV_LITE,  SV_LITE_TORCH,  100 }, 
    1335         { STORE_ALCHEMY, TV_SCROLL, SV_SCROLL_WORD_OF_RECALL, 100 }, 
     1302        { TV_FOOD, SV_FOOD_RATION, MAKE_NORMAL }, 
     1303        { TV_LITE, SV_LITE_TORCH, MAKE_NORMAL }, 
     1304        { TV_SCROLL, SV_SCROLL_WORD_OF_RECALL, MAKE_NORMAL }, 
     1305        { TV_FOOD, SV_FOOD_BISCUIT, MAKE_NORMAL }, 
     1306        { TV_FOOD, SV_FOOD_JERKY, MAKE_NORMAL }, 
     1307        { TV_FOOD, SV_FOOD_PINT_OF_WINE, MAKE_NORMAL }, 
     1308        { TV_LITE, SV_LITE_TORCH, MAKE_NORMAL }, 
     1309        { TV_LITE, SV_LITE_LANTERN, MAKE_NORMAL }, 
     1310        { TV_FLASK, 0, MAKE_NORMAL }, 
     1311        { TV_SPIKE, 0, MAKE_NORMAL }, 
     1312        { TV_SHOT, SV_AMMO_NORMAL, MAKE_MAX }, 
     1313        { TV_ARROW, SV_AMMO_NORMAL, MAKE_MAX }, 
     1314        { TV_BOLT, SV_AMMO_NORMAL, MAKE_MAX }, 
     1315        { TV_DIGGING, SV_SHOVEL, MAKE_SINGLE }, 
     1316        { TV_DIGGING, SV_PICK, MAKE_SINGLE }, 
     1317        { TV_CLOAK, SV_CLOAK, MAKE_SINGLE } 
    13361318}; 
    13371319 
     1320 
     1321/* 
     1322 * Helper function: create an item with the given tval,sval pair, add it to the 
     1323 * store st.  Return the slot in the inventory. 
     1324 */ 
     1325static int store_create_item(int st, int tval, int sval, create_mode mode) 
     1326{ 
     1327        object_type object; 
     1328        int k_idx; 
     1329 
     1330        /* Resolve tval,sval pair into an index */ 
     1331        k_idx = lookup_kind(tval, sval); 
     1332 
     1333        /* Validation - do something more substantial here? XXX */ 
     1334        if (!k_idx) 
     1335        { 
     1336                msg_print("No object in store_create_item()."); 
     1337                return -1; 
     1338        } 
     1339 
     1340        /* Wipe this object */ 
     1341        object_wipe(&object); 
     1342 
     1343        /* Create a new object of the chosen kind */ 
     1344        object_prep(&object, k_idx); 
     1345 
     1346        /* The object is "known" */ 
     1347        object_known(&object); 
     1348 
     1349        /* Item belongs to a store */ 
     1350        object.ident |= IDENT_STORE; 
     1351 
     1352        /* Charge lights */ 
     1353        if (object.tval == TV_LITE) 
     1354        { 
     1355                if (object.sval == SV_LITE_TORCH)        object.timeout = FUEL_TORCH / 2; 
     1356                else if (object.sval == SV_LITE_LANTERN) object.timeout = FUEL_LAMP / 2; 
     1357        } 
     1358 
     1359        /* Make according to mode */ 
     1360        switch (mode) 
     1361        { 
     1362                case MAKE_SINGLE: 
     1363                        break; 
     1364 
     1365                case MAKE_NORMAL: 
     1366                        mass_produce(&object); 
     1367                        break; 
     1368 
     1369                case MAKE_MAX: 
     1370                        object.number = 99; 
     1371                        break; 
     1372        } 
     1373 
     1374        /* Attempt to carry the object */ 
     1375        return store_carry(st, &object); 
     1376} 
     1377 
     1378 
     1379 
    13381380/* 
    13391381 * Create all staple items. 
    1340  */ 
    1341 static void store_create_staples(int st) 
    1342 
    1343         int i, which, prob; 
     1382 * 
     1383 * XXX should ensure that entries marked as "max" stay in stock 
     1384 */ 
     1385static void store_create_staples(void) 
     1386
     1387        unsigned i; 
    13441388 
    13451389        /* Iterate through staples */ 
    1346         for (i = 0; (unsigned int) i < N_ELEMENTS(staples); i++) 
    1347         { 
    1348                 /* Ignore this one */ 
    1349                 if (staples[i].store != st) continue; 
    1350  
    1351                 /* Find this staple */ 
    1352                 which = store_find(st, staples[i].tval, staples[i].sval); 
    1353  
    1354                 /* Not found */ 
    1355                 if (which == -1) 
    1356                 { 
    1357                         prob = rand_int(100); 
    1358  
    1359                         /* Create the item */ 
    1360                         if (prob <= staples[i].likelihood) 
    1361                                 store_create_item(st, staples[i].tval, staples[i].sval); 
    1362                 } 
    1363  
    1364                 /* In future, do something like ensuring the size of the stack of staples is high enough - take note of mass_roll */ 
    1365         } 
    1366 
     1390        for (i = 0; i < N_ELEMENTS(staples); i++) 
     1391        { 
     1392                struct staple_type *s = &staples[i]; 
     1393 
     1394                /* Look for the item, and if it isn't there, create it */ 
     1395                if (store_find(STORE_GENERAL, s->tval, s->sval) == -1) 
     1396                        store_create_item(STORE_GENERAL, s->tval, s->sval, s->mode); 
     1397        } 
     1398
     1399 
     1400 
    13671401 
    13681402/* 
     
    13811415        /* Ignore home */ 
    13821416        if (which == STORE_HOME) return; 
     1417 
     1418        /* General Store gets special treatment */ 
     1419        if (which == STORE_GENERAL) 
     1420        { 
     1421                store_create_staples(); 
     1422                return; 
     1423        } 
    13831424 
    13841425 
     
    14211462        /*** "Buy in" various items */ 
    14221463 
    1423         /* Ensure all staple items are present */ 
    1424         store_create_staples(which); 
    1425  
    14261464        /* Buy a few items */ 
    14271465        stock = st_ptr->stock_num; 
     
    16161654 
    16171655        /* Show weights */ 
     1656        colour = curs_attrs[CURS_KNOWN][(int)cursor]; 
    16181657        strnfmt(out_val, sizeof out_val, "%3d.%d lb", o_ptr->weight / 10, o_ptr->weight % 10); 
    1619         put_str(out_val, row, scr_places_x[LOC_WEIGHT]); 
     1658        c_put_str(colour, out_val, row, scr_places_x[LOC_WEIGHT]); 
    16201659 
    16211660        /* Describe an object (fully) in a store */ 
     
    16261665 
    16271666                /* Make sure the player can afford it */ 
    1628                 if ((unsigned int) p_ptr->au < (unsigned int) x) 
    1629                         colour = TERM_SLATE; 
    1630                 else 
    1631                         colour = TERM_WHITE; 
     1667                if ((int) p_ptr->au < (int) x) 
     1668                        colour = curs_attrs[CURS_UNKNOWN][(int)cursor]; 
    16321669 
    16331670                /* Actually draw the price */ 
     
    22392276 
    22402277        /* Describe it fully */ 
     2278        Term_erase(0, 0, 255); 
     2279        Term_gotoxy(0, 0); 
    22412280        object_info_screen(o_ptr); 
    22422281} 
     
    23172356static bool store_process_command(char cmd, void *db, int oid) 
    23182357{ 
    2319         (void)db
     2358        bool equip_toggle = FALSE
    23202359 
    23212360        /* Parse the command */ 
     
    23312370                /* Sell */ 
    23322371                case 's': 
     2372                case 'd': 
    23332373                { 
    23342374                        store_sell(); 
     
    23502390                /* Examine */ 
    23512391                case 'l': 
     2392                case 'x': 
    23522393                { 
    23532394                        store_examine(oid); 
     
    23942435                case 'e': 
    23952436                { 
    2396                         do_cmd_equip(); 
    2397                         break; 
     2437                        equip_toggle = TRUE; 
    23982438                } 
    23992439 
     
    24012441                case 'i':