MantisBT - VCMI
View Issue Details
0000955VCMIAI - Adventure Mappublic2012-05-09 08:062014-05-30 17:43
Warmonger 
Tow 
normalcrashsometimes
closedfixed 
PCWindows 7SP1
0.88 
0.890.93 
0000955: Rare crash when AI attacks creature bank
Sometimes (like 1 in a 100) AI will cause crash when attacking creature bank. It happens randomly, but still.
Debugger pointed at this line in StupidAI:

if(distToNearestNeighbour(ei.s->position, dists) < GameConstants::BFIELD_SIZE)

However, that was caught in RD mode and can be not precise.
No tags attached.
duplicate of 0001076closed Tow Game crashes when AI is playing 
child of 0001053closed Tow Battle continues after AI clears Bank 
rar Bug955.rar (263,203) 2012-09-28 19:35
https://bugs.vcmi.eu/file_download.php?file_id=1099&type=bug
Issue History
2012-05-09 08:06WarmongerNew Issue
2012-05-09 08:06WarmongerStatusnew => assigned
2012-05-09 08:06WarmongerAssigned To => Tow
2012-05-09 17:57ZamolxisNote Added: 0002416
2012-05-09 18:09ZamolxisNote Edited: 0002416bug_revision_view_page.php?bugnote_id=2416#r1578
2012-08-31 16:34ZamolxisNote Edited: 0002416bug_revision_view_page.php?bugnote_id=2416#r1863
2012-09-28 09:08WarmongerRelationship addedduplicate of 0001076
2012-09-28 11:48WarmongerNote Added: 0003063
2012-09-28 11:49WarmongerRelationship addedchild of 0001053
2012-09-28 11:50WarmongerNote Edited: 0003063bug_revision_view_page.php?bugnote_id=3063#r1927
2012-09-28 16:49TowNote Added: 0003067
2012-09-28 16:49TowStatusassigned => resolved
2012-09-28 16:49TowFixed in Version => 0.9
2012-09-28 16:49TowResolutionopen => fixed
2012-09-28 19:29WarmongerNote Added: 0003073
2012-09-28 19:29WarmongerStatusresolved => feedback
2012-09-28 19:29WarmongerResolutionfixed => reopened
2012-09-28 19:35WarmongerFile Added: Bug955.rar
2012-09-28 19:36WarmongerNote Edited: 0003073bug_revision_view_page.php?bugnote_id=3073#r1929
2012-12-13 18:26WarmongerNote Added: 0003255
2012-12-13 18:26WarmongerStatusfeedback => assigned
2013-04-20 11:37TowNote Added: 0003490
2013-04-20 11:37TowStatusassigned => resolved
2013-04-20 11:37TowFixed in Version0.9 => 0.93
2013-04-20 11:37TowResolutionreopened => fixed
2014-05-30 17:43beegeeStatusresolved => closed

Notes
(0002416)
Zamolxis   
2012-05-09 17:57   
(edited on: 2012-08-31 16:34)
Could it be at the end of daily movement? I believe I had it on my own hero and was even reproducible (I'll do more tests when I find time to write a report).

(0003063)
Warmonger   
2012-09-28 11:48   
(edited on: 2012-09-28 11:50)
With latest changes, game crashes at
assert(enemiesUnreachable.size());

Looks like consequence of 0001053 - after clearing bank, AI attacks it again and finds empty battlefield.

CBattleAI [0E147F90]: activeStack called for Battle stack [6]: 9 creat
ures of Skeletons from slot 4 of armyobj=5201
CStupidAI [0E85D6F8]: actionStarted called
CBattleAI [0E147F90]: actionStarted called
CStupidAI [0E85D6F8]: battleStackMoved called
CBattleAI [0E147F90]: battleStackMoved called
CStupidAI [0E85D6F8]: battleAttack called
CBattleAI [0E147F90]: battleAttack called
CStupidAI [0E85D6F8]: battleStacksAttacked called
CBattleAI [0E147F90]: battleStacksAttacked called
CStupidAI [0E85D6F8]: battleAttack called
CBattleAI [0E147F90]: battleAttack called
CStupidAI [0E85D6F8]: battleStacksAttacked called
CBattleAI [0E147F90]: battleStacksAttacked called
CStupidAI [0E85D6F8]: actionFinished called
CBattleAI [0E147F90]: actionFinished called
CStupidAI [0E85D6F8]: activeStack called for Battle stack [1]: 84 crea
tures of Archers from slot 1 of armyobj=6214
CStupidAI [0E85D6F8]: actionStarted called
CBattleAI [0E147F90]: actionStarted called
CStupidAI [0E85D6F8]: battleAttack called
CBattleAI [0E147F90]: battleAttack called
CStupidAI [0E85D6F8]: battleStacksAttacked called
CBattleAI [0E147F90]: battleStacksAttacked called
CStupidAI [0E85D6F8]: actionFinished called
CBattleAI [0E147F90]: actionFinished called
                Player 3: I won the Starting battle of Loynis attackin
g Loynis the Cleric at 15 30 0!
CStupidAI [0E85D6F8]: battleEnd called
CStupidAI [0E85D6F8]: destroyed
CBattleAI [0E147F90]: battleEnd called
Warning: an orphaned child!
                Adding query 393 - Hero Loynis got level 5. Total quer
ies count: 1
                I'll answer the query 393 giving the choice 0
                Attempted answering query 393 - Hero Loynis got level
5. Request id=47133. Waiting for results...
                Adding query 394 - Blocking dialog query with 0 compon
ents - {Crypt}

You tentatively approach the burial crypt of ancient warriors. Do you
 want to search the graves?. Total queries count: 2
                I'll answer the query 394 giving the choice 1
                Attempted answering query 394 - Blocking dialog query
with 0 components - {Crypt}

You tentatively approach the burial crypt of ancient warriors. Do you
 want to search the graves?. Request id=47134. Waiting for results...
                Removing query 393 - Hero Loynis got level 5. Total qu
eries count: 1
                Removing query 394 - Blocking dialog query with 0 comp
onents - {Crypt}

You tentatively approach the burial crypt of ancient warriors. Do you
 want to search the graves?. Total queries count: 0
Opening StupidAI
Loaded Stupid AI 0.1
CStupidAI [0E85D148]: created
CStupidAI [0E85D148]: init called, saving ptr to IBattleCallback
CStupidAI [0E85D148]: battleStart called
CBattleAI [0E147F90]: battleStart called
CStupidAI [0E85D148]: battleNewRoundFirst called
CBattleAI [0E147F90]: battleNewRoundFirst called
CStupidAI [0E85D148]: battleNewRound called
CBattleAI [0E147F90]: battleNewRound called
CStupidAI [0E85D148]: activeStack called for Battle stack [2]: 1 creat
ures of Paladins from slot 254 of armyobj=6214
Assertion failed: enemiesUnreachable.size(), file StupidAI.cpp, line 1
59

(0003067)
Tow   
2012-09-28 16:49   
> Looks like consequence of 0001053 - after clearing bank, AI attacks it again and finds empty battlefield.

Yes, this is a reasonable explanation. So apparently this bug is just another manifestation of 0001053.

In r2941 I changed StupidAI to not crash when a buggy battle against nothing happens. This should fix this issue.
0001053 remains to be fixed.
(0003073)
Warmonger   
2012-09-28 19:29   
(edited on: 2012-09-28 19:36)
Unfortunatelly, it didn't help much. Game just crashed because bankConfig for cleared bank was null.
Suprisingly, debugger pointed inside CBank::endBattle() in the battle, which means that second battle started before all reward dialogs were handled.

This time it's reproductible, attached save. Brown hero Lacus should crash at Crypt.

(0003255)
Warmonger   
2012-12-13 18:26   
Today I managed to reproduce it as human player, that is Crypt visit dialog popped up on top of Commander level-up window.
(0003490)
Tow   
2013-04-20 11:37   
Fixed in r3336.