fheroes2 icon indicating copy to clipboard operation
fheroes2 copied to clipboard

Adventure map, Status Window of the hero's troops should be updated before the game returns to the adventure map screen

Open LeHerosInconnu opened this issue 2 years ago • 3 comments

Preliminary checks

Platform

Windows

Describe the bug

In the original game, after a combat, the Status Window of the hero's troops, at the bottom right of the screen, is updated before the game returns to the adventure map screen.

In original game:

https://user-images.githubusercontent.com/43583994/173812047-90384fde-0720-42a0-a719-c330c9845c69.mp4

In fheroes2, after a combat, this same window is updated after the game returns to the adventure map screen.

In fheroes2:

https://user-images.githubusercontent.com/43583994/173812255-f64317dc-4325-48ac-a298-bae63e0411ba.mp4

https://user-images.githubusercontent.com/43583994/173812353-b392d644-c19a-46dd-97e9-732d31589eb7.mp4

https://user-images.githubusercontent.com/43583994/173812389-7d58a794-7c28-4884-9942-064c421a229e.mp4

Save file

Here are the save files: Update status window 01.zip

Additional info

Version 0.9.16 5530

LeHerosInconnu avatar Jun 15 '22 11:06 LeHerosInconnu

Hi @LeHerosInconnu , I tested your save and my other saves on latest build and everything works fine. Could you please verify it?

ihhub avatar Jul 20 '22 16:07 ihhub

Hello @ihhub,

Hi @LeHerosInconnu , I tested your save and my other saves on latest build and everything works fine. Could you please verify it?

I have checked with version 0.9.17 5675 and it is still the case.

LeHerosInconnu avatar Jul 20 '22 16:07 LeHerosInconnu

Hi @ihhub,

The issue can be easy reproduced - the hero's army gets updated too late, after receiving skills, after the enemy disappears. I am going to submit a fix, a new function in heroes_action.cpp

Battle::Result Fight( Army & army1, Army & army2, int32_t dst_index )
{
    Interface::Basic & I = Interface::Basic::Get();
    Battle::Result res = Battle::Loader( army1, army2, dst_index );

    // #5541: We have to update status window immediately after the battle
    // and reflect the changes in the hero's army before receiving skills,
    // before the enemy/monster starts to slowly disappear.
    // If the hero wins, it will show updated army 
    // If the hero loses, switch status window to the next status to hide the army
    if ( !res.AttackerWins() )
        I.GetStatusWindow().NextState();
    I.Redraw( Interface::REDRAW_STATUS );

    return res;
}

and then all the battles in the file are replaced by this function. I've tested, it works fine.

aanokhi avatar Aug 19 '22 01:08 aanokhi