Skip to content

[GEN][ZH] Fix reselection of group not always working #1334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1024,50 +1024,48 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
m_lastGroupSelTime = now;
}

// check for double-press to jump view
if ( now - m_lastGroupSelTime < 20 && group == m_lastGroupSelGroup )
// TheSuperHackers @fix skyaero 22/07/2025
// Always select the units, even when double press, to prevent accidental deselect.

TheInGameUI->deselectAllDrawables(false); //No need to post message because we're just creating a new group!
bool isDoubleTap = (now - m_lastGroupSelTime < 20) && (group == m_lastGroupSelGroup);

if (!isDoubleTap)
{
DEBUG_LOG(("META: DOUBLETAP select team %d",group));
Player *player = ThePlayerList->getLocalPlayer();
if (player)
// no need to send two messages for selecting the same group.
TheMessageStream->appendMessage((GameMessage::Type)(GameMessage::MSG_SELECT_TEAM0 + group));
}

Player *player = ThePlayerList->getLocalPlayer();
if (player)
{
Squad *selectedSquad = player->getHotkeySquad(group);
if (selectedSquad != NULL)
{
Squad *selectedSquad = player->getHotkeySquad(group);
if (selectedSquad != NULL)
VecObjectPtr objlist = selectedSquad->getLiveObjects();
Int numObjs = objlist.size();

for (Int i = 0; i < numObjs; ++i)
{
VecObjectPtr objlist = selectedSquad->getLiveObjects();
Int numObjs = objlist.size();
if (numObjs > 0)
if( objlist[i]->getControllingPlayer() == player )
{
// if theres someone in the group, center the camera on them.
TheTacticalView->lookAt( objlist[numObjs-1]->getDrawable()->getPosition() );
TheInGameUI->selectDrawable(objlist[i]->getDrawable());
}
}
}
}
else
{
TheInGameUI->deselectAllDrawables( false ); //No need to post message because we're just creating a new group!

// no need to send two messages for selecting the same group.
TheMessageStream->appendMessage((GameMessage::Type)(GameMessage::MSG_SELECT_TEAM0 + group));
Player *player = ThePlayerList->getLocalPlayer();
if (player)
{
Squad *selectedSquad = player->getHotkeySquad(group);
if (selectedSquad != NULL)
if (isDoubleTap)
{
VecObjectPtr objlist = selectedSquad->getLiveObjects();
Int numObjs = objlist.size();
for (Int i = 0; i < numObjs; ++i)
DEBUG_LOG(("META: DOUBLETAP select team %d", group));

if (numObjs > 0)
{
if( objlist[i]->getControllingPlayer() == player )
{
TheInGameUI->selectDrawable(objlist[i]->getDrawable());
}
// if theres someone in the group, center the camera on them.
TheTacticalView->lookAt(objlist[numObjs - 1]->getDrawable()->getPosition());
}
}
}
}
}

m_lastGroupSelTime = now;
m_lastGroupSelGroup = group;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1099,50 +1099,48 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
m_lastGroupSelTime = now;
}

// check for double-press to jump view
if ( now - m_lastGroupSelTime < 20 && group == m_lastGroupSelGroup )
// TheSuperHackers @fix skyaero 22/07/2025
// Always select the units, even when double press, to prevent accidental deselect.

TheInGameUI->deselectAllDrawables(false); //No need to post message because we're just creating a new group!
bool isDoubleTap = (now - m_lastGroupSelTime < 20) && (group == m_lastGroupSelGroup);

if (!isDoubleTap)
{
DEBUG_LOG(("META: DOUBLETAP select team %d",group));
Player *player = ThePlayerList->getLocalPlayer();
if (player)
// no need to send two messages for selecting the same group.
TheMessageStream->appendMessage((GameMessage::Type)(GameMessage::MSG_SELECT_TEAM0 + group));
}

Player* player = ThePlayerList->getLocalPlayer();
if (player)
{
Squad* selectedSquad = player->getHotkeySquad(group);
if (selectedSquad != NULL)
{
Squad *selectedSquad = player->getHotkeySquad(group);
if (selectedSquad != NULL)
VecObjectPtr objlist = selectedSquad->getLiveObjects();
Int numObjs = objlist.size();

for (Int i = 0; i < numObjs; ++i)
{
VecObjectPtr objlist = selectedSquad->getLiveObjects();
Int numObjs = objlist.size();
if (numObjs > 0)
if (objlist[i]->getControllingPlayer() == player)
{
// if theres someone in the group, center the camera on them.
TheTacticalView->lookAt( objlist[numObjs-1]->getDrawable()->getPosition() );
TheInGameUI->selectDrawable(objlist[i]->getDrawable());
}
}
}
}
else
{
TheInGameUI->deselectAllDrawables( false ); //No need to post message because we're just creating a new group!

// no need to send two messages for selecting the same group.
TheMessageStream->appendMessage((GameMessage::Type)(GameMessage::MSG_SELECT_TEAM0 + group));
Player *player = ThePlayerList->getLocalPlayer();
if (player)
{
Squad *selectedSquad = player->getHotkeySquad(group);
if (selectedSquad != NULL)
if (isDoubleTap)
{
VecObjectPtr objlist = selectedSquad->getLiveObjects();
Int numObjs = objlist.size();
for (Int i = 0; i < numObjs; ++i)
DEBUG_LOG(("META: DOUBLETAP select team %d", group));

if (numObjs > 0)
{
if( objlist[i]->getControllingPlayer() == player )
{
TheInGameUI->selectDrawable(objlist[i]->getDrawable());
}
// if theres someone in the group, center the camera on them.
TheTacticalView->lookAt(objlist[numObjs - 1]->getDrawable()->getPosition());
}
}
}
}

m_lastGroupSelTime = now;
m_lastGroupSelGroup = group;
}
Expand Down
Loading