creps@silver.bacs.indiana.edu (Steve Creps) (01/01/88)
Here are the mods to fix the problem with ghosts, soldiers, eels, etc. not being restored properly. It was actually two problems: the soldiers problem was because I hadn't added a case for soldiers in the special index section of the save code. I added this code, and it now works. Also I added cases for kobold, giant rats, and medusas, since these weren't there and would have caused the same problem. Now the problem with the ghosts and eels was that the code to compute the special index for these monsters was not logically correct. It was trying to decrement a counter (starting at -1) to keep track of the index. However, this decrement was _inside_an_if_statement_, so it was possible (and highly likely) for two monsters to get the same index. My fix is to change the index computation back to being hard-coded, like it used to be. This does NOT cause any problems, even if not all monsters are #defined. If a monster is missing, it will leave an unused index, but who cares? In my earlier posting I described a monster appearing as an umlauted e. I think this was a giant rat that did not get restored correctly. Now that I've added the giant_rat case to the save code, it should not happen again. The error only occurred in the PC version, because the code in question was inside a #define. Here are the diffs: *** lev.c.old Thu Dec 31 18:44:26 1987 --- lev.c Thu Dec 31 18:28:31 1987 *************** *** 173,178 struct permonst *permonstp; int monsindex; extern struct permonst li_dog, dog, la_dog; #ifdef KAA int mi; extern struct permonst hell_hound; --- 173,192 ----- struct permonst *permonstp; int monsindex; extern struct permonst li_dog, dog, la_dog; + #ifdef SAC + extern struct permonst pm_soldier; + #endif + #ifdef KJSMODS + #ifdef KOPS + extern struct permonst kobold; + #endif + #ifdef ROCKMOLE + extern struct permonst giant_rat; + #endif + #endif /* KJSMODS */ + #ifdef RPH + extern struct permonst pm_medusa; + #endif #ifdef KAA int mi; extern struct permonst hell_hound; *************** *** 191,197 /* store an index where the pointer used to be */ permonstp = mtmp->data; if (permonstp == &li_dog) ! monsindex = mi = -1; /* fake index */ else if (permonstp == &dog) monsindex = --mi; /* fake index */ else if (permonstp == &la_dog) --- 205,211 ----- /* store an index where the pointer used to be */ permonstp = mtmp->data; if (permonstp == &li_dog) ! monsindex = -1; /* fake index */ else if (permonstp == &dog) monsindex = -2; /* fake index */ else if (permonstp == &la_dog) *************** *** 193,199 if (permonstp == &li_dog) monsindex = mi = -1; /* fake index */ else if (permonstp == &dog) ! monsindex = --mi; /* fake index */ else if (permonstp == &la_dog) monsindex = --mi; /* fake index */ #ifdef KAA --- 207,213 ----- if (permonstp == &li_dog) monsindex = -1; /* fake index */ else if (permonstp == &dog) ! monsindex = -2; /* fake index */ else if (permonstp == &la_dog) monsindex = -3; /* fake index */ #ifdef SAC *************** *** 195,201 else if (permonstp == &dog) monsindex = --mi; /* fake index */ else if (permonstp == &la_dog) ! monsindex = --mi; /* fake index */ #ifdef KAA else if (permonstp == &hell_hound) monsindex = --mi; /* fake index */ --- 209,233 ----- else if (permonstp == &dog) monsindex = -2; /* fake index */ else if (permonstp == &la_dog) ! monsindex = -3; /* fake index */ ! #ifdef SAC ! else if (permonstp == &pm_soldier) ! monsindex = -4; ! #endif ! #ifdef KJSMODS ! #ifdef KOPS ! else if (permonstp == &kobold) ! monsindex = -5; ! #endif ! #ifdef ROCKMOLE ! else if (permonstp == &giant_rat) ! monsindex = -6; ! #endif ! #endif /* KJSMODS */ ! #ifdef RPH ! else if (permonstp == &pm_medusa) ! monsindex = -7; ! #endif #ifdef KAA else if (permonstp == &hell_hound) monsindex = -8; /* fake index */ *************** *** 198,204 monsindex = --mi; /* fake index */ #ifdef KAA else if (permonstp == &hell_hound) ! monsindex = --mi; /* fake index */ # ifdef HARD else if (permonstp == &d_lord) monsindex = --mi; /* fake index */ --- 230,236 ----- #endif #ifdef KAA else if (permonstp == &hell_hound) ! monsindex = -8; /* fake index */ # ifdef HARD else if (permonstp == &d_lord) monsindex = -9; /* fake index */ *************** *** 201,207 monsindex = --mi; /* fake index */ # ifdef HARD else if (permonstp == &d_lord) ! monsindex = --mi; /* fake index */ else if (permonstp == &d_prince) monsindex = --mi; /* fake index */ --- 233,239 ----- monsindex = -8; /* fake index */ # ifdef HARD else if (permonstp == &d_lord) ! monsindex = -9; /* fake index */ else if (permonstp == &d_prince) monsindex = -10; /* fake index */ *************** *** 204,210 monsindex = --mi; /* fake index */ else if (permonstp == &d_prince) ! monsindex = --mi; /* fake index */ # endif # ifdef KJSMODS else if (permonstp == &pm_guard) --- 236,242 ----- monsindex = -9; /* fake index */ else if (permonstp == &d_prince) ! monsindex = -10; /* fake index */ # endif # ifdef KJSMODS else if (permonstp == &pm_guard) *************** *** 208,214 # endif # ifdef KJSMODS else if (permonstp == &pm_guard) ! monsindex = -mi; /* fake index */ else if (permonstp == &pm_ghost) monsindex = -mi; /* fake index */ --- 240,246 ----- # endif # ifdef KJSMODS else if (permonstp == &pm_guard) ! monsindex = -11; /* fake index */ else if (permonstp == &pm_ghost) monsindex = -12; /* fake index */ *************** *** 211,217 monsindex = -mi; /* fake index */ else if (permonstp == &pm_ghost) ! monsindex = -mi; /* fake index */ else if (permonstp == &pm_eel) monsindex = -mi; /* fake index */ --- 243,249 ----- monsindex = -11; /* fake index */ else if (permonstp == &pm_ghost) ! monsindex = -12; /* fake index */ else if (permonstp == &pm_eel) monsindex = -13; /* fake index */ *************** *** 214,220 monsindex = -mi; /* fake index */ else if (permonstp == &pm_eel) ! monsindex = -mi; /* fake index */ # endif #endif else --- 246,252 ----- monsindex = -12; /* fake index */ else if (permonstp == &pm_eel) ! monsindex = -13; /* fake index */ # endif #endif else *** save.c.old Thu Dec 31 18:44:27 1987 --- save.c Thu Dec 31 18:36:59 1987 *************** *** 345,350 int xl; int monsindex, mi; extern struct permonst li_dog, dog, la_dog; #ifdef KAA extern struct permonst hell_hound; # ifdef HARD --- 345,364 ----- int xl; int monsindex, mi; extern struct permonst li_dog, dog, la_dog; + #ifdef SAC + extern struct permonst pm_soldier; + #endif + #ifdef KJSMODS + #ifdef KOPS + extern struct permonst kobold; + #endif + #ifdef ROCKMOLE + extern struct permonst giant_rat; + #endif + #endif /* KJSMODS */ + #ifdef RPH + extern struct permonst pm_medusa; + #endif #ifdef KAA extern struct permonst hell_hound; # ifdef HARD *************** *** 369,375 if(!mtmp->m_id) mtmp->m_id = flags.ident++; monsindex = *((int *)&mtmp->data); ! if (monsindex == (mi = -1)) /* Special fake index */ mtmp->data = &li_dog; else if (monsindex == --mi) /* Special fake index */ mtmp->data = &dog; --- 383,389 ----- if(!mtmp->m_id) mtmp->m_id = flags.ident++; monsindex = *((int *)&mtmp->data); ! if (monsindex == -1) /* Special fake index */ mtmp->data = &li_dog; else if (monsindex == -2) /* Special fake index */ mtmp->data = &dog; *************** *** 371,377 monsindex = *((int *)&mtmp->data); if (monsindex == (mi = -1)) /* Special fake index */ mtmp->data = &li_dog; ! else if (monsindex == --mi) /* Special fake index */ mtmp->data = &dog; else if (monsindex == --mi) /* Special fake index */ mtmp->data = &la_dog; --- 385,391 ----- monsindex = *((int *)&mtmp->data); if (monsindex == -1) /* Special fake index */ mtmp->data = &li_dog; ! else if (monsindex == -2) /* Special fake index */ mtmp->data = &dog; else if (monsindex == -3) /* Special fake index */ mtmp->data = &la_dog; *************** *** 373,379 mtmp->data = &li_dog; else if (monsindex == --mi) /* Special fake index */ mtmp->data = &dog; ! else if (monsindex == --mi) /* Special fake index */ mtmp->data = &la_dog; #ifdef KAA else if (monsindex == --mi) --- 387,393 ----- mtmp->data = &li_dog; else if (monsindex == -2) /* Special fake index */ mtmp->data = &dog; ! else if (monsindex == -3) /* Special fake index */ mtmp->data = &la_dog; #ifdef SAC else if (monsindex == -4) *************** *** 375,380 mtmp->data = &dog; else if (monsindex == --mi) /* Special fake index */ mtmp->data = &la_dog; #ifdef KAA else if (monsindex == --mi) mtmp->data = &hell_hound; --- 389,412 ----- mtmp->data = &dog; else if (monsindex == -3) /* Special fake index */ mtmp->data = &la_dog; + #ifdef SAC + else if (monsindex == -4) + mtmp->data = &pm_soldier; + #endif + #ifdef KJSMODS + #ifdef KOPS + else if (monsindex == -5) + mtmp->data = &kobold; + #endif + #ifdef ROCKMOLE + else if (monsindex == -6) + mtmp->data = &giant_rat; + #endif + #endif /* KJSMODS */ + #ifdef RPH + else if (monsindex == -7) + mtmp->data = &pm_medusa; + #endif #ifdef KAA else if (monsindex == -8) mtmp->data = &hell_hound; *************** *** 376,382 else if (monsindex == --mi) /* Special fake index */ mtmp->data = &la_dog; #ifdef KAA ! else if (monsindex == --mi) mtmp->data = &hell_hound; # ifdef HARD else if (monsindex == --mi) --- 408,414 ----- mtmp->data = &pm_medusa; #endif #ifdef KAA ! else if (monsindex == -8) mtmp->data = &hell_hound; # ifdef HARD else if (monsindex == -9) *************** *** 379,385 else if (monsindex == --mi) mtmp->data = &hell_hound; # ifdef HARD ! else if (monsindex == --mi) mtmp->data = &d_lord; else if (monsindex == --mi) --- 411,417 ----- else if (monsindex == -8) mtmp->data = &hell_hound; # ifdef HARD ! else if (monsindex == -9) mtmp->data = &d_lord; else if (monsindex == -10) *************** *** 382,388 else if (monsindex == --mi) mtmp->data = &d_lord; ! else if (monsindex == --mi) mtmp->data = &d_prince; # endif # ifdef KJSMODS --- 414,420 ----- else if (monsindex == -9) mtmp->data = &d_lord; ! else if (monsindex == -10) mtmp->data = &d_prince; # endif # ifdef KJSMODS *************** *** 386,392 mtmp->data = &d_prince; # endif # ifdef KJSMODS ! else if (monsindex == --mi) mtmp->data = &pm_guard; else if (monsindex == --mi) --- 418,424 ----- mtmp->data = &d_prince; # endif # ifdef KJSMODS ! else if (monsindex == -11) mtmp->data = &pm_guard; else if (monsindex == -12) *************** *** 389,395 else if (monsindex == --mi) mtmp->data = &pm_guard; ! else if (monsindex == --mi) mtmp->data = &pm_ghost; else if (monsindex == --mi) --- 421,427 ----- else if (monsindex == -11) mtmp->data = &pm_guard; ! else if (monsindex == -12) mtmp->data = &pm_ghost; else if (monsindex == -13) *************** *** 392,398 else if (monsindex == --mi) mtmp->data = &pm_ghost; ! else if (monsindex == --mi) mtmp->data = &pm_eel; # endif #endif --- 424,430 ----- else if (monsindex == -12) mtmp->data = &pm_ghost; ! else if (monsindex == -13) mtmp->data = &pm_eel; # endif #endif - - - - - - - - - Steve Creps on the VAX 8650 running Ultrix 2.0-1 at Indiana University. creps@silver.bacs.indiana.edu "F-14 Tomcat! There IS no substitute."
awylie@pyr1.cs.ucl.ac.uk (01/12/88)
This "fix" does not work! There is no such thing as a "struct permonst pm_soldier" !! The "corrected" routine compiles but linking fails with this structure missing. Please post the missing part of the fix! ------------------------------------------------------------ Andrew Wylie, University of London Computer Centre, 20 Guilford Street, London WC1N 1DZ, England. JANET: andrew@uk.ac.ulcc.ncdlab UUCP: ..!mcvax!ukc!cs.ucl.ac.uk!awylie ARPA: awylie@cs.ucl.ac.uk BITNET: andrew%uk.ac.ulcc.ncdlab@ac.uk If replying via satnet please give a UUCP path from mcvax to your site.
creps@silver.bacs.indiana.edu (Steve Creps) (01/16/88)
In article <45200001@pyr1.cs.ucl.ac.uk> awylie@pyr1.cs.ucl.ac.uk writes: > >This "fix" does not work! There is no such thing as a "struct permonst >pm_soldier" !! The "corrected" routine compiles but linking fails with >this structure missing. > Please post the missing part of the fix! The permonst pm_soldier declarations were patches based on previous fixes I sent to Mike, but didn't post. In those fixes I was changing the soldier declaration from mons[56] (or something) to &pm_soldier. I later found that it should be mons[xx] after all. Anyway, what this means to anyone installing the later patches is that any changes to the soldier definitions should NOT be made after all. Just make the patches for the other pm_ monsters, leaving out the soldiers. Sorry for the confusion; I was looking at my latest copy when I posted those fixes, and forgot nobody had seen the other stuff. Mike, I'll try to send you email on this sometime, but if you read this, there is a problem with the fixes I sent you. The soldier declaration should not be changed after all. - - - - - - - - - Steve Creps on the VAX 8650 running Ultrix 2.0-1 at Indiana University. creps@silver.bacs.indiana.edu, ...iuvax!silver!creps, creps@iubacs.bitnet "F-14 Tomcat! There IS no substitute."