MantisBT - VCMI
View Issue Details
0001897VCMIAI - Adventure Mappublic2014-09-23 17:192022-04-12 11:18
Win XP sp2
0001897: Game hangs after AI captures town from player in battle
probably occurred due to the fact that I fought back from a random city

it was [^]

Summary edited, was "After the battle, the game is blocked"
end turn, AI atack on castle kill my unit and game freeze
конец хода, ИИ нападает на город, убивает моего юнита сидящего в нем и игра фризится.
No tags attached.
has duplicate 0001948closed SXX [Android][Freeze] Finishing an attacking AI battle will freeze the game 
has duplicate 0002045closed  Wyłącza się jak Ktoś atakuje mi miasto 
has duplicate 0002163closed SXX Multiplayer: freeze if 1st player end turn after PVP battle before 2nd player closed battle result screen 
related to 0001724closed  I loose game, but crash, 
related to 0002122closed Warmonger When ai take my town - crash 
related to 0002141closed SXX end turn battle 
related to 0002597closed SXX Freeze after battle 
? Arrogance5.h3m (12,197) 2014-09-23 17:19
txt VCMI_Client_log.txt (676,338) 2014-09-23 17:19
txt VCMI_Server_log.txt (442,749) 2014-09-23 17:20
Issue History
2014-09-23 17:19PovelitelNew Issue
2014-09-23 17:19PovelitelStatusnew => assigned
2014-09-23 17:19PovelitelAssigned To => Tow
2014-09-23 17:19PovelitelFile Added: Arrogance5.h3m
2014-09-23 17:19PovelitelFile Added: VCMI_Client_log.txt
2014-09-23 17:20PovelitelFile Added: VCMI_Server_log.txt
2014-09-23 17:42IvanCategoryAI - Battles => AI - Adventure Map
2014-09-23 17:42IvanSummaryAfter the battle, the game is blocked => Game hangs after AI captures town from player in battle
2014-09-23 17:42IvanDescription Updatedbug_revision_view_page.php?rev_id=2637#r2637
2014-11-20 12:22PovelitelNote Added: 0005133
2014-11-20 12:22PovelitelNote Edited: 0005133bug_revision_view_page.php?bugnote_id=5133#r2714
2014-12-20 10:46WarmongerRelationship addedhas duplicate 0001948
2014-12-27 17:43WarmongerRelationship addedrelated to 0001724
2015-01-24 21:29WarmongerRelationship addedhas duplicate 0002045
2015-03-05 13:24WarmongerRelationship addedrelated to 0002122
2015-03-25 09:33WarmongerRelationship addedrelated to 0002141
2016-10-02 12:24PovelitelAssigned ToTow => SXX
2016-11-03 08:47PovelitelNote Added: 0006888
2016-11-03 08:49PovelitelSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=3300#r3300
2016-11-10 09:42PovelitelRelationship addedrelated to 0002597
2017-01-28 21:21val-gaavNote Added: 0006962
2017-02-01 15:08DydzioNote Added: 0006965
2017-03-18 18:37DydzioNote Added: 0006988
2017-03-18 22:29SXXRelationship addedhas duplicate 0002163
2017-03-18 22:29SXXNote Added: 0006989
2017-03-19 02:25SXXNote Added: 0006990
2017-03-19 02:25SXXStatusassigned => resolved
2017-03-19 02:25SXXFixed in Version =>
2017-03-19 02:25SXXResolutionopen => fixed
2022-04-12 11:18PovelitelStatusresolved => closed

2014-11-20 12:22   
Now (0.97), this is hero just not attacks :D

2016-11-03 08:47   
0.99 still reproducibility
2017-01-28 21:21   
I can confirm this bug with 0.99

If you change to quick combat before ending turn the AI will take castle and the game will not freeze. So at least there is a way to continue game.
2017-02-01 15:08   
I also noticed that you can press alt + f4 and then press cancel to "unfreeze".
2017-03-18 18:37   
Result of little research: CPlayerInterface::playerStartsTurn gets called during battle result screen, and following code from that method brutally deletes result window:

while (GH.listInt.front() != adventureInt && !dynamic_cast<CInfoWindow*>(GH.listInt.front()))

After adding "&& !dynamic_cast<CBattleResultWindow*>(GH.listInt.front())" to above "while" loop and properly closing battle result window deadlock is solved. This is most likely not proper fix and it looks like CPlayerInterface::playerStartsTurn is not designed to be called during something else than adventure screen. End turn of blue player seems to be undesired in this case. Further investigation is needed.
2017-03-18 22:29   
0002163 likely caused by same problem.
2017-03-19 02:25   
This is now fixed: [^]

Thanks to @dydzio to pointing out and testing.