• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua How to fix "call to stack overflow"? - TFS 1.2

Joined
Jul 18, 2014
Messages
193
Solutions
2
Reaction score
15
Hi, i have a problem, the famous "stack overflow" that closes the server. I don't know why this happens, i know that it's by a infinite loop and i know that the problem is from MoveEvents because in console appears. It's really hard check file by file until find the bug. Someone knows how to fix it using another way? Or if there's a file that it's bugged by default in TFS 1.2?

Thanks.
 
Code:
Em suas sources, abra o arquivo creature.cpp procure por:

void Creature::eek:nCreatureAppear(Creature* creature, bool)
Vamos adicionar um isLogin, ou seja substitua a linha a cima por:

void Creature::eek:nCreatureAppear(Creature* creature, bool isLogin)
 

Ainda no creature.cpp procure por:

if (creature == this) {
        if (useCacheMap()) {
             isMapLoaded = true;
             updateMapCache();
         }
Logo abaixo pule uma linha e adicione:

if (isLogin) {
           setLastPosition(getPosition());
        }
 


Agora abra o seu creature.h

Na linha 156 procure por:

virtual void addList() = 0;
Pule uma linha e adicione:

const Position& getLastPosition() const {
           return lastPosition;
        }
        void setLastPosition(const Position& newLastPos) {
            lastPosition = newLastPos;
        }
Ainda no creature.h procure por
 

virtual void onCreatureAppear(Creature* creature, bool);
Substitua a linha a cima por:

virtual void onCreatureAppear(Creature* creature, bool isLogin);
Procure por:

Outfit_t defaultOutfit;
Pule uma linha e adicione:

Position lastPosition;
 

 

Agora abra o seu game.cpp e procure por:

ReturnValue Game::internalMoveCreature(Creature* creature, Direction direction, uint32_t flags /*= 0*/)
 {
Logo abaixo adicione:

creature->setLastPosition(creature->getPosition());
 

Agora por fim, abra seu movement.cpp procure por:

LuaScriptInterface::pushPosition(L, fromPos);
Substitua a linha a cima por:

LuaScriptInterface::pushPosition(L, creature->getLastPosition());
 
Awesome dude! I'll test it. Thanks

Code:
Em suas sources, abra o arquivo creature.cpp procure por:

void Creature::eek:nCreatureAppear(Creature* creature, bool)
Vamos adicionar um isLogin, ou seja substitua a linha a cima por:

void Creature::eek:nCreatureAppear(Creature* creature, bool isLogin)
 

Ainda no creature.cpp procure por:

if (creature == this) {
        if (useCacheMap()) {
             isMapLoaded = true;
             updateMapCache();
         }
Logo abaixo pule uma linha e adicione:

if (isLogin) {
           setLastPosition(getPosition());
        }
 


Agora abra o seu creature.h

Na linha 156 procure por:

virtual void addList() = 0;
Pule uma linha e adicione:

const Position& getLastPosition() const {
           return lastPosition;
        }
        void setLastPosition(const Position& newLastPos) {
            lastPosition = newLastPos;
        }
Ainda no creature.h procure por
 

virtual void onCreatureAppear(Creature* creature, bool);
Substitua a linha a cima por:

virtual void onCreatureAppear(Creature* creature, bool isLogin);
Procure por:

Outfit_t defaultOutfit;
Pule uma linha e adicione:

Position lastPosition;
 

 

Agora abra o seu game.cpp e procure por:

ReturnValue Game::internalMoveCreature(Creature* creature, Direction direction, uint32_t flags /*= 0*/)
 {
Logo abaixo adicione:

creature->setLastPosition(creature->getPosition());
 

Agora por fim, abra seu movement.cpp procure por:

LuaScriptInterface::pushPosition(L, fromPos);
Substitua a linha a cima por:

LuaScriptInterface::pushPosition(L, creature->getLastPosition());
This how can help me?
 
Last edited by a moderator:
yes... sorry but i 'm brazilian and no speak english =/
translate the portugueses instrucions and u can make the fix

Estou fazendo isso eu não vou ter o problema do "stack overflow"?

Doing this i wont get again the "stack overflow" problem?

yes... sorry but i 'm brazilian and no speak english =/
translate the portugueses instrucions and u can make the fix
Im seeing my sources and i already got it :/
 
Last edited by a moderator:
Back
Top