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