Economic and Military Score (Overflow Fix)

Economic and Military Score Overflow Fix; support/discussion/questions

Moderator: thunderchero

User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1961
Joined: Sun Apr 27, 2008 2:00 am

Re: Economic and Military Score (Overflow Fix)

Post by Spocks-cuddly-tribble »

I don't see why you should want to keep AI codes for ship/system tasks running if you ignore and alter the orders (unneeded calculations). There is some AI diplomacy codes reading some ships tasks, but this could be handled just like the player ships on the map.

Anyway sub_407250 AI_control_major is your friend for specifc features(+ the extra codes for minors & monster) or sub_403750 AIProcessTurn for global process (@4037E7 insert extra call / extern feature hook before the 'retn').

IDA database: https://workupload.com/file/ZUbaFLytzw7
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3258
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Economic and Military Score (Overflow Fix)

Post by Flocke »

I just don't like to analyse and hook each specific feature, nor replace the whole calculation at once. E.g. I could leave all the calculations but just add some special case like detect enemy threats by my own calculation and do something different but leave the rest of the ship movements.

Lateron I ofc hope to replace it all. That case again all the special sub-routines aren't of interest either. Just the modified data and MP is of interest.
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3258
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Economic and Military Score (Overflow Fix)

Post by Flocke »

Flocke wrote: Tue May 31, 2022 3:59 am
Spocks-cuddly-tribble wrote: Sun May 29, 2022 9:19 am Offset 0x02AC current turn -> iteration pointer 1-250?
a logic assumption I need to check
Already some while back, while fixing the UE stats, I also checked on the iteration pointer again. It indeed iterates the 1-250 entry indexes. But other than turning back to zero, every 250 turns each 2nd entry is removed, and the iteration pointer (index) is shrinked by half. That way a buffer overflow is prevented, while the graph still shows progress from first turn onwards.

In addition to that, at offset 0x0C7C the shrink increment is stored to determine the stats resolution and how many turns need to pass till next added statistical score entry.
Post Reply

Return to “Economic and Military Score Overflow Fix”