1 $NetBSD: hack.fix,v 1.2 1995/03/23 08:30:17 cgd Exp $
3 /***** unido:net.games.hack / ab / 7:23 pm Sep 13, 1985*/
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:
12 1. You have to rob a shop in order to make the shopkeeper
15 2. After leaving the shop being followed by the shopkeeper
16 you must return to the shop...
18 3. ...and then leave the unguarded shop again.
19 - The shopkeeper mustn't be present!
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.
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.
32 Andreas Bormann ab@unido.UUCP
33 University of Dortmund N 51 29' 05" E 07 24' 42"
36 ------ the diff follows:
38 *** hack.shk.c.orig Sun Aug 4 12:07:51 1985
39 --- hack.shk.c Fri Sep 13 14:29:52 1985
42 /* Did we just leave a shop? */
44 (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) {
47 if(ESHK(shopkeeper)->billct) {
48 pline("Somehow you escaped the shop without paying!");
51 /* Did we just leave a shop? */
53 (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) {
55 if(ESHK(shopkeeper)->billct) {
56 if(inroom(shopkeeper->mx, shopkeeper->my)
61 if(ESHK(shopkeeper)->billct) {
62 ! pline("Somehow you escaped the shop without paying!");
64 pline("You stole for a total worth of %ld zorkmids.",
68 (u.uinshop != roomno + 1 || shlevel != dlevel || !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!");
75 pline("You stole for a total worth of %ld zorkmids.",
84 /* Did we just enter a zoo of some kind? */
93 /* Did we just enter a zoo of some kind? */
98 rooms[roomno].rtype = 0;
100 - } else if(inroom(shopkeeper->mx, shopkeeper->my) != roomno) {
102 } else if(!u.uinshop){
103 if(!ESHK(shopkeeper)->visitct ||
108 rooms[roomno].rtype = 0;
110 } else if(!u.uinshop){
111 if(!ESHK(shopkeeper)->visitct ||