hack.fix 3.3 KB

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