Morale overflow bug (above 32767)

how Morale works; support/discussion/questions

Moderator: thunderchero

Post Reply
User avatar
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 6058
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Morale overflow bug (above 32767)

Post by thunderchero » Sat Apr 05, 2014 1:19 pm

Hi Everyone,

I found this one in general chat archive and thought it should be in index.

here is original topic

Spocks-cuddly-tribble wrote:
henka wrote:the problem is probably caused by the calculation of the average morale, which is displayed in the intel empire screen (...) for the sum calculation a signed 2 byte value is used, which can only hold a maximum positiv value of 32767.
Well, then let's fix this nasty overflow:

I think I see the problem. This should be fully operative:

Code: Select all

trek.exe at 0x60581

8B 14 24 8D 83 40 02 00 00 01 D0 66 03 78 44
8D 83 40 02 00 00 03 04 24 0F B7 40 44 03 F8

AND at 0x605C2 change: 0F BF to: 90 8B

asm 461181:
lea     eax, [ebx+240h]
add     eax, [esp]
movzx   eax, word ptr [eax+44h]
add     edi, eax

asm 4611C2: 
mov   edx, edi

Post Reply

Return to “how Morale works”

Who is online

Users browsing this forum: No registered users