w(1): Limit affect of locale change
[dragonfly.git] / games / hack / hack.fix
blob9e41c32630e357ff08b75f73be63083b8928b044
1 /***** unido:net.games.hack / ab /  7:23 pm  Sep 13, 1985*/
3 Recently hack (1.0.3) crashed with core dumps during some good games.
4 The crashes occurred in the onbill-routine. After investigating the core
5 dump I found that the shopkeeper's bill was still to be paid.  Normally
6 if you leave a shop the bill will be cleared and onbill() would not
7 check it. But under certain conditions you can leave a shop without
8 clearing the bill. The conditions are:
10      1. You have to rob a shop in order to make the shopkeeper
11         follow you.
13      2. After leaving the shop being followed by the shopkeeper
14         you must return to the shop...
16      3. ...and then leave the unguarded shop again.
17         - The shopkeeper mustn't be present!
19 If you climb the stairs to the previous level, chances are that your
20 bill now contains much more items than allowed. If so the next call to
21 onbill() will dump the core.
23 Following is a context diff to fix the bug. Actually just the last hunk
24 does the fix [it deletes two lines which have been inserted in 1.0.3],
25 but I think the other fix was intended by the now deleted lines.
27         Andreas
30 Andreas Bormann                 ab@unido.UUCP
31 University of Dortmund          N 51 29' 05"   E 07 24' 42"
32 West Germany
34 ------ the diff follows:
36 *** hack.shk.c.orig     Sun Aug  4 12:07:51 1985
37 --- hack.shk.c  Fri Sep 13 14:29:52 1985
38 ***************
39 *** 133,139
40         /* Did we just leave a shop? */
41         if(u.uinshop &&
42             (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) {
43 -               u.uinshop = 0;
44                 if(shopkeeper) {
45                     if(ESHK(shopkeeper)->billct) {
46                         pline("Somehow you escaped the shop without paying!");
48 --- 133,138 -----
49         /* Did we just leave a shop? */
50         if(u.uinshop &&
51             (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) {
52                 if(shopkeeper) {
53                     if(ESHK(shopkeeper)->billct) {
54                         if(inroom(shopkeeper->mx, shopkeeper->my) 
55 ***************
56 *** 136,142
57                 u.uinshop = 0;
58                 if(shopkeeper) {
59                     if(ESHK(shopkeeper)->billct) {
60 !                       pline("Somehow you escaped the shop without paying!");
61                         addupbill();
62                         pline("You stole for a total worth of %ld zorkmids.",
63                                 total);
65 --- 135,143 -----
66             (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) {
67                 if(shopkeeper) {
68                     if(ESHK(shopkeeper)->billct) {
69 !                       if(inroom(shopkeeper->mx, shopkeeper->my) 
70 !                           == u.uinshop - 1)   /* ab@unido */
71 !                           pline("Somehow you escaped the shop without paying!");
72                         addupbill();
73                         pline("You stole for a total worth of %ld zorkmids.",
74                                 total);
75 ***************
76 *** 149,154
77                     shopkeeper = 0;
78                     shlevel = 0;
79                 }
80         }
81   
82         /* Did we just enter a zoo of some kind? */
84 --- 150,156 -----
85                     shopkeeper = 0;
86                     shlevel = 0;
87                 }
88 +               u.uinshop = 0;
89         }
90   
91         /* Did we just enter a zoo of some kind? */
92 ***************
93 *** 183,190
94                 findshk(roomno);
95             if(!shopkeeper) {
96                 rooms[roomno].rtype = 0;
97 -               u.uinshop = 0;
98 -           } else if(inroom(shopkeeper->mx, shopkeeper->my) != roomno) {
99                 u.uinshop = 0;
100             } else if(!u.uinshop){
101                 if(!ESHK(shopkeeper)->visitct ||
103 --- 185,190 -----
104                 findshk(roomno);
105             if(!shopkeeper) {
106                 rooms[roomno].rtype = 0;
107                 u.uinshop = 0;
108             } else if(!u.uinshop){
109                 if(!ESHK(shopkeeper)->visitct ||
110 /* ---------- */