Yamaken
Pro OpenTibia Developer
- Joined
- Jul 27, 2013
- Messages
- 534
- Solutions
- 4
- Reaction score
- 432
Hello, i have follow this tutorial http://otland.net/threads/solved-sending-more-tiles-to-client.200004/ and done what was said to OTClient and TFS.
The problem is, i have get this errors on OTClient:
I really think its related to Creature movement.
Can anyone check this code please?
I think the problem is on moving to south and east.
Thank you.
The problem is, i have get this errors on OTClient:
"no creature found to move"
"no thing at pos:%s, stackpos:%d"
I really think its related to Creature movement.
Can anyone check this code please?
Code:
void ProtocolGame::sendMoveCreature(const Creature* creature, const Tile*, const Position& newPos,
uint32_t newStackpos, const Tile*, const Position& oldPos, uint32_t oldStackpos, bool teleport)
{
if(creature == player)
{
NetworkMessage_ptr msg = getOutputBuffer();
if(!msg)
return;
TRACK_MESSAGE(msg);
if(teleport || oldStackpos >= 10)
{
RemoveTileItem(msg, oldPos, oldStackpos);
AddMapDescription(msg, newPos);
}
else
{
if(oldPos.z != 7 || newPos.z < 8)
{
msg->put<char>(0x6D);
msg->putPosition(oldPos);
msg->put<char>(oldStackpos);
msg->putPosition(newPos);
}
else
RemoveTileItem(msg, oldPos, oldStackpos);
if(newPos.z > oldPos.z)
MoveDownCreature(msg, creature, newPos, oldPos, oldStackpos);
else if(newPos.z < oldPos.z)
MoveUpCreature(msg, creature, newPos, oldPos, oldStackpos);
if(oldPos.y > newPos.y) // north, for old x
{
msg->put<char>(0x65);
GetMapDescription(oldPos.x - 14, newPos.y - 12, newPos.z, 30, 1, msg);
}
else if(oldPos.y < newPos.y) // south, for old x
{
msg->put<char>(0x67);
GetMapDescription(oldPos.x - 14, newPos.y + 13, newPos.z, 30, 1, msg);
}
if(oldPos.x < newPos.x) // east, [with new y]
{
msg->put<char>(0x66);
GetMapDescription(newPos.x + 15, newPos.y - 12, newPos.z, 1, 26, msg);
}
else if(oldPos.x > newPos.x) // west, [with new y]
{
msg->put<char>(0x68);
GetMapDescription(newPos.x - 14, newPos.y - 12, newPos.z, 1, 26, msg);
}
}
}
else if(canSee(oldPos) && canSee(newPos))
{
if(!player->canSeeCreature(creature))
return;
NetworkMessage_ptr msg = getOutputBuffer();
if(!msg)
return;
TRACK_MESSAGE(msg);
if(!teleport && (oldPos.z != 7 || newPos.z < 8) && oldStackpos < 10)
{
msg->put<char>(0x6D);
msg->putPosition(oldPos);
msg->put<char>(oldStackpos);
msg->putPosition(newPos);
}
else
{
RemoveTileItem(msg, oldPos, oldStackpos);
AddTileCreature(msg, newPos, newStackpos, creature);
}
}
else if(canSee(oldPos))
{
if(!player->canSeeCreature(creature))
return;
NetworkMessage_ptr msg = getOutputBuffer();
if(!msg)
return;
TRACK_MESSAGE(msg);
RemoveTileItem(msg, oldPos, oldStackpos);
}
else if(canSee(newPos) && player->canSeeCreature(creature))
{
NetworkMessage_ptr msg = getOutputBuffer();
if(!msg)
return;
TRACK_MESSAGE(msg);
AddTileCreature(msg, newPos, newStackpos, creature);
}
}
I think the problem is on moving to south and east.
Thank you.