server/CNetworkManager.cpp
// LIBRG_CLIENT_STREAMER_UPDATE
// server received a sync packet from an entity
LIBRG_CLIENT_STREAMER_UPDATE
server received a sync packet from an entity
LIBRG_CLIENT_STREAMER_UPDATE server received a sync packet from an entity
void CNetworkManager::on_stream_update(librg_event_t *event)
{
	if (!event->entity->user_data)
		return;
	if (event->entity->type == eNetworkEntityType::PLAYER)
	{
		CServerPlayer* player = (CServerPlayer*)event->entity->user_data;
		player->syncType = (eSyncType)librg_data_ru8(event->data);
		int size;
		if (player->syncType == eSyncType::SYNC_TYPE_ON_FOOT) size = sizeof(OnfootPlayerSyncPacket);
		else if (player->syncType == eSyncType::SYNC_TYPE_ON_FOOT_AIMING)size = sizeof(OnfootPlayerAimingSyncPacket);
		else if (player->syncType == eSyncType::SYNC_TYPE_IN_WATER)size = sizeof(InWaterPlayerSyncPacket);
        memcpy(player->lastSyncData, player->syncData, size);
		librg_data_rptr(event->data, player->syncData, size);
	}
}
void CNetworkManager :: on_stream_update ( librg_event_t * event ) { if ( ! event -> entity -> user_data ) return ; if ( event -> entity -> type == eNetworkEntityType :: PLAYER ) { CServerPlayer * player = ( CServerPlayer * ) event -> entity -> user_data ; player -> syncType = ( eSyncType ) librg_data_ru8 ( event -> data ) ; int size ; if ( player -> syncType == eSyncType :: SYNC_TYPE_ON_FOOT ) size = sizeof ( OnfootPlayerSyncPacket ) ; else if ( player -> syncType == eSyncType :: SYNC_TYPE_ON_FOOT_AIMING ) size = sizeof ( OnfootPlayerAimingSyncPacket ) ; else if ( player -> syncType == eSyncType :: SYNC_TYPE_IN_WATER ) size = sizeof ( InWaterPlayerSyncPacket ) ; memcpy ( player -> lastSyncData , player -> syncData , size ) ; librg_data_rptr ( event -> data , player -> syncData , size ) ; } }
LIBRG_CLIENT_STREAMER_UPDATE
server received a sync packet from an entity
LIBRG_CLIENT_STREAMER_UPDATE server received a sync packet from an entity