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
Unit's image is missing when attacking #6960
Comments
It's not entirely clear to me what the issue is - is the heavy infantryman blinking on attack? I have not observed anything like this in 1.17.7+dev (314f6f7). knyghtmare, how did you confirm this? Also, the build version indicates a modified source - what was changed? |
There are two issue, one is missing unit's sprite (Heavy infantry) at village location. The second issue is that unit's sprite (Heavy infantry) stays at the old position, and it is blinking in an irregular glitchy way (game display switches between those two screenshots, some times Heavy infantry is also cropped at the top). |
How should one replicate what you described? It has to be more than just 'select unit then move&attack another unit', unless I'm missing something obvious. |
So it's the unit on the village in the original report that's missing? And in that last image, the unit in the water? As I said, I'm testing on 314f6f7 and I cannot replicate this. |
It looks that the issue has been caused by commit 06254e5. @mesilliac
|
I've captured this video with a more serious version of this glitch, where the unit stays displaced and blinking permanently until I select it again. This occurs randomly, so far I haven't been able to figure out any more pattern than what seems to be related to scenarios with water (but not always), and that as you can see in the second half of the video, it is not always reproducible. 2023-01-27.22-00-16.mp4 |
So from the 1.16 screenshot i take that the expected behaviour is that there is simply no unit&halthbar shown at the destination hex? Because the the first message it sounds like it is expected to be there. A possible fix might be to add some display::invalidate(loc) calls in temporary_unit_mover. |
On the contrary, the unit should be seen where the HP bar is visible on the screenshot, it doesn't matter if these bars are visible or not, but the unit should be seen at the attack target. |
But the post which says "Screenshot from 1.16.6:" also doesn't show any unit there from what i can see |
Oh that's right. I'm so used to the unit disappearing in 1.17 that I forgot that the original behavior didn't alter the attacking unit until you hit the attack button. So you're probably right. |
@mesilliac is this something you'd be willing to look into, given the bisect above by grz0 points to 06254e5 as the cause? |
I tested a bit and its really odd, sometimes the unit shows in the original hex, sometimes it doesn't, playing other units next to it seems to have an influence. the bar+orb is always drawn on the new hex |
We move the unit here: Line 938 in 27e5dd5
The two obvious way to fix it would then be:
|
I'm not sure where else it could be moved from. If it's moved any later then the unit doesn't exist to trigger the attack dialog, and if it's moved any earlier it's before the check to make sure it can actually reach the hex to attack from. |
Something else I noticed - if a unit has a standing animation (such as a drake over water), then the unit flickers in place on its starting hex with the animation continuing as normal even if you can only see the frame for an instant. So I wonder if this is related to dialogs no longer blocking animations on the map, and this is what it always would have done except that previously the attack dialog opening prevented this from being seen. |
Would it make sense to spawn a temporary copy of the unit at the hex for the attack dialog to use rather than use the temporary_unit_mover? |
Well… I think the |
Hmm i thought there wodl be once central place where the attack calculation are done but it seems like it split between unit_attack::preshow and the start of mouse_handler::show_attack_dialog. So its not as easy as it though.
i think its not really a good solutin as it could lead to other problems, lets for example assume that the unit moves one tile, and has a leadership ability affecting adjacent unit of the same level , if the unit it still on the original tileaswell it would give itself leadship (during the attack dialog, not during the actual attack)
Yes indeed, it seems like some code is called that updates unit animations to the actual unit position is called during "normal" drawing, but not during drawing while dialogs are open. |
As mentioned elsewhere, I touched unit animation as little as possible, and frankly have no more idea how it works than anybody else. There were weird problems like this before my changes, and there were slightly fewer weird problems like this after my changes. I could never replicate this particular bug, and i'm not familiar with any of the code that seems to be related. |
…ver moves the unit Fixes wesnoth#6960
…ver moves the unit Fixes wesnoth#6960
Game and System Information
The Battle for Wesnoth version 1.17.6+dev (565b318c9f0166d09f2dbff8f7982a52cd382dbb-Modified) x86_64
Running on Fedora Linux 36 (Workstation Edition) x86_64
Distribution channel: Default
SDL video drivers: wayland [x11] KMSDRM dummy
Window size: 1920x1021
Game canvas size: 1920x1021
Final render target size: 1920x1021
Screen refresh rate: 60
Boost: 1.76
Lua: 5.4.4
OpenSSL/libcrypto: 3.0.0e-dev (runtime 3.0.0e-dev)
Cairo: 1.17.6 (runtime 1.17.6)
Pango: 1.50.8 (runtime 1.50.8)
SDL: 2.0.22 (runtime 2.0.22)
SDL_image: 2.0.5 (runtime 2.0.5)
SDL_mixer: 2.0.4 (runtime 2.0.4)
Description of the bug
Unit's image is missing at the destination hex, sometimes the unit's image is irregularly blinking at hex when the unit was previously standing:
Steps to reproduce the behavior
Expected behavior
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: