It is extremely unlikely that the modifications from that topic (nor the BotF original code) have something to do with the issues mentioned here.
Since we have 4-5 member who want to learn a bit more about assembler, I suggest you team up and build a learning group.
Please do not spam coding forum with faulty codes or wrong statements. No hard feelings, but this confuses people and modding is hard enough. For the same reason, please stay as short & clear as possible there. For example this could be said in two short sentences (+1 code line asm/hex).
Also note posting of code-rewriting requests on external asm-blocks is not a good idea as well. You will see your topic closed, deleted and/or yourself banned quite soon. Just a prediction.
======================================================
Uh, I didn't check this topic for a while and from my little tests everything had seemed to be okay, but Spocks-cuddly-tribble put rightfully the finger on the error.
So first I have to apologies to all of you for my mistake.
Second, last night I reworked the code (I will post it soon) and while running tests I stumbled over a problem, which is related to the training limit code change:
To quickly simulate high exp crew behaving I gave a training facility a training value of 1000!! (This big value is getting important)
Everything worked fine till the crews reached the limit of 4000 points. (Note: the new treshold values for my reworked code reades 768, 2048, 4608, 8192)
So the ships which where build with 0 exp points reached normally the threshold and showed epx. level 3 (that's was fine so far), the ships build on the system with training facility reached 3700 exp point, then 4000 and also had epx. level 3 (fine again).
On the next turn, they all stayed at 4000 exp. points but gain exp. level 4.
I could not found the failure within my new code so I explain it that way:
When the new turn starts the crew exp. bonus is added, second the new crew exp. code will be executed, and after this the new training limit code is executed.
@Spocks-cuddly-tribble:
Could you confirm the code order?
It is possible to rearrange the order so first training limit is checked, then crew exp. boni will be calculated?
BTW: New code has only 2 unused bytes till next code, so there is no space for code extention.
<<<edit>>>
new code is:
Code: Select all
0x070100:
5152 8B48 4051 5A81 F900 0300 007D 0CC7
4044 0000 0000 C1EA 07EB 5781 F900 0800
007D 14C7 4044 0100 0000 81EA 0001 0000
C1EA 0842 42EB 3B81 F900 1200 007D 15C7
4044 0200 0000 81EA 0002 0000 C1EA 0983
C206 EB1E C1EA 0A83 C20B 81F9 0020 0000
7D09 C740 4403 0000 00EB 07C7 4044 0400
0000 8950 2C89 5030 8950 345A 59C3 9090
Code: Select all
51 push ecx
52 push edx
8B4840 mov ecx, [eax+40h]
51 push ecx
5A pop edx
81F900030000 cmp ecx, 300h
; exp points <768>= 128: +1; >=256: +2; >=384: +3; >=512: +4; >=640: +5
EB57 jmp short loc_470D72
81F900080000 cmp ecx, 800h
; exp points <2048>=768: +6; >=1024: +7; >=1280: +8; >=1536: +9; >=1792: +10
EB3B jmp short loc_470D72
81F900120000 cmp ecx, 1200h
; exp points <4608>=2048: +11; >=2560: +12; >=3072: +13; >=3584: +14; >=4096: +15
EB1E jmp short loc_470D72
C1EA0A shr edx, 0Ah
; edx = edx / 1024
83C20B add edx, 0Bh
; exp. points/boni >=5120: +16; >=6144: +17; >=7168: +18; >=8192: +19
; exp. points/boni >=9216: +20; >=10240: +21; >=11268: +22; ...; >=20096: +30; ...
81F900200000 cmp ecx, 2000h
; exp points < 8192
7D09 jge short loc_470D6B
C7404403000000 mov dword ptr [eax+44h], 3
; exp level = 3 of 0-4
EB07 jmp short loc_470D72
C7404404000000 mov dword ptr [eax+44h], 4
; exp level = 4 of 0-4
89502C mov [eax+2Ch], edx
895030 mov [eax+30h], edx
895034 mov [eax+34h], edx
5A pop edx
59 pop ecx
C3 retn