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

Pact AI poor decisions making when swapping bases #25

Open b-casey opened 3 years ago

b-casey commented 3 years ago

The original issue can be summed up by the AI will accept a swap of one of their higher value bases for a much cheaper one. They will also reject the less likely edge case of trades in their favor where the PC attempts to trade an expensive base for a cheap AI one. Kyrub attempt to fix this issue by patching value_of_base() however their patch seems to only be a band-aid that inflates the valuation of most bases and doesn't address the underlying issue. The real issue is with an incorrect conditional check that got swapped.

Function where issue is present: void __cdecl base_swap(int factionIDRes, int factionIDReq)

Area to fix, either swap eax/ebx or change jle to jg effectively in the code: 0054D6A9 cmp eax, ebx 0054D6AB jle loc_54D7D6