MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003041VCMIMechanics - Adventure Mappublic2019-02-23 13:552019-02-24 16:43
Reportermpech 
Assigned ToNullkiller 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformUbuntu 16.04.5 LTSOSOS Version
Product Version 
Target VersionFixed in Version1.next 
Summary0003041: AI infinite loop due to town portal
DescriptionHi guys,

getting an infinite loop:

...
No town at destination tile
System message: Server encountered a problem: No town at destination tile
Hero Sandro cannot reach (45 36 1).
No town at destination tile
System message: Server encountered a problem: No town at destination tile
Hero Sandro cannot reach (45 36 1).
Steps To Reproduceload map
end turn
see green never ending
Additional Information
By adding an assert(false) in TownPortalMechanics::applyAdventureEffects

    +++ b/lib/spells/AdventureSpellMechanics.cpp
    @@ -370,6 +370,8 @@ ESpellCastResult TownPortalMechanics::applyAdventureEffects(const SpellCastEnvir
                    if(tile.visitableObjects.empty() || tile.visitableObjects.back()->ID != Obj::TOWN)
                    {
                            env->complain("No town at destination tile");
    + assert(false);
                            return ESpellCastResult::ERROR;
                    }
 

in I get

    0000002 0x00007f8f509f5bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x7f8f52aee4ca "false",
        file=file@entry=0x7f8f52acb330 "/home/mpech2/dl/vcmi/lib/spells/AdventureSpellMechanics.cpp", line=line@entry=379,
        function=function@entry=0x7f8f52acb7c0 <TownPortalMechanics::applyAdventureEffects(SpellCastEnvironment const*, AdventureSpellCastParameters const&) const::__PRETTY_FUNCTION__> "virtual ESpellCastResult TownPortalMechanics::applyAdventureEffects(const SpellCastEnvironment*, const AdventureSpellCastParameters&) const") at assert.c:92
    0000003 0x00007f8f509f5c82 in __GI___assert_fail (assertion=assertion@entry=0x7f8f52aee4ca "false",
        file=file@entry=0x7f8f52acb330 "/home/mpech2/dl/vcmi/lib/spells/AdventureSpellMechanics.cpp", line=line@entry=379,
        function=function@entry=0x7f8f52acb7c0 <TownPortalMechanics::applyAdventureEffects(SpellCastEnvironment const*, AdventureSpellCastParameters const&) const::__PRETTY_FUNCTION__> "virtual ESpellCastResult TownPortalMechanics::applyAdventureEffects(const SpellCastEnvironment*, const AdventureSpellCastParameters&) const") at assert.c:101
    0000004 0x00007f8f528abdec in TownPortalMechanics::applyAdventureEffects (this=<optimized out>, env=0x7f8f40006490, parameters=...)
        at /home/mpech2/dl/vcmi/lib/spells/AdventureSpellMechanics.cpp:379
    0000005 0x00007f8f528a76df in AdventureSpellMechanics::performCast (this=this@entry=0x7f8f406e7ad0, env=env@entry=0x7f8f40006490, parameters=...)
        at /home/mpech2/dl/vcmi/lib/spells/AdventureSpellMechanics.cpp:109
    0000006 0x00007f8f528a79b2 in AdventureSpellMechanics::adventureCast (this=0x7f8f406e7ad0, env=0x7f8f40006490, parameters=...)
        at /home/mpech2/dl/vcmi/lib/spells/AdventureSpellMechanics.cpp:63
    0000007 0x00007f8f528b6f22 in CSpell::adventureCast (this=this@entry=0x7f8f40629200, env=0x7f8f40006490, parameters=...)
        at /home/mpech2/dl/vcmi/lib/spells/CSpellHandler.cpp:131
    0000008 0x0000000000504a23 in CastAdvSpell::applyGh (this=0x7f8f4000fff0, gh=0x7f8f4002b560) at /home/mpech2/dl/vcmi/server/NetPacksServer.cpp:360
    0000009 0x0000000000466ff9 in CApplyOnGH<CastAdvSpell>::applyOnGH (this=<optimized out>, gh=<optimized out>, pack=<optimized out>)
        at /home/mpech2/dl/vcmi/server/CGameHandler.cpp:194
    0000010 0x000000000044afa7 in CGameHandler::handleReceivedPack (this=0x7f8f4002b560, pack=0x7f8f4000fff0)
        at /home/mpech2/dl/vcmi/server/CGameHandler.cpp:1233
    0000011 0x00000000004d1cec in CVCMIServer::threadHandleClient (this=0x7ffd1994c810, c=std::shared_ptr (count 15, weak 1) 0x7f8f48000ad0)
        at /home/mpech2/dl/vcmi/server/CVCMIServer.cpp:319
    0000012 0x00000000004df3f8 in boost::_mfi::mf1<void, CVCMIServer, std::shared_ptr<CConnection> >::operator() (a1=..., p=<optimized out>,
        this=<optimized out>) at /usr/include/boost/bind/mem_fn_template.hpp:165
TagsNo tags attached.
Attached Fileszip file icon inftp.zip [^] (2,361,196 bytes) 2019-02-23 13:55
txt file icon log.txt [^] (6,481 bytes) 2019-02-23 15:26 [Show Content]
? file icon Dragon Lord.h3m [^] (134,259 bytes) 2019-02-23 17:14

- Relationships

-  Notes
(0007756)
AVS (administrator)
2019-02-23 14:10

The question is: is the town actually there?
(0007757)
mpech (reporter)
2019-02-23 16:59

not sure if question was adressed to me, but in doubt I attached the map and it seems that the town does exist ("necropolis")
(0007758)
AVS (administrator)
2019-02-23 17:14

Re-uploaded map without excess zipping.
(0007759)
AVS (administrator)
2019-02-23 17:35

Actually there is additional bug in error handling, town is there but already occupied, I`ll fix it first.
(0007760)
AVS (administrator)
2019-02-23 18:51

Now it correctly reports "Can't teleport to occupied town". The bug itself to be fixed still.
(0007761)
Nullkiller (developer)
2019-02-24 13:19
edited on: 2019-02-24 13:38

I expect that TSubgoal AdventureSpellCast::whatToDoToAchieve() should be altered to check if the town is free in order to fix it. I need a complete list of mods in order to be able to run it from the save file.

Probably this should work but without either client log file or list of mods I can nor launch the save neither guess more or less precisely where the bug is.

    if(spellID == SpellID::TOWN_PORTAL && town && town->visitingHero)
        throw cannotFulfillGoalException("The town is already occupied by " + town->visitingHero->name);

(0007762)
AVS (administrator)
2019-02-24 13:26

@Nullkiller save contains all mods data inside, except graphics assets. In most cases it loads OK, at least it works for me (but I have a few mods installed). In general yes, mods should be listed in bug report.
(0007763)
Nullkiller (developer)
2019-02-24 13:39

@AVS disaster happened. Mod not found preserve.
(0007764)
AVS (administrator)
2019-02-24 13:49

I have that, also HotA and Retreat are used in that save too.
Links to all these mods are in wiki
https://wiki.vcmi.eu/Mod_list [^]
(0007765)
Nullkiller (developer)
2019-02-24 13:50

@AVS, downloaded preserve and no it works
(0007766)
AVS (administrator)
2019-02-24 15:42

I`ll check quick fix add push if it helps, proper fix should be added probably somewhere in AINodeStorage::calculateTownPortalTeleportations
(0007767)
mpech (reporter)
2019-02-24 15:49

apologies for not having specified used mods, I will in the future...
mods used are
witchking artifacts
hota
Death valley
Preserve Town
Retreat
(0007768)
AVS (administrator)
2019-02-24 16:43

Fix for infinite loop commited in https://github.com/vcmi/vcmi/commit/f36a86412e2dfc76af8dd16dc71bb9c29bb10885 [^]

https://github.com/vcmi/vcmi/pull/553 [^] to bring more robust fix for the problem but it is out of scope of this ticket.

- Issue History
Date Modified Username Field Change
2019-02-23 13:55 mpech New Issue
2019-02-23 13:55 mpech File Added: inftp.zip
2019-02-23 14:10 AVS Note Added: 0007756
2019-02-23 15:07 AVS Assigned To => AVS
2019-02-23 15:07 AVS Status new => confirmed
2019-02-23 15:26 AVS File Added: log.txt
2019-02-23 15:50 AVS Assigned To AVS => Nullkiller
2019-02-23 15:50 AVS Status confirmed => assigned
2019-02-23 16:58 mpech File Added: dragonLord.h3m
2019-02-23 16:59 mpech Note Added: 0007757
2019-02-23 17:13 AVS File Deleted: dragonLord.h3m
2019-02-23 17:14 AVS File Added: Dragon Lord.h3m
2019-02-23 17:14 AVS Note Added: 0007758
2019-02-23 17:35 AVS Note Added: 0007759
2019-02-23 18:51 AVS Note Added: 0007760
2019-02-24 13:19 Nullkiller Note Added: 0007761
2019-02-24 13:26 AVS Note Added: 0007762
2019-02-24 13:38 Nullkiller Note Edited: 0007761 View Revisions
2019-02-24 13:39 Nullkiller Note Added: 0007763
2019-02-24 13:49 AVS Note Added: 0007764
2019-02-24 13:50 Nullkiller Note Added: 0007765
2019-02-24 15:42 AVS Note Added: 0007766
2019-02-24 15:49 mpech Note Added: 0007767
2019-02-24 16:43 AVS Note Added: 0007768
2019-02-24 16:43 AVS Status assigned => resolved
2019-02-24 16:43 AVS Fixed in Version => 1.next
2019-02-24 16:43 AVS Resolution open => fixed

Site | Forums | Wiki | Slack | GitHub


Copyright © 2000 - 2024 MantisBT Team
Hosting provided by DigitalOcean