I've managed to replicate MgDark's bug report in 2 car chases, in revision 800. So it seems that the code causing this bug has been consistently buggy between revisions 772 thru 800. It's probably in chase.cpp. So the bug must've been introduced in revision 772 or earlier. I'm pretty sure this bug was NOT present in the last beta release, version 4.07.4 beta, which was revision 730. So this bug was introduced somewhere between revision 731 and revision 772, and probably introduced in recent months (specifically, judging by changelogs, I'd say it was probably introduced in some revision starting with 756 and ending with 772). So I'm going to look at changes to chase.cpp in between revisions 756 and 772 and try and nail down exactly when and where this bug got introduced. I am well on my way to fixing it... and from what I've figured out so far, 2 people made changes to the code between revisions 756 and 772: me (yetisyny) and nickdumas. I looked carefully at every single one of nickdumas's changes back when he made them and they only introduced 1 bug which I later fixed (in revision 775 I fixed the ONE bug that nickdumas has ever introduced in revision 770). Of course I've introduced more than just one bug but fixed a lot more than I've introduced, just today in revision 800 I fixed a bug that I introduced in revision 798 for example, and that was when I was TRYING to set up a squad to go out and get in a car chase and track down THIS bug that this thread is about.
OK, so the revisions in that range where I suspect the bug was introduced into chase.cpp, where chase.cpp actually got modified are revisions 762, 764, 765, 766, and 772, all revisions that I made (none by other programmers). So at this point I'm SURE this bug is my fault. OK... so it was one of those 5 revisions that introduced the bug... now I'll look at 'em one by one and figure out which one broke it... hmm... OK I've looked thru all the changes and none of them seem to be ones that would cause this bug... I'm a little stumped... maybe I didn't introduce this bug and it was introduced in an earlier revision... OK so now I have to look at changes to chase.cpp between revisions 731 and 755 and see if maybe one of those caused it... or maybe one of the changes that I just looked at that doesn't seem like it would cause this type of bug somehow did, in fact, cause this bug... in any case it looks like I'll need to look more closely... hmm so between revision 731 and 755, chase.cpp got changed twice, in revisions 749 and 753, both by blomkvist... maybe he is responsible for this... no, I just looked at those 2 revisions, it DEFINITELY wasn't his fault. OK, it definitely wasn't 762 either, just looked at it, that was switching over from refresh(), getch(), and translategetch() to the new getkey() function. Definitely wasn't 764... that one FIXED problems in car chases and I remember testing it thoroughly then and it working quite well. Revision 765 just does harmless code cleanup not affecting functionality except for removing clearmaparea(), which I seem to recall was because I noticed that area of the screen was being erased but there aren't maps in chase mode, only in site mode, so it made no sense to call it, so revision 765 didn't cause the problem. OK now we're down to either revision 766 or 772 causing the problem. Revision 766 is just harmless code cleanup, so by elimination it must be revision 772. OK, revision 772 introduces the squadsize() and squadalive() functions and puts them to use... pretty sure that's not the problem... OK then by the process of elimination, I am completely stumped because I don't think ANY of those changes could have caused it.
Hrm... during car chases, functions OUTSIDE of chase.cpp are also called by the functions IN chase.cpp... I will have to broaden my search... this is getting super-frustrating... I cannot seem to find the cause of this bug anywhere. The first suspects to look at would be the squadsize() and squadalive() functions... OK I just looked at them, they are very short, I'm quite sure they don't have any bugs in them, and they are used in plenty of other parts of the game besides car chases and work fine in those parts...
Gah OK now I am totally stumped as to the cause of this bug... but I was able to replicate the bug myself through playtesting... well I guess I'll have to use the process of elimination along with actual playtesting... grr... usually bugs are WAY easier to fix than this one... the way I've been playtesting this bug, with the current revision, is having a full squad of 6 members armed with AK-47s do a raid on the AM Radio Station, and once there's a response, leave the site by car and then shoot at all the hicks and rednecks. That seems to trigger the bug, at least it did both times I tried it so far. Hrmph... I am quite frustrated with this hard-to-pin-down bug, but I am more determined than ever to get to the bottom of this. I think I will try black-box testing, that is, trying it with different versions of the code without actually looking at the code, to pin down which revision caused it, because when I DO look at the changes to the code in each of those revisions, it all looks like it makes perfect sense and couldn't possibly have anything wrong with it or any bugs. But it could be that in practice, the code doesn't actually do what I think it does when I look at it, and I could be missing something, so I ought to switch to a different testing method now... ugh I hate this bug, but I WILL track it down. There doesn't seem to be anything in chase.cpp that changed which would affect savegame compatibility, so if I just use older versions of chase.cpp along with the current code for everything else, maybe that can help track down which revision this happened in... either that or it could reveal that the cause of this bug isn't actually in chase.cpp but in another file instead. And the revisions of chase.cpp in that range don't seem to use any functions that have been eliminated, although new functions have been added that the newer revisions call and older revisions don't. This means the current game ought to be backwards compatible with older versions of chase.cpp and compile without any problems (by older I mean, last couple months, not revisions from a year or more ago, those would probably have more significant changes that would make them incompatible).
Well, this has been a wild goose chase so far, but I WILL solve this... I don't know how, but where there's a will there's a way, plus I'm probably the one who caused this bug even though every single change to the relevant code, I've looked at multiple times and for each change I look at I feel absolutely positive that that change couldn't possibly have introduced any bugs. I really must be missing something here... I guess it's possible this might be a longstanding bug that's been in the program longer than I think, so far I've operated under the premise that this bug was introduced by recent changes to the code. Well, I will leave no stone unturned in finding out the cause of this, until it is solved... gah... if I compare this to the bug I fixed in revision 800, for instance, well that bug was very easy to spot, very easy to track down the cause of, and I instantly knew exactly what was wrong and exactly how to fix it... I am more used to the easy-to-fix bugs like that... I am so baffled by this one right now though. Usually bugs are WAY easier to fix than this one, I've fixed many, many easy-to-fix bugs, but this one is different. Although maybe to some other programmer, it could be blatantly obvious to them, who knows?