rafaeru
Active Member
Hello, sometimes random player cause crash probably by look at item.
I'm using the server TFS 0.3.6.
I have no idea what is wrong. Maybe you have encountered a similar problem?
Additional question: is it possible to check what player caused the crash using GDB?
GDB log from crash:
game.cpp - Game : PlayerLookAt method:
I'm using the server TFS 0.3.6.
I have no idea what is wrong. Maybe you have encountered a similar problem?
Additional question: is it possible to check what player caused the crash using GDB?
GDB log from crash:
game.cpp - Game : PlayerLookAt method:
C++:
bool Game::playerLookAt(uint32_t playerId, const Position& pos, uint16_t spriteId, int16_t stackpos)
{
Player* player = getPlayerByID(playerId);
if(!player || player->isRemoved())
return false;
Thing* thing = internalGetThing(player, pos, stackpos, spriteId, STACKPOS_LOOK);
if(!thing)
{
player->sendCancelMessage(RET_NOTPOSSIBLE);
return false;
}
Position thingPos = pos;
if(pos.x == 0xFFFF)
thingPos = thing->getPosition();
if(!player->canSee(thingPos))
{
player->sendCancelMessage(RET_NOTPOSSIBLE);
return false;
}
Position playerPos = player->getPosition();
int32_t lookDistance = -1;
if(thing != player)
{
lookDistance = std::max(std::abs(playerPos.x - thingPos.x), std::abs(playerPos.y - thingPos.y));
if(playerPos.z != thingPos.z)
lookDistance = lookDistance + 9 + 6;
}
bool deny = false;
CreatureEventList lookEvents = player->getCreatureEvents(CREATURE_EVENT_LOOK);
for(CreatureEventList::iterator it = lookEvents.begin(); it != lookEvents.end(); ++it)
{
if(!(*it)->executeLook(player, thing, thingPos, stackpos, lookDistance))
deny = true;
}
if(deny)
return false;
std::stringstream ss;
ss << "You see " << thing->getDescription(lookDistance);
if(player->hasCustomFlag(PlayerCustomFlag_CanSeeItemDetails))
{
if(Item* item = thing->getItem())
{
ss << std::endl << "ItemID: [" << item->getID() << "]";
if(item->getActionId() > 0)
ss << ", ActionID: [" << item->getActionId() << "]";
if(item->getUniqueId() > 0)
ss << ", UniqueID: [" << item->getUniqueId() << "]";
ss << ".";
const ItemType& it = Item::items[item->getID()];
if(it.transformEquipTo)
ss << std::endl << "TransformTo: [" << it.transformEquipTo << "] (onEquip).";
else if(it.transformDeEquipTo)
ss << std::endl << "TransformTo: [" << it.transformDeEquipTo << "] (onDeEquip).";
else if(it.decayTo != -1)
ss << std::endl << "DecayTo: [" << it.decayTo << "].";
}
}
if(player->hasCustomFlag(PlayerCustomFlag_CanSeeCreatureDetails))
{
if(const Creature* creature = thing->getCreature())
{
ss << std::endl << "Health: [" << creature->getHealth() << " / " << creature->getMaxHealth() << "]";
if(creature->getMaxMana() > 0)
ss << ", Mana: [" << creature->getMana() << " / " << creature->getMaxMana() << "]";
ss << ".";
if(const Player* destPlayer = creature->getPlayer())
{
ss << std::endl << "IP: " << convertIPAddress(destPlayer->getIP()) << ", Client: " << destPlayer->getClientVersion() << ".";
if(destPlayer->isGhost())
ss << std::endl << "* Ghost mode *";
}
}
}
if(player->hasCustomFlag(PlayerCustomFlag_CanSeePosition))
ss << std::endl << "Position: [X: " << thingPos.x << "] [Y: " << thingPos.y << "] [Z: " << thingPos.z << "].";
player->sendTextMessage(MSG_INFO_DESCR, ss.str());
return true;
}
Last edited: