[Solved] Crash PlayerBots on map update

Issue #12 resolved
David Magalhães created an issue
[New Thread 15046]
[New Thread 15055]
[New Thread 15054]
[New Thread 15053]
[New Thread 15052]
[New Thread 15050]
[New Thread 15049]
[New Thread 14958]
[New Thread 14957]
[New Thread 14956]
[New Thread 14955]
[New Thread 14954]
[New Thread 14953]
[New Thread 14951]
[New Thread 14950]
[Thread debugging using libthread_db enabled]
Core was generated by `/home/server/Core/Winterchill/bin/worldserver'.
Program terminated with signal 11, Segmentation fault.
#0  0x00000000009ea5f8 in WorldObject::GetMap (this=<value optimized out>)
    at /home/server/Core/Sources/recent/FaceCore/src/server/game/Entities/Object/Object.h:772
772         Map* GetMap() const { ASSERT(m_currMap); return m_currMap; }

this crash only happens on playerbot use

Comments (9)

  1. David Magalhães reporter

    this is reproduced for example, a player is in a instance and then accepts bg queue

  2. David Magalhães reporter

    in witch part of the code i can disable certain zones/maps to avoid crashes when the bots load the map where the owner is?

  3. trickerer repo owner

    Can I have full crashlog? Cuz I cannot reproduce this crash. I also need to know if any other patches are used.

  4. David Magalhães reporter

    this is full crashlog using -DWITH_COREDEBUG=1 in cmake

    no extra patches, clean tc, latest.

  5. David Magalhães reporter

    but i just tested seconds ago and happened the same, there is any way to remove bots from party when owner accepts enter dungeon?

  6. trickerer repo owner

    78ce3ce6b0 shoul fix it.
    But, if you want bots to be removed on player teleport, go to Player.cpp
    Player::TeleportTo(uint32, float, float, float, float, uint32)
    row ~2155
    find this code around there...

        // Playerbot mod: if this user has bots, tell them to stop following master
        // so they don't try to follow the master after the master teleports
        for (PlayerBotMap::const_iterator itr = GetSession()->GetPlayerBotsBegin(); itr != GetSession()->GetPlayerBotsEnd(); ++itr)
            if (Player* botPlayer = itr->second)
                botPlayer->GetMotionMaster()->Clear();
        //Npcbot mod: prevent crash on InstanceMap::DestroyInstance()... Unit::RemoveFromWorld()
        //if last player being kicked out of instance while having npcbots
        //we must remove creature Before it will be removed in Map::UnloadAll()
        if (GetMapId() != mapid)
            for (uint8 i = 0; i != GetMaxNpcBots(); ++i)
                RemoveBot(m_botmap[i].m_guid);
    

    ...and add this

        // Playerbot mod: if this user has bots, tell them to stop following master
        // so they don't try to follow the master after the master teleports
        for (PlayerBotMap::const_iterator itr = GetSession()->GetPlayerBotsBegin(); itr != GetSession()->GetPlayerBotsEnd(); ++itr)
            if (Player* botPlayer = itr->second)
                botPlayer->GetMotionMaster()->Clear();
    +    // Playerbot mod: remove bots on teleport if destination is not a World Map
    +    if (MapEntry const* mEntry = sMapStore.LookupEntry(mapid))
    +        if (!mEntry->IsWorldMap())
    +            while (!GetSession()->m_playerBots.empty())
    +                GetSession()->LogoutPlayerBot(GetSession()->GetPlayerBotsBegin()->first);
        //Npcbot mod: prevent crash on InstanceMap::DestroyInstance()... Unit::RemoveFromWorld()
        //if last player being kicked out of instance while having npcbots
        //we must remove creature Before it will be removed in Map::UnloadAll()
        if (GetMapId() != mapid)
            for (uint8 i = 0; i != GetMaxNpcBots(); ++i)
                RemoveBot(m_botmap[i].m_guid);
    

    This should remove all bots if map player is about to enter is not a common map.
    Change conditions to whatever you wish

  7. David Magalhães reporter

    thanks a lot for the quick answer and dedication. i really aprecciate the work you have here :)

  8. Log in to comment