Ferengi (free) trade routes

Ferengi (free) trade routes; support/discussion/questions

Moderator: thunderchero

Post Reply
User avatar
Code Master
Code Master
Posts: 862
Joined: Sun Apr 27, 2008 2:00 am

Ferengi (free) trade routes

Post by Spocks-cuddly-tribble »

With the aid of the research results from dynamic data resp. savegame files (see: Modding Index -> Tutorials: -Coding), I could draw an old secret from Trek.exe. :)

The Ferengi (free) trade routes code, by DCER & me

Since the old initial post contains some incorrect assumptions, I'll summarize the valid facts with some minor additions:

All code locations listed below contain the empire-ID (default 02/ferengi). The feature can be (even partial) disabled via invalid ID (i.e. above 04).

Twice-issued -> need of all locations for a proper functionality !

Code: Select all

4479B9   cmp   cl, 2 // 0x46DBB * trade to minor

459826   cmp   ch, 2 // 0x58C28 *AI to major without treaty & player to minor

40D3C3   cmp   word ptr [esi+8], 2 // 0xC7C7 * AI to minor

43BCAF   cmp   bl, 2 // 0x3B0B1 * player to major without treaty

Trade to majors with non-agression & player after the ending of a treaty:

45EBEF   cmp   word ptr [ecx+34h], 2 // 0x5DFF3
45EBFA   cmp   si, 2                 // 0x5DFFD
45EEDF   cmp   word ptr [ecx+34h], 2 // 0x5E2E3
45EEEA   cmp   si, 2                 // 0x5E2ED
45F151   cmp   word ptr [esi+34h], 2 // 0x5E555
45F18A   cmp   di, 2                 // 0x5E58D

Show systems by non-aggression:

45F17C   mov   edx, 2  // 0x5E57D
45F1B3   mov   edx, 2  // 0x5E5B4

Trade route effect to Minor Attitude:

42A4BF   cmp   dh, 2       // 0x298C1
Concerning the value at 0x46DBB note a mod-independent bug allows trading with minor races at war or with invalid treaty for one turn i.e. there is a removal delay of one turn!

In theory the free trading to empires / minors can be divided between different empires. But, as you see, the value at 0x58C28 is here the biggest troublemaker.

Trade GUI warning messages (sub_4D8610)

(no friendship treaty or higher / no race known yet...)

Race-ID to be ignored:


(during my test either of them sufficed)

0xD7B9C (at WAR with all known races)

Changing of this funny value disables ALL AI to major trade. It's a remote possibility AI diplomacy somehow gets stuck...

Code: Select all

40D3A3   mov     ebp,1    // 0xC7A4
Last edited by Spocks-cuddly-tribble on Sun May 08, 2011 5:49 am, edited 2 times in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Code Master
Code Master
Posts: 683
Joined: Sat Apr 26, 2008 2:00 am

Post by DCER »

Nice work Tribble! Many mods could make use of this.

I hope you're doing good on fixing the ignored message diplomacy bug :)
User avatar
Posts: 1118
Joined: Tue May 06, 2008 2:00 am
Location: England

Post by Peter1981 »

Sorry SCT but i want to change the race this applies to from 02 (ferengi) to 00 (cardassians)

I changed to 02 in the above post to 00 to accomplish this. but it hasn't swaped the function. Any idea why?
Spocks-cuddly-tribble wrote:Just change all empire IDs at the 17 given 0x-addresses and start a new game (otherwise the savegame has to be edited, at least the empsInfo file).
thanks thats got it!
User avatar
Code Analyst
Code Analyst
Posts: 433
Joined: Tue Jul 26, 2011 8:29 pm
Location: Ireland

Re: Ferengi (free) trade routes

Post by QuasarDonkey »

Here's a patch that will totally disable Ferengi free trade. It works by changing the race ID in comparisons from 02 (Ferengi) to FF (invalid).


Code: Select all

NAME: Disable Ferengi free trade
DESC: This patch requires the Ferengi to establish a friendship treaty to trade with other races.
AUTHOR: Spocks-cuddly-tribble
URL: https://www.armadafleetcommand.com/onscreen/botf/viewtopic.php?f=165&t=1057
TAG: enhancement

>> 0x46dbb  02
<< 0x46dbb  FF
>> 0x58c28  02
<< 0x58c28  FF
>> 0x0c7c7  02
<< 0x0c7c7  FF
>> 0x3b0b1  02
<< 0x3b0b1  FF
>> 0x5dff3  02
<< 0x5dff3  FF
>> 0x5dffd  02
<< 0x5dffd  FF
>> 0x5e2e3  02
<< 0x5e2e3  FF
>> 0x5e2ed  02
<< 0x5e2ed  FF
>> 0x5e555  02
<< 0x5e555  FF
>> 0x5e58d  02
<< 0x5e58d  FF
>> 0x298c1  02
<< 0x298c1  FF
# GUI message about meeting a race
>> 0xd7afa  02
<< 0xd7afa  FF
# GUI message about trading during war
>> 0xd7b6e  02
<< 0xd7b6e  FF
# GUI message about establishing a friendship treaty
>> 0xd7b9c  02
<< 0xd7b9c  FF
Post Reply

Return to “Ferengi (free) trade routes”