void Network::BoostClient::SendLock( int index, int target_index ) { PACKAGE p; p.SetCMD( PLAYER_LOCK ); PlayerLockBag bag; bag.owner_index = index; bag.target_index = target_index; p.SetData( (char*)&bag, sizeof(PlayerLockBag) ); TcpSendTo( m_server_IP, m_target_port, p ); }
void Network::BoostClient::SendHeroRot( int index, float x, float y, float z ) { PACKAGE pack; pack.SetCMD( HERO_ROTATE ); HeroRotate rot( index, x, y, z ); pack.SetData( (char*)&rot, sizeof( HeroRotate ) ); m_network->SendTo( m_server_IP, pack ); }
void Network::BoostClient::SendHeroMove( int index, float x, float y, float z ) { PACKAGE pack; pack.SetCMD( HERO_MOVE ); HeroMove move( index, x, y, z ); pack.SetData( (char*)&move, sizeof( HeroMove ) ); m_network->SendTo( m_server_IP, pack ); }
void IAgentPlayer::SendRotate( const core::vector3df& rot ) { //RobotShip_->setRotation( getRotation() ); PACKAGE pack; pack.SetCMD( HERO_ROTATE ); HeroRotate rotate( GetID(), rot.X, rot.Y, rot.Z ); pack.SetData( (char*)&rotate, sizeof( HeroRotate ) ); dynamic_pointer_cast<Network::BoostServer >( Server )->AddPacketToBuffer( pack ); }
void Network::BoostClient::BroadcastMessage( int index, const wchar_t* msg ) { BroadcastMessageBag bag; bag.index = index; bag.target_index = -1; bag.SetMsg( msg ); PACKAGE p; p.SetCMD( MESSAGE_TO ); p.SetData( (char*)&bag, bag.GetLength() ); TcpSendTo( m_server_IP, m_target_port, p ); }
void IAgentPlayer::SendMove( const vector3df& pos ) { //RobotShip_->setPosition( getPosition() ); PACKAGE pack; pack.SetCMD( HERO_MOVE ); HeroMove move( GetID(), pos.X, pos.Y, pos.Z ); pack.SetData( (char*)&move, sizeof( HeroMove ) ); dynamic_pointer_cast<Network::BoostServer >( Server )->AddPacketToBuffer( pack ); //Server->OnReceive( 0, pack ); }
void Network::BoostClient::SendBulletHit( int owner_index, int target_index, int bullet_type, IShip* ship ) { BulletHittedBag bag; bag.owner_index = owner_index; bag.target_index = target_index; bag.bullet_type = bullet_type; bag.armor = (int)ship->GetArmor(); bag.shield = (int)ship->GetShield(); PACKAGE p; p.SetCMD( BULLET_HIT ); p.SetData( (char*)&bag, sizeof( BulletHittedBag ) ); TcpSendTo( m_server_IP, m_target_port, p ); }
void Network::BoostClient::SendBullet( int index, int bullet_type, const irr::core::vector3df& start, const irr::core::vector3df& end, u32 life ) { BulletCreateBag bullet; bullet.owner_index = index; bullet.start_point = start; bullet.end_point = end; bullet.life = life; bullet.type = bullet_type; PACKAGE pack; pack.SetCMD( BULLET_CREATE ); pack.SetData( (char*)&bullet, sizeof( BulletCreateBag ) ); m_network->SendTo( m_server_IP, pack ); }
void Network::BoostClient::QueryRoom() { PACKAGE p; p.SetCMD( QUERY_ROOM ); m_network->Broadcast( p ); }