I come upon a minor but still annoying bug during my latest MP games with the guys at the KS group.
In HITS mode, if you raise the camera a little above ground level and right click on the terrain to lay down the destination marker for the selected unit, you'll have good chances that flags will receive a positive hit test for a significant portion of its horizon.
Even if the context menu option is set to disabled, the code in charge of handling that, will improperly reject any further processing of the given click event.
Effectively preventing the unit dest. marker code to get its chance to run.
So, yesterday I spent a couple of hours tracking down the root of the issue in the executable.
I was able to isolate it, luckly, and I'd like to share a fix to anyone interested.
Here's my tentative recreation of the C++ code of the guilty function (I really can't be more exact than this, without taking a look at the sources):
Code: Select all
bool ProcessMouseRightButtonPressOnSelectedUnit(int x, int y, bool bReleased)
{
if (theUnits.selectedUnit < 0) { return false; }
const auto selectedUnit = theUnits.unitList[theUnits.selectedUnit];
if (selectedUnit == nullptr) { return false; }
if (PRTerrain == nullptr) { return false; }
bool ret = false;
if (selectedUnit != nullptr) {
ret = true;
std::uint64_t o = UINT64_C(0);
if (selectedUnit->flagHitTest(x, y, &o)) {
if (bReleased) {
if (localPlayerOOBLink.side != 0 && selectedUnit->OOBLink.side == localPlayerOOBLink.side) {
SComm comm;
if (bCampaignMode) {
comm.Type = eComLoadLayout;
strcpy_s(comm.Param1, "SBCOob");
}
else {
// BUG...
if (selectedUnit->MyGuys()) {
if (optHideMenus.Value == false) {
comm.Type = eComLoadMenu;
comm.Val = selectedUnit->Marching() ? MENU_MARCH : (selectedUnit->HasTarget() ? MENU_TARGETS : MENU_STAND);
}
}
return true;
// ...BUG
}
theApp.AddComm(&comm, 1);
}
}
}
}
return ret;
}
1) CNSDBaseMgr::onMousePress;
2) CMainWnd::ProcessMouseInput => ProcessMouseRightButtonRelease.
In both cases, if our function is going to return true (and, as you can see, it does also if #opthidemenu == true), this will cause troubles.
Respectively stopping the entering in the unit destination marker mode and the firing of the ending eComMoveDir/eComAddPath/etc. commands.
My proposed fix:
Code: Select all
...
else { // !bCampaignMode
if (selectedUnit->MyGuys() && optHideMenus.Value == false) {
comm.Type = eComLoadMenu;
comm.Val = selectedUnit->Marching() ? MENU_MARCH : (selectedUnit->HasTarget() ? MENU_TARGETS : MENU_STAND);
}
else { return false; }
}
theApp.AddComm(&comm, 1);
...
We'd been told the game wlll receive no more patching to get rid of these "imperfections" (they're clearly marginals, but still quite a lot).
1) As we're talking about changing just a couple of bytes here (literally);
2) sharing any exe file is out of question, for what concern me.
I ask to the dev-team to let me know if sharing step-by-step instruction to do it on your own through an hex editor and/or within the AI DLL code (or a difference file?), is gonna create any sort of embarrassment or, even worse, measures are going to be taken towards my position in the forum.
I'd love to avoid both situations, if possible.
Because I can take the blame to enjoy your games still very much. I sure do. But not being considered in bad faith, frankly.

Thanks for your patience and understanding.