Some discussion in the newsgroup about nearby peaceful monsters becoming hostile if they observed the hero attacking a peaceful monster made me look at the code and I spotted a couple of problems. An auto array was being initialized in an inner block--some pre-ANSI compilers couldn't handle that. Worse, it was inside a loop and may or may not have resulted in unnecessary setup each iteration. Make it static. Oddly, the array had the same name as a function but `gcc -Wshadow' either didn't notice or didn't care. A more significant problem was that mon->mpeaceful was being set to 0 without checking whether mon->mtame was set, potentially resulting in humanoid pets being both tame and hostile at the same time. This change prevents that but doesn't do anything interesting about pets who observe attacks against peacefuls. (I also wonder why chaotic peacefuls now get upset by seeing other peacefuls be attacked; it seems out of character.) There was also a check for non-humanoid peacefuls seeing another of the same species be attacked, but it was checking for an exact match without regard for littler or bigger incarnations of the same species. I've added the latter. This also reformats a couple of block comments.
101 KiB
101 KiB