[comp.sources.d] Another Bug Fix to Empire 1.1

jld#@andrew.cmu.edu.UUCP (04/23/87)

	The fix to update.c that corrects the "rolling civilians" bug brings
out another bug in update.c.
	It should only do an update of a sector if the last time that sector
was updated is < the current turn number, not <=. The <= causes the program
go into infinite recursion if there is a loop in delivery routes (even if
each path of the loop is a different item).
	Below is a diff of the update.c file which shows both bug fixes (both
are one line changes).

*** update.old	Thu Apr 23 17:11:59 1987
--- update.c	Thu Apr 23 17:49:37 1987
***************
*** 31,37
          verbose = selup & UP_VERBOSE;
          quiet = selup & UP_QUIET;
          if( sect.sct_lstup == 0 ) return(0);
!         if( sect.sct_lstup <= curup ) goto X160;
          sect.sct_lstup = curup;
          return(1);
  X160:   

--- 31,37 -----
          verbose = selup & UP_VERBOSE;
          quiet = selup & UP_QUIET;
          if( sect.sct_lstup == 0 ) return(0);
!         if( sect.sct_lstup < curup ) goto X160;
          sect.sct_lstup = curup;
          return(1);
  X160:   
***************
*** 197,203
          amt = funit * q;
          shipper = sect.sct_owned;
          putsect(x, y);
!         if( getsect(dx, dy, UP_NONE) == -1 ) goto X3404;
          if( shipper == sect.sct_owned ) goto X3612;
          if( sect.sct_chkpt != 0 ) goto X3612;
  X3404:  

--- 197,203 -----
          amt = funit * q;
          shipper = sect.sct_owned;
          putsect(x, y);
!         if( getsect(dx, dy, UP_TIME | UP_ALL) == -1 ) goto X3404;
          if( shipper == sect.sct_owned ) goto X3612;
          if( sect.sct_chkpt != 0 ) goto X3612;
  X3404:  


Jay Davis
jld@andrew.cmu.edu

tsf@drutx.ATT.COM (FisherTS) (04/24/87)

Be careful with those fixes to the rolling civilians bug.
As Jay pointed out, the first attempt causes a recursion problem
if two sectors deliver civvies to each other.  This second attempt
will follow a civilian delivery chain into an area where a hurricane
could be lurking or plague might be starting.  And if enough sectors
are involved, I think the stack could be blown on some machines.

I fixed this problem in Version 1.2 after experimenting with
several ideas.  It might not be perfect, but it doesn't seem to
be wildly recursive or have unexpected side effects.  I think the
Version 1.2 fix involves adding a define to emp.h and a few lines
in update.c.  If you have 1.1, use the 1.1-1.2 conversion script
to get the fix.

In general, don't mess with update.c.  It's fragile, and more than
once I've been surprised by unexpected side effects.

If you must change these sensitive routines, please rename your version
to something other than 1.1 or 1.2 so I don't get it confused with
something I sent out.  Thanks.

Tom Fisher	ihnp4!drutx!tsf

wv@whuts.UUCP (04/30/87)

In article <3685@drutx.ATT.COM> tsf@drutx.ATT.COM (FisherTS) writes:
>If you have 1.1, use the 1.1-1.2 conversion script
>to get the fix.
>Tom Fisher	ihnp4!drutx!tsf

Where can I get a copy of the conversion script? Is it short enough
to post or email ?

					Bill Duncan   ihnp4!mvuxi!wv

abc@mcnc.UUCP (Alan B. Clegg) (05/04/87)

In article <187@whuts.UUCP> wv@whuts.UUCP (54299-DUNCAN,W.) writes:
>In article <3685@drutx.ATT.COM> tsf@drutx.ATT.COM (FisherTS) writes:
>>If you have 1.1, use the 1.1-1.2 conversion script to get the fix.
>Where can I get a copy of the conversion script? Is it short enough
>to post or email ?

The conversion upg1.1-1.2 is available via anonymous uucp and ftp from
ncsuvx.ncsu.edu.  If you are interested, please send me mail and I will
give you information on dialing up.

-abc

msj@gitpyr.UUCP (05/06/87)

In article <493@speedy.mcnc.UUCP> abc@speedy.UUCP (Alan B. Clegg) writes:
>In article <187@whuts.UUCP> wv@whuts.UUCP (54299-DUNCAN,W.) writes:
>>In article <3685@drutx.ATT.COM> tsf@drutx.ATT.COM (FisherTS) writes:
>>>If you have 1.1, use the 1.1-1.2 conversion script to get the fix.
>>Where can I get a copy of the conversion script? Is it short enough
>>to post or email ?
>
>The conversion upg1.1-1.2 is available via anonymous uucp and ftp from
>ncsuvx.ncsu.edu.  If you are interested, please send me mail and I will
>give you information on dialing up.

Except that as of last night, the copy at ncsuvx is trashed.  I ftp'd it to another system, uncompressed it and
found the bottom half of it trashed.  Mike
/msj/
-- 
Mike St. Johns
Georgia Insitute of Technology, Atlanta Georgia, 30332
...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!gitpyr!msj
StJohns@MIT-Multics.ARPA  (404) 982-0035

abc@mcnc.UUCP (05/06/87)

In article <3539@gitpyr.gatech.EDU> msj@gitpyr.gatech.edu (Mike St. Johns) writes:
..>In article <493@speedy.mcnc.UUCP> abc@speedy.UUCP (Alan B. Clegg) writes:
..>>In article <187@whuts.UUCP> wv@whuts.UUCP (54299-DUNCAN,W.) writes:
..>>>In article <3685@drutx.ATT.COM> tsf@drutx.ATT.COM (FisherTS) writes:
..>>The conversion upg1.1-1.2 is available via anonymous uucp and ftp from
..>>ncsuvx.ncsu.edu.  If you are interested, please send me mail and I will
..>>give you information on dialing up.
..>
..>Except that as of last night, the copy at ncsuvx is trashed.
..>I ftp'd it to another system, uncompressed it and
..>found the bottom half of it trashed.  Mike

I just checked the file and it is OK here (even the bottom).  Anyway, please
make sure you are in BINARY mode when you transfer the file, etc.. and contact
me if you have problems instead of saying my copy is bad.

Thanks,
-abc