#3215 closed defect (fixed)
[PATCH] After pressing tab as observer, the status bars don't disappear
Reported by: | elexis | Owned by: | elexis |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 20 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | Patch: |
Description (last modified by )
If you press the tab button, then your units health and aura icons are displayed.
However if you do this as a spectator, then the status bars don't disappear when releasing the button. You can only remove them by hovering each entity individually.
Also status bars over gaia entities like trees are displayed.
It would be nice too if your enemies status bars are displayed, so that you can select the weakest enemy unit to attack. Currently you have to hover each unit to find its health.
Attachments (4)
Change History (22)
comment:1 by , 9 years ago
Keywords: | patch review added |
---|---|
Milestone: | Backlog → Alpha 19 |
Summary: | After pressing tab as observer, the status bars don't disappear → [PATCH] After pressing tab as observer, the status bars don't disappear |
by , 9 years ago
Attachment: | t3215_fix_observer_statusbars.patch added |
---|
follow-up: 4 comment:2 by , 9 years ago
comment:3 by , 9 years ago
Component: | Core engine → UI & Simulation |
---|---|
Keywords: | review removed |
Priority: | Should Have → Nice to Have |
comment:4 by , 9 years ago
Replying to leper:
=>
in the new code and in the filter you moved.
What does that mean? indention?
- use
if (observer) ... else if [...]
so you don't have to move all that code.
Yes.
- The GuiInterface change is ugly, also seems a bit strange. Could also use
x || y
to make it nicer.
I know its ugly, I can't look at it either. But the problem is that the player argument is automatically filled in by the GuiInterface. player || specificPlayer
doesn't work therefore, since the player variable always contains the current player ID. I could make a second function GetEntitiesByOtherPlayer with an argument that has a different name than 'player'.
Though I'm not really sure about that part of the change at all (nor about the addition of observer specific checks in the gui.
Pressing the tab button should display the status bars. If you are observer and press it, then the status bars appear but don't disappear without the patch. With the patch they disappear again. Without the patch status bars appear over gaia stuff like resources too. With the patch they appear only over player entities. So the patch fixes two actual errors. There must be an observer specific check, otherwise those 2 errors will appear. One could check if the client is an observer and disable the feature completely, but why not make it a useful feature with that patch above, so that the observer can better see which player is winning the battle.
I put the priority on should have
, since that hotkey is heavily broken for observers, not an enhancement. You have hover each resource after pressing that key in order to fix the bug.
by , 9 years ago
Attachment: | t3215_fix_observer_statusbars_v2.patch added |
---|
comment:5 by , 9 years ago
Keywords: | review added |
---|---|
Priority: | Nice to Have → Should Have |
-Renames PickSimilarFriendlyEntities to PickSimilarPlayerEntities and PickSimilarFriendlyEntities to PickSimilarPlayerEntities (since it doesnt pick allied entities).
-Solved ugly javascript code and optimized performance by pushing the relevant code to c++ (rangemanager) and using the the fat arrow function in recalculateStatusBarDisplay()
-Should have because currently (as described above) the tab hotkey is heavily broken if you use it as an observer.
comment:6 by , 9 years ago
Description: | modified (diff) |
---|
by , 9 years ago
Attachment: | t3215_fix_observer_statusbars_v3.patch added |
---|
(1) Renames functions from ...AllPlayerEntities to ...NonGaiaEntities (2) Removes the loop when computing the ownership mask (3) Uses for (const entity_id_t& ent : ents)
for a cleaner loop (4) Removes an unused player argument in the GuiInterface
comment:8 by , 9 years ago
Code review:
- remove the trailing space and add back that line in session.js
- why do you have both this function in ScriptInterface.cpp and the EntitySelection helper (that you don't call AFAICS)? Is this an oversight?
- emplace_back in the range manager function
- why don't you directly check the gaia bit in the owner mask?
Apart from that it looks good!
comment:9 by , 9 years ago
Keywords: | review removed |
---|
by , 9 years ago
Attachment: | t3215_fix_observer_statusbars_v4.patch added |
---|
comment:10 by , 9 years ago
Keywords: | review added |
---|
- Added comments
- Fixed whitespace
CStr
instead ofstd::string
emplace_back
instead ofpush_back
- Range-based loops in existing code
- Removed unused function
PickNonGaiaEntitiesInRect
- Directly checks the owner instead of computing a mask in
GetEntitiesByPlayer
- Introduces
NON_GAIA_PLAYERS
so thatPickPlayerEntitiesInRect
andGetEntitiesByPlayer
can be used instead of duplicating existing functions.
Instead of introducing that constant, we could add another boolean parameter nonGaiaEntities
to those two functions and CheckEntityVisibleAndInRect
and if it's true, ignore the player
/ owner
argument. But that seems more ugly to me, not sure.
comment:11 by , 9 years ago
Keywords: | review removed |
---|
- I'm not very enthusiastic about this
NON_GAIA_PLAYERS
. You should take advantage of that mask code you removed (it's more clever than you think): just add aGetEntitiesByMask
function and use it inGetEntitiesByPlayer
andGetNonGaiaEntities
. - Also, this range-based for is not really nice, I think keeping iterators is ok until we make
EntityMap
support range-based fors seamlessly. - Why did you add that check to line 101 of Selection.cpp?
- Your change at the end of Selection.cpp is bad because now you go through your lists twice so you increase the complexity. I don't see why you touched that code in the first place, but using range based fors and emplace_back should be enough.
comment:12 by , 9 years ago
Milestone: | Alpha 19 → Alpha 20 |
---|
comment:18 by , 7 years ago
Description: | modified (diff) |
---|
Actually I'm not sure anymore whether the recommendation from 2015-06-03 to use NonGaia was the best choice, since some entities don't have an ownership component or have owner -1 returned.
This becomes relevant if we want to get all entities owned by gaia or players, but not unowned ones, so GetGaiaAndNonGaia entities sounds like all entities when it's not (the function was proposed for introduction in https://code.wildfiregames.com/D229)
=>
in the new code and in the filter you moved.if (observer) ... else if [...]
so you don't have to move all that code.x || y
to make it nicer.Though I'm not really sure about that part of the change at all (nor about the addition of observer specific checks in the gui.