home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / alt / games / gb / 1357 < prev    next >
Encoding:
Text File  |  1992-12-22  |  2.2 KB  |  82 lines

  1. Path: sparky!uunet!cs.utexas.edu!gateway
  2. From: deragon@JETHRO.CS.NYU.EDU (John Deragon)
  3. Newsgroups: alt.games.gb
  4. Subject: Serious Bug fix....
  5. Date: 22 Dec 1992 03:35:47 -0600
  6. Organization: UTexas Mail-to-News Gateway
  7. Lines: 70
  8. Sender: daemon@cs.utexas.edu
  9. Message-ID: <9212220933.AA14064@JETHRO.CS.NYU.EDU>
  10. NNTP-Posting-Host: cs.utexas.edu
  11.  
  12.  
  13.     The following is a context diff patch for the file shlmisc.c
  14. It corrects a SERIOUS bug in the current GB version (GB5.2).  
  15.  
  16.  
  17.     OVERVIEW:
  18.  
  19.     If you scrap a ship, it will kill the ship (ie: set the alive flag 
  20. to false), but it will not remove it from the linked list until an 
  21. update occurs.  Therefore, the dead ship will remain around, if you scrap
  22. the same ship again, it will get a list of the ships via do_shiplist
  23. and the now dead ship will still exist in the list.  This totally screws
  24. things up, and you will end up scrapping whatever ship the nextship 
  25. struct member points to. 
  26.  
  27.  
  28.     FIX:
  29.  
  30.     Basically, this is a serious bug.  I seriously recommend patching
  31. your shlmisc.c file if you have it.  It is basically a two line fix
  32.  
  33.  
  34.     do_shiplist(...) 
  35.     
  36.         if (!(*s)->alive))
  37.             return 0;
  38.  
  39.     but I did some additional formatting in that function for clarity.
  40. This is only a temporary fix, I plan to clean this whole shiplist crap
  41. up ALOT.  This way is pretty stupid.  
  42.  
  43.     Thanks for Valheru (ninja@halcyon.com) for pointing this one out
  44.  
  45.  
  46.     -- Seeker    
  47.  
  48. -------------- BEGIN CONTEXT DIFF -------------
  49.  
  50. *** shlmisc.c   Tue Dec 22 03:45:17 1992
  51. --- old/shlmisc.c       Tue Dec 22 03:41:15 1992
  52. ***************
  53. *** 333,348 ****
  54.   int do_shiplist(shiptype **s, int *nextshipno)
  55.   {
  56.       int shipno;
  57.  
  58. !     if (!(shipno = *nextshipno))
  59. !               return 0;
  60. !
  61. !     if (!getship(s, shipno))  /* allocate memory, free in loop */
  62. !               return 0;
  63. !
  64. !       if (!(*s)->alive)) /* this prevents it from returning a dead ship */
  65. !               return 0;      /* ie: try to scrap a dead ship   JPD          */
  66. !
  67.       *nextshipno = (*s)->nextship;
  68.       return shipno;
  69.   }
  70. --- 333,343 ----
  71.   int do_shiplist(shiptype **s, int *nextshipno)
  72.   {
  73.       int shipno;
  74. +     if(!(shipno = *nextshipno))
  75. +       return 0;
  76.  
  77. !     if(!getship(s, shipno))   /* allocate memory, free in loop */
  78. !       return 0;
  79.       *nextshipno = (*s)->nextship;
  80.       return shipno;
  81.   }
  82.