MantisBT - VCMI
View Issue Details
0003032VCMIGUI - Battlespublic2019-02-08 10:482019-06-09 20:23
mpech 
AVS 
normalminoralways
resolvedno change required 
Ubuntu 16.04.5 LTS
 
1.next 
0003032: crash in CShootingAnimation (arrow_towers)
hi guys,

encoutered some crash and tried to investigate it

code version

    make: f06c8a872592bddfbe3fd5116979af0679f27bd3

stack trace

    0000002 0x00007f7029fcdbd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0xc98a3a "maxFrame > 0",
        file=file@entry=0xc98820 "/home/mpech2/dl/vcmi/client/battle/CBattleAnimations.cpp", line=line@entry=851,
        function=function@entry=0xc996a0 <CShootingAnimation::init()::__PRETTY_FUNCTION__> "virtual bool CShootingAnimation::init()") at assert.c:92
    0000003 0x00007f7029fcdc82 in __GI___assert_fail (assertion=0xc98a3a "maxFrame > 0",
        file=0xc98820 "/home/mpech2/dl/vcmi/client/battle/CBattleAnimations.cpp", line=851,
        function=0xc996a0 <CShootingAnimation::init()::__PRETTY_FUNCTION__> "virtual bool CShootingAnimation::init()") at assert.c:101
    0000004 0x000000000067a371 in CShootingAnimation::init (this=0x7f6fe041b680) at /home/mpech2/dl/vcmi/client/battle/CBattleAnimations.cpp:851
    0000005 0x00000000006cf6f6 in CBattleInterface::updateBattleAnimations (this=0x7f6fe06829e0)
        at /home/mpech2/dl/vcmi/client/battle/CBattleInterface.cpp:3599
    0000006 0x00000000006caf07 in CBattleInterface::show (this=0x7f6fe06829e0, to=0x37a7a70) at /home/mpech2/dl/vcmi/client/battle/CBattleInterface.cpp:3042

some additional logs (client/battle/CBattleAnimations.cpp)


    if (owner->idToProjectile.count(spi.creID) == 0){ //in some cases (known one: hero grants shooter bonus to unit) the shooter stack's projectile may not be properly initialized
        std::cout<<"faaaail"<<std::endl;
        owner->initStackProjectile(shooter);
    }else{
        std::cout<<"oook"<<owner->idToProjectile.count(spi.creID)<<std::endl;
    }

    // only frames below maxFrame are usable: anything higher is either no present or we don't know when it should be used
    size_t maxFrame = std::min<size_t>(angles.size(), owner->idToProjectile.at(spi.creID)->size(0));
    std::cout<<"shooter info :: "<<shooterInfo->idNumber<<std::endl;
    std::cout<<"creid : "<<spi.creID<<std::endl;
    std::cout<<"maxFrame??"<<angles.size()<<std::endl;
    std::cout<<"maxFrame proj??"<<owner->idToProjectile.at(spi.creID)->size(0)<<std::endl;
    assert(maxFrame > 0);

console output

    oook1
    shooter info :: 166
    creid : 149
    maxFrame??0
    maxFrame proj??0

---

both angles.size and idToProjectile.at.. return 0, then assert throws.
If I am not mistaken, creid 149 is ARROW_TOWERS (I am actually attacking a defended castle by hero)

I don't understand why ->size(0) would return 0 since animation for arrow_towers seem to be quite usual..
As for the defending hero it is in a castle modded (death valley) but that should still be independant from arrow_towers?


How should the investigation should be continued?
load attached save named "E"
as red, main hero, attack castle
instantly crash
Note that (as attacker) am also expert ballistics
No tags attached.
? e.vcgm1 (6,091,270) 2019-02-08 10:48
https://bugs.vcmi.eu/file_download.php?file_id=2979&type=bug
? e.vsgm1 (6,079,700) 2019-02-09 07:18
https://bugs.vcmi.eu/file_download.php?file_id=2980&type=bug
Issue History
2019-02-08 10:48mpechNew Issue
2019-02-08 10:48mpechFile Added: e.vcgm1
2019-02-08 11:42AVSNote Added: 0007744
2019-02-08 11:55AVSNote Added: 0007745
2019-02-08 11:55AVSAssigned To => AVS
2019-02-08 11:55AVSStatusnew => feedback
2019-02-09 07:18mpechFile Added: e.vsgm1
2019-02-09 13:12mpechNote Added: 0007746
2019-02-09 13:12mpechStatusfeedback => assigned
2019-02-09 13:19AVSNote Added: 0007747
2019-06-09 20:23AVSStatusassigned => resolved
2019-06-09 20:23AVSFixed in Version => 1.next
2019-06-09 20:23AVSResolutionopen => no change required

Notes
(0007744)
AVS   
2019-02-08 11:42   
Arrow Tower has no animation by itself, it uses animation of a shooter creature from town configuration. Check .jcon of your modded castle.
(0007745)
AVS   
2019-02-08 11:55   
Anyway e.vcgm1 is not enough, e.vsgm1 file is also required. At least a list of used mods is required too
(0007746)
mpech   
2019-02-09 13:12   
ok thanks for hint (again)

I am not sure if that is what should be done but this does seem to fix the issue.

In ./Mods/Deathvalley/Content/config/deathvalley/town.json
replaced

    "shooter" : "skel2"

by

    "shooter" : "boneHook"

reason was that skel2 didnot seem to be an archer (and probably the missing angleFrames or sthg)

./Mods/Deathvalley/Content/config/deathvalley/creatures/skel2.json

    {
        "skel2":
        {
            ...
            "graphics" :
            {
                "animation" : "deathvalley/battle/creatures/skel2.def",
                "map" : "deathvalley/map/skel2mini.def",
                "iconSmall" : "deathvalley/iconsSmall/skel2s.bmp",
                "iconLarge" : "deathvalley/iconsBig/skel2l.bmp",
                "timeBetweenFidgets" : 1,
                "animationTime" :
                {
                    "walk" : 1.40,
                    "attack" : 1,
                    "idle" : 10,
                    "flight" : 1
                }
                },
    }

on the opposite of the boneHook creature

./Mods/Deathvalley/Content/config/deathvalley/creatures/BoneHook.json

                "graphics" :
        {
            "animation" : "deathvalley/battle/creatures/BoneHook.def",
            "map" : "deathvalley/map/BoneHook.def",
            "iconSmall" : "deathvalley/iconsSmall/BoneHook.bmp",
            "iconLarge" : "deathvalley/iconsBig/BoneHook.bmp",
            "timeBetweenFidgets" : 1,
            "animationTime" :
            {
                "walk" : 1,
                "attack" : 1,
                "idle" : 10,
                "flight" : 1
            },
            "missile" :
            {
                "projectile" : "PLCBOWX.DEF",
                "attackClimaxFrame" : 7,
                "offset" :
                {
                    "upperX" : 38,
                    "upperY" : -65,
                    "middleX" : 36,
                    "middleY" : -59,
                    "lowerX" : 21,
                    "lowerY" : -50
                },
                "frameAngles" : [90, 72, 45, 27, 0, -27, -45, -72, -90, 0, 0, 0]
            }
        },
        ...

Somehow I seem to now be able to attack castle
(0007747)
AVS   
2019-02-09 13:19   
Complete "missile" section and shooting animation sections in "animation" is required for shooters.