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 occured in the onbill-routine. After investigating the core
5 dump I found that the shopkeeper's bill was still to be paid. Normaly
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
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.
30 Andreas Bormann ab@unido.UUCP
31 University of Dortmund N 51 29' 05" E 07 24' 42"
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
40 /* Did we just leave a shop? */
42 (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) {
45 if(ESHK(shopkeeper)->billct) {
46 pline("Somehow you escaped the shop without paying!");
49 /* Did we just leave a shop? */
51 (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) {
53 if(ESHK(shopkeeper)->billct) {
54 if(inroom(shopkeeper->mx, shopkeeper->my)
59 if(ESHK(shopkeeper)->billct) {
60 ! pline("Somehow you escaped the shop without paying!");
62 pline("You stole for a total worth of %ld zorkmids.",
66 (u.uinshop != roomno + 1 || shlevel != dlevel || !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!");
73 pline("You stole for a total worth of %ld zorkmids.",
82 /* Did we just enter a zoo of some kind? */
91 /* Did we just enter a zoo of some kind? */
96 rooms[roomno].rtype = 0;
98 - } else if(inroom(shopkeeper->mx, shopkeeper->my) != roomno) {
100 } else if(!u.uinshop){
101 if(!ESHK(shopkeeper)->visitct ||
106 rooms[roomno].rtype = 0;
108 } else if(!u.uinshop){
109 if(!ESHK(shopkeeper)->visitct ||