b-casey / OpenSMACX

A project to decompile SMAC/X to C++ with the long term goal of creating a full open source clone.
GNU General Public License v3.0
52 stars 4 forks source link

Stack corruption in wants_to_attack() #7

Open b-casey opened 4 years ago

b-casey commented 4 years ago

While working on tech_val(), I've noticed some inconsistent results when the 1st parameter is between 89 to 96. I've traced this issue to inside wants_to_attack():

It looks like the buffer isn't properly cleared before use. This can cause an incorrect calculation where the final check returns a different boolean value for the same parameters. It happens fairly consistently. This could be exacerbated by the battery of regression tests I was running. Either way, something to be aware of and something I'll address in future release.