Skip to content

Commit e587642

Browse files
committed
onUpdateDataFromClient协议加入spaceID信息。
1 parent eebe320 commit e587642

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

‎kbe/src/lib/client_lib/clientobjectbase.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ void ClientObjectBase::updatePlayerToServer()
962962
(*pBundle) << dir.roll();
963963

964964
(*pBundle) << pEntity->isOnGound();
965+
(*pBundle) << spaceID_;
965966
pServerChannel_->pushBundle(pBundle);
966967
}
967968

‎kbe/src/server/baseapp/baseapp.cpp‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2563,8 +2563,12 @@ void Baseapp::onUpdateDataFromClient(Mercury::Channel* pChannel, KBEngine::Memor
25632563
return;
25642564
}
25652565

2566-
if(s.opsize() <= 0 || s.opsize() != (sizeof(float) * 6 + sizeof(uint8)))
2566+
static size_t datasize = (sizeof(float) * 6 + sizeof(uint8) + sizeof(uint32));
2567+
if(s.opsize() <= 0 || s.opsize() != datasize)
25672568
{
2569+
ERROR_MSG(boost::format("Baseapp::onUpdateDataFromClient: invalid data, size(%1% != %2%), srcEntityID=%3%.\n") %
2570+
datasize % s.opsize() % srcEntityID);
2571+
25682572
s.opfini();
25692573
return;
25702574
}

‎kbe/src/server/cellapp/entity.cpp‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,17 +1346,27 @@ bool Entity::checkMoveForTopSpeed(const Position3D& position)
13461346
//-------------------------------------------------------------------------------------
13471347
void Entity::onUpdateDataFromClient(KBEngine::MemoryStream& s)
13481348
{
1349-
if(spaceID_ == 0 )
1349+
if(spaceID_ == 0)
1350+
{
1351+
s.opfini();
13501352
return;
1353+
}
13511354

13521355
Position3D pos;
13531356
Direction3D dir;
13541357
uint8 isOnGround = 0;
13551358
float yaw, pitch, roll;
1359+
SPACE_ID currspace;
13561360

1357-
s >> pos.x >> pos.y >> pos.z >> yaw >> pitch >> roll >> isOnGround;
1361+
s >> pos.x >> pos.y >> pos.z >> yaw >> pitch >> roll >> isOnGround >> currspace;
13581362
isOnGround_ = isOnGround > 0;
13591363

1364+
if(spaceID_ != currspace)
1365+
{
1366+
s.opfini();
1367+
return;
1368+
}
1369+
13601370
dir.yaw(yaw);
13611371
dir.pitch(pitch);
13621372
dir.roll(roll);

0 commit comments

Comments
 (0)