-
Notifications
You must be signed in to change notification settings - Fork 203
tweak(gamemessage): Reduce number of MSG_DESTROY_SELECTED_GROUP messages #2668
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
6c8d336
db6a8e6
4c917cd
4453191
8c156f6
fcb6ef1
65a34a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3553,7 +3553,7 @@ void InGameUI::deselectDrawable( Drawable *draw ) | |
| //------------------------------------------------------------------------------------------------- | ||
| /** Clear all drawables' "select" status */ | ||
| //------------------------------------------------------------------------------------------------- | ||
| void InGameUI::deselectAllDrawables( Bool postMsg ) | ||
| void InGameUI::deselectAllDrawables( Bool updateGameLogic ) | ||
| { | ||
| const DrawableList *selected = getAllSelectedDrawables(); | ||
|
|
||
|
|
@@ -3576,16 +3576,14 @@ void InGameUI::deselectAllDrawables( Bool postMsg ) | |
| // our selection can no longer consist of exactly one angry mob | ||
| m_soloNexusSelectedDrawableID = INVALID_DRAWABLE_ID; | ||
|
|
||
|
|
||
| ///@todo don't we want to not emit this message if there wasn't a group at all? (CBD) | ||
| /** @todo also, we probably are sending this message too much, we should come up with | ||
| some kind of "selections are dirty" status that we can check once per frame and send | ||
| the correct group info over the network ... could be tricky tho (or impossible) given | ||
| the order of operations of things happening in the code (CBD) */ | ||
| if( postMsg ) | ||
| if (updateGameLogic) | ||
| { | ||
| // TheSuperHackers @tweak Originally this message had one boolean argument, but it wasn't used for anything. | ||
| TheMessageStream->appendMessage( GameMessage::MSG_DESTROY_SELECTED_GROUP ); | ||
| // TheSuperHackers @tweak Avoid sending this message when no objects are currently selected. | ||
| if (!ThePlayerList->getLocalPlayer()->isCurrentlySelectedGroupEmpty()) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks suspicious. Let's say we select the drawable and then deselect it real fast before the AIGroup is created in the logic (network delay). Wouldn't that then mean the deselect is missed entirely in the logic, while it is deselected in client? Maybe empty list test needs to come with above drawable list instead?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, that's right, good find. I had overlooked that. I think it won't cause a mismatch because it's purely a client issue, but it needs changing.
As an early return if current selection is empty? EDIT1: That needs some tweaking, otherwise you may not be able to deselect units while the game is paused. EDIT2: Perhaps this is even less desirable. If the logic is slow to update, client deselection attempts may fail because the logic group selection is still empty, making it harder to deselect objects.
EDIT3: The reproduction is slightly more complex than described and not likely to happen imo:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes so if there is an issue, even if difficult to reproduce for a human, we cannot do this.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fair. What about this instead? It has a check for client and logic: const DrawableList *selected = getAllSelectedDrawables();
const Bool emptyDrawableSelection = selected->empty();
...
if (updateGameLogic)
{
if (!emptyDrawableSelection || !ThePlayerList->getLocalPlayer()->isCurrentlySelectedGroupEmpty())
{
TheMessageStream->appendMessage(GameMessage::MSG_DESTROY_SELECTED_GROUP);
}
} |
||
| { | ||
| // TheSuperHackers @tweak Originally this message had one boolean argument, but it wasn't used for anything. | ||
| TheMessageStream->appendMessage(GameMessage::MSG_DESTROY_SELECTED_GROUP); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.