Spore18
Conscript
Posts: 13
Joined: Sun Apr 04, 2021 6:06 am

Does anyone know where diplomacy information is stored in the host file?

Sat Apr 17, 2021 10:08 pm

You may have seen another post about removing peace treaties, and this is directly related to that. There's a peace treaty that we really need to see removed in our game, and I'm perfectly willing to fiddle around in the host file to try to make that happen, I just don't know where to look. Given that the entire gamestate is defined by the host file, data on the state of diplomacy has to be in there somewhere, but with a lack of any labeling or relevant keywords that I can find it's probably just a series of integers somewhere. Does anyone happen to know which of the many, many series of integers in that file relates to diplomacy?

User avatar
Pocus
Posts: 25669
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Re: Does anyone know where diplomacy information is stored in the host file?

Mon Apr 19, 2021 9:50 am

I'm looking at the old code base, but can't run it on this computer. I see that a treaty item or matrix is defined by several tags, here they are. It might help you figure where things are

const TagDIItem = '[TDII]';
TagDISingle = '[TDIS]';
TagDIParam = '[TDIP]';
TagDIFacUIDList = '[TDIFUL]';
TagTMIntListMatrix = '[TMILM]'; // TreatyMatrix IntegerList-Matrix
TagTMTreatyDB = '[TMTDB]'; // TreatyMatrix DiploItemDB
TagTradeTreatyParams = '[TTTP]';

User avatar
Pocus
Posts: 25669
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Re: Does anyone know where diplomacy information is stored in the host file?

Mon Apr 19, 2021 9:53 am

I'm not allowed to publish the entire code, that's still a property of Slitherine, but here are some excerpts, if it can help you figure more.

I see there are two entities saved in the diplomacy code. One is a matrix, one is an object.

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// SERIALIZE
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function TTreatyMatrix.Serialize: string;
begin
Result := TagTMIntListMatrix +
fTreatyMatrix.Serialize +
TagTMIntListMatrix +
TagTMTreatyDB +
'NULL'{fTreatyDB.Serialize} +
TagTMTreatyDB;
end;

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// SERIALIZE
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function TDiploObject.Serialize: string;
begin
if fString1 = '' then fString1 := 'NULL';
if fString2 = '' then fString2 := 'NULL';
if fString3 = '' then fString3 := 'NULL';
if fString4 = '' then fString4 := 'NULL';
try
Result :=
'#DO#' +
ITS(fSenderFacUID ) + _delim1 +
ITS(fTargetFacUID ) + _delim1 +
ITS(fStartTurn ) + _delim1 +
ITS(fEndTurn ) + _delim1 +
ITS(fDefUID ) + _delim1 +
ITS(fState ) + _delim1 +

ITS(fRqDuration ) + _delim1 +
ITS(fSndMargin ) + _delim1 +
ITS(fRepMargin ) + _delim1 +
ITS(fWarscore ) + _delim1 +
ITS(fInteger1 ) + _delim1 +
ITS(fInteger2 ) + _delim1 +
ITS(fInteger3 ) + _delim1 +
ITS(fInteger4 ) + _delim1 +
ITS(fInteger5 ) + _delim1 +
ITS(fInteger6 ) + _delim1 +
fString1 + _delim1 +
fString2 + _delim1 +
fString3 + _delim1 +
fString4 + _delim1 +

'#DO#';


except
on E : Exception do
LogMsg(['TDiploObject.Serialize','Exception caught:', E.Message], _Critical);
end;
end;

Spore18
Conscript
Posts: 13
Joined: Sun Apr 04, 2021 6:06 am

Re: Does anyone know where diplomacy information is stored in the host file?

Mon Apr 19, 2021 10:06 am

omg thank you so much Pocus. The key was that #DO# delimeter, turns out the entire thing was stored on line 29 in our host file. Thank you for the specific code as well, that should be very helpful for finding the peace treaty within the line.

User avatar
Morgan
Corporal
Posts: 51
Joined: Sat Mar 18, 2017 3:10 pm
Location: North Carolina
Contact: Twitter

Re: Does anyone know where diplomacy information is stored in the host file?

Mon Apr 19, 2021 11:00 am

This is a wealth of information. I see now how the treaties are represented. Thank you very much!

Code: Select all

#DO#1000001|1000003|2657|2681|19|6|-1|0|0|0|0|0|0|0|0|0|NULL|NULL|NULL|NULL|#DO#


That's a peace treaty (19) between France (1000001) and Russia (1000003).

Code: Select all

#DO#1000001|1000002|2569|12568|15|6|-1|0|0|-11|0|0|0|0|0|0|NULL|NULL|NULL|NULL|#DO#


And that is a war (15) between France (1000001) and Great Britain (1000002) with a warscore of -11.

Thank you so much for bothering to look this up!

:hat:

User avatar
Pocus
Posts: 25669
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Re: Does anyone know where diplomacy information is stored in the host file?

Tue Apr 20, 2021 2:10 pm

Happy to help!

Return to “Wars of Napoleon”

Who is online

Users browsing this forum: No registered users and 8 guests