• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.2 Crash databasetasks.cpp (something with attack?)

Solution
Your first custom code is missing return, you are forcing searchTarget which could alter attackedCreature and thus you could possibly dereference null pointer.
Add return; after searchTarget.
Not to mention this is wrong place to put code with this logic in.
Maybe its something with range spell?
Monster::canUseSpell (this=this@entry=0x7fffe91961e0, pos=..., targetPos=..., sb=..., interval=interval@entry=200, inRange=@0x7ffff4fe2daf: true,
 
Thread 4 and 3 had locked context, SIGSEGV was called from thread no. 2 which called #0 Position::getOffsetY (p2=..., p1=...) at /home/debian/server/src/position.h:58
I'm pretty sure that there was nullptr
 
Thread 4 and 3 had locked context, SIGSEGV was called from thread no. 2 which called #0 Position::getOffsetY (p2=..., p1=...) at /home/debian/server/src/position.h:58
I'm pretty sure that there was nullptr
So who causes this null value?
 
Post your monster doAttacking method code
C++:
void Monster::doAttacking(uint32_t interval)
{
    if (!attackedCreature || (isSummon() && attackedCreature == this)) {
        return;
    }

    Player* player = attackedCreature->getPlayer();
    if(player && !trySaga(player))
    {
        setFollowCreature(NULL);
        setAttackedCreature(NULL);
        searchTarget(TARGETSEARCH_NEAREST);
    }    

    bool updateLook = true;
    bool resetTicks = interval != 0;
    attackTicks += interval;

    const Position& myPos = getPosition();
    const Position& targetPos = attackedCreature->getPosition();

    for (const spellBlock_t& spellBlock : mType->attackSpells) {
        bool inRange = false;

        if (canUseSpell(myPos, targetPos, spellBlock, interval, inRange, resetTicks)) {
            if (spellBlock.chance >= static_cast<uint32_t>(uniform_random(1, 100))) {
                if (updateLook) {
                    updateLookDirection();
                    updateLook = false;
                }

                minCombatValue = spellBlock.minCombatValue;
                maxCombatValue = spellBlock.maxCombatValue;
                spellBlock.spell->castSpell(this, attackedCreature);
                if (!attackedCreature) {
                    break;
                }

                if (spellBlock.isMelee) {
                    extraMeleeAttack = false;
                }
            }
        }

        if (!inRange && spellBlock.isMelee) {
            //melee swing out of reach
            extraMeleeAttack = true;
        }
    }

    if (updateLook) {
        updateLookDirection();
    }

    if (resetTicks) {
        attackTicks = 0;
    }
}
 
Your first custom code is missing return, you are forcing searchTarget which could alter attackedCreature and thus you could possibly dereference null pointer.
Add return; after searchTarget.
Not to mention this is wrong place to put code with this logic in.
 
Solution
Your first custom code is missing return, you are forcing searchTarget which could alter attackedCreature and thus you could possibly dereference null pointer.
Add return; after searchTarget.
Not to mention this is wrong place to put code with this logic in.
We will see if it crashes again.
 
Back
Top