The following code piece of code is only executed if no shipyard has been found yet in your home system:
Code: Select all
:00451190 668B842460010000 mov ax, word[esp+00000160] // load empire ID
:00451198 31DB xor ebx, ebx
:0045119A E8E594FEFF call 0043A684 // write corresponding shipyard ID to eax
:0045119F 6689C3 mov bx, ax // shipyard ID
:004511A2 89DA mov edx, ebx // shipyard ID
:004511A4 89C8 mov eax, ecx
:004511A6 E8454CFFFF call 00445DF0 // read building ID from edx and add building (shipyard)
:004511AB 89DA mov edx, ebx // shipyard ID
:004511AD 89C8 mov eax, ecx
Now that the game has made sure you have a shipyard, it's about time to power it up and do the same for the refinery:
Code: Select all
:004511AF E87C44FFFF call 00445630 // power up shipyard
:004511B4 8B8C2462010000 mov ecx, dword[esp+00000162]
:004511BB BA06000000 mov edx, 00000006 // Dilithium Refinery ID
:004511C0 C1F910 sar ecx, 10
:004511C3 C7400401000000 mov dword[eax+04], 00000001
:004511CA 89C8 mov eax, ecx
:004511CC E89F45FFFF call 00445770 // read building ID from edx and check...
:004511D1 85C0 test eax, eax // ... if building is already present
:004511D3 750C jne 004511E1 // skip refinery creation if refinery is already present
:004511D5 BA06000000 mov edx, 00000006 // Dilithium Refinery ID
:004511DA 89C8 mov eax, ecx
:004511DC E80F4CFFFF call 00445DF0 // read building ID from edx and add building (refinery)
---------
:004511E1 8B842462010000 mov eax, dword[esp+00000162]
:004511E8 BA06000000 mov edx, 00000006 // Dilithium Refinery ID
:004511ED C1F810 sar eax, 10
:004511F0 E83B44FFFF call 00445630 // power up refinery
:004511F5 C7400401000000 mov dword[eax+04], 00000001
As an example, this is the altered code I'm using for the next BoP update. It allows empires to start without a mandatory dilithium refinery:
Code: Select all
:004511D1 668B842460010000 mov ax, word[esp+00000160] // load empire ID
:004511D9 E8A694FEFF call 0043A684 // write corresponding shipyard ID to eax
:004511DE 89C2 mov edx, eax // shipyard ID
:004511E0 90 nop
:004511E1 8B842462010000 mov eax, dword[esp+00000162]
:004511E8 9090909090 nop