Hello everybody! I have a Battletech code question and I'm hoping that a code expert could help. I'll also post this in the Battletech Discords that I know about.
I'd like to try and fix the multiplayer issue where game language matters between clients. I've been testing for a while and have posted my findings along the way in this bug report.
Basically, the game always has an out-of-sync error if one of the clients uses English and the other client uses something else. I strongly suspect that this has to do with the decimal separator localization, since Russian and German and French write one-half as 0,5 but English writes it as 0.5.
What I'd like to do is replace all '.' with ',' during the multiplayer stats comparison that runs during the game and I think I've located where to do that. It's in the below method.
I'd like to change this line
to something like this
However, I'm not that familiar with the classes involved and so I'm not sure how easy that would be to do with a statsCompare.dataHash.
Is someone able to point me in the right direction?
I'd like to try and fix the multiplayer issue where game language matters between clients. I've been testing for a while and have posted my findings along the way in this bug report.
Basically, the game always has an out-of-sync error if one of the clients uses English and the other client uses something else. I strongly suspect that this has to do with the decimal separator localization, since Russian and German and French write one-half as 0,5 but English writes it as 0.5.
What I'd like to do is replace all '.' with ',' during the multiplayer stats comparison that runs during the game and I think I've located where to do that. It's in the below method.
Code:
// BattleTech.StatsCompare
// Token: 0x0600721D RID: 29213 RVA: 0x001DD448 File Offset: 0x001DB648
public override CompareResult Compare(BaseStatsCompare rightBase)
{
StatsCompare statsCompare = rightBase as StatsCompare;
if (statsCompare == null)
{
base.Error("Attempting to compare something else with StatsCompre");
return CompareResult.COMPARISON_ERROR;
}
if (this.dataGUID != statsCompare.dataGUID)
{
string thing = string.Format("GUIDs don't match: {0}\n{1}", this.dataGUID, statsCompare.dataGUID);
base.Error(thing);
return CompareResult.COMPARISON_ERROR;
}
CompareResult compareResult = CompareResult.OK;
if (string.Compare(this.dataHash, statsCompare.dataHash) == 0) <---- LINE OF INTEREST
{
if (base.IsDebugEnabled)
{
base.Debug(string.Format("Data correct\nHashes {0} and {1}", this.dataHash, statsCompare.dataHash));
}
return compareResult;
}
compareResult |= CompareResult.DATA_MISMATCH;
if (!base.HasData)
{
compareResult |= CompareResult.NEEDS_DATA;
}
if (base.IsDebugEnabled)
{
base.Debug(string.Format("Data doesn't match\nHashes {0} and {1}", this.dataHash, statsCompare.dataHash));
}
return compareResult;
}
I'd like to change this line
Code:
"if (string.Compare(this.dataHash, statsCompare.dataHash) == 0)"
Code:
"if (string.Compare(ReplaceAllDotWithComma(this.dataHash), ReplaceAllDotWithComma(statsCompare.dataHash)) == 0)"
However, I'm not that familiar with the classes involved and so I'm not sure how easy that would be to do with a statsCompare.dataHash.
Is someone able to point me in the right direction?