diff options
Diffstat (limited to 'Minecraft.World/Socket.cpp')
| -rw-r--r-- | Minecraft.World/Socket.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Minecraft.World/Socket.cpp b/Minecraft.World/Socket.cpp index 290b39dc..bd0c2032 100644 --- a/Minecraft.World/Socket.cpp +++ b/Minecraft.World/Socket.cpp @@ -14,7 +14,7 @@ CRITICAL_SECTION Socket::s_hostQueueLock[2]; std::queue<byte> Socket::s_hostQueue[2]; Socket::SocketOutputStreamLocal *Socket::s_hostOutStream[2]; Socket::SocketInputStreamLocal *Socket::s_hostInStream[2]; -ServerConnection *Socket::s_serverConnection = nullptr; +ServerConnection *Socket::s_serverConnection = NULL; void Socket::Initialise(ServerConnection *serverConnection) { @@ -67,7 +67,7 @@ Socket::Socket(bool response) { m_endClosed[i] = false; } - m_socketClosedEvent = nullptr; + m_socketClosedEvent = NULL; createdOk = true; networkPlayerSmallId = g_NetworkManager.GetHostPlayer()->GetSmallId(); } @@ -80,8 +80,8 @@ Socket::Socket(INetworkPlayer *player, bool response /* = false*/, bool hostLoca for( int i = 0; i < 2; i++ ) { InitializeCriticalSection(&m_queueLockNetwork[i]); - m_inputStream[i] = nullptr; - m_outputStream[i] = nullptr; + m_inputStream[i] = NULL; + m_outputStream[i] = NULL; m_endClosed[i] = false; } @@ -105,7 +105,7 @@ Socket::Socket(INetworkPlayer *player, bool response /* = false*/, bool hostLoca SocketAddress *Socket::getRemoteSocketAddress() { - return nullptr; + return NULL; } INetworkPlayer *Socket::getPlayer() @@ -115,7 +115,7 @@ INetworkPlayer *Socket::getPlayer() void Socket::setPlayer(INetworkPlayer *player) { - if(player!=nullptr) + if(player!=NULL) { networkPlayerSmallId = player->GetSmallId(); } @@ -147,7 +147,7 @@ void Socket::pushDataToQueue(const BYTE * pbData, DWORD dwDataSize, bool fromHos void Socket::addIncomingSocket(Socket *socket) { - if( s_serverConnection != nullptr ) + if( s_serverConnection != NULL ) { s_serverConnection->NewIncomingSocket(socket); } @@ -240,7 +240,7 @@ bool Socket::close(bool isServerConnection) allClosed = true; m_endClosed[m_end] = true; } - if( allClosed && m_socketClosedEvent != nullptr ) + if( allClosed && m_socketClosedEvent != NULL ) { m_socketClosedEvent->Set(); } @@ -330,7 +330,7 @@ void Socket::SocketOutputStreamLocal::write(unsigned int b) return; } EnterCriticalSection(&s_hostQueueLock[m_queueIdx]); - s_hostQueue[m_queueIdx].push(static_cast<byte>(b)); + s_hostQueue[m_queueIdx].push((byte)b); LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]); } @@ -442,7 +442,7 @@ void Socket::SocketOutputStreamNetwork::write(unsigned int b) if( m_streamOpen != true ) return; byteArray barray; byte bb; - bb = static_cast<byte>(b); + bb = (byte)b; barray.data = &bb; barray.length = 1; write(barray, 0, 1); @@ -488,15 +488,15 @@ void Socket::SocketOutputStreamNetwork::writeWithFlags(byteArray b, unsigned int buffer.dwDataSize = length; INetworkPlayer *hostPlayer = g_NetworkManager.GetHostPlayer(); - if(hostPlayer == nullptr) + if(hostPlayer == NULL) { - app.DebugPrintf("Trying to write to network, but the hostPlayer is nullptr\n"); + app.DebugPrintf("Trying to write to network, but the hostPlayer is NULL\n"); return; } INetworkPlayer *socketPlayer = m_socket->getPlayer(); - if(socketPlayer == nullptr) + if(socketPlayer == NULL) { - app.DebugPrintf("Trying to write to network, but the socketPlayer is nullptr\n"); + app.DebugPrintf("Trying to write to network, but the socketPlayer is NULL\n"); return; } @@ -517,7 +517,7 @@ void Socket::SocketOutputStreamNetwork::writeWithFlags(byteArray b, unsigned int hostPlayer->SendData(socketPlayer, buffer.pbyData, buffer.dwDataSize, lowPriority, requireAck); - // DWORD queueSize = hostPlayer->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_BYTES ); + // DWORD queueSize = hostPlayer->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ); // if( queueSize > 24000 ) // { // //printf("Queue size is: %d, forcing doWork()\n",queueSize); |
