Notes |
|
(0005498)
|
SXX
|
2015-02-15 01:50
|
|
This one is reproducible with current git. Crash occur because AI trying to use hero that just died in battle.
It's likely occur because in this case lost hero handled by the "VCAI::objectRemoved" and not "VCAI::moveHeroToTile" that have appropriate exception for that case. |
|
|
(0005499)
|
SXX
|
2015-02-15 02:00
|
|
And this is likely happen because AI don't actually expect to be attacked.
This is related to different bug of VCMI where it's behaviour isn't like one in H3. Currently if your hero stay go into the Subterranean Gate and there is moster if you press "space bar" you won't go back, but instead will attack it.
I suppose that AI try to go back, but after being attacked he get "objectRemoved" event and had to react on it. Once reacted it's try to continue movement of hero and this obviously cause crash because hero object is already removed. |
|
|
(0005501)
|
SXX
|
2015-02-15 02:20
|
|
So here is two things need to be done:
1 - Origin of that problem 0001990 have to be fixed.
2 - And in case hero was removed during objectRemoved callback we need to make sure that this hero was properly removed from VCAI state and it's won't attempt to use it. |
|
|
(0005503)
|
SXX
|
2015-02-15 02:40
|
|
Also this one really need to be fixed as "objectRemoved" at least used in situation when AI hero is died on "event" with guard. E.g when AI didn't expect to be attacked at all. |
|
|
(0005504)
|
SXX
|
2015-02-15 03:52
|
|
Ok find out that objectRemoved event occur even if hero died bank, but there is difference:
1 - In "VCAI::moveHeroToTile" there is two calls of "waitTillFree".
2 - When objectRemoved event occur main AI thread wait for that.
3 - As result in 2nd case it's will throw std::runtime_error("Hero was lost!"); error
4 - Though in first case where "startHpos == dst" (e.g when hero attack monster while using subt. gate) there is no check if hero died while thread was waiting.
So dirty solution would be copy paste that check here too or the code need to be rewritten. |
|
|
|
The spread of the most bug causing crash on this build. I would have said so. At least for me. |
|
|
(0005540)
|
SXX
|
2015-02-18 12:06
|
|
Yeah this problem likely appear really often. Though I'll prefer to fix origin of the problem first and only then add cleaner solution for this problem as likely this should never ever happen except it's even (which is rare and even more rarely work for the AI). |
|
|
(0005573)
|
SXX
|
2015-02-22 18:11
|
|
So first of all I fixed 0001990 and also added additional check in code:
https://github.com/vcmi/vcmi/commit/ea46be03f3fcbe653433506db13bb73ccc30db31 [^]
So this one is resolved, but it's still questionable if that check needed at all.
Initially I think that problem may occur when hero visit event, but this code path only use when hero visit object under him while standing. In same time I find that it may happen if hero staying on creature bank may try to visit it (after get additional reinforcements).
Though this is really hard to test so for now I'll just leave check there. |
|