| 96 | } |
| 97 | |
| 98 | bool ODSocketClient::isDataAvailable() |
| 99 | { |
| 100 | switch(mSource) |
| 101 | { |
| 102 | case ODSource::none: |
| 103 | { |
| 104 | return false; |
| 105 | } |
| 106 | case ODSource::network: |
| 107 | { |
| 108 | // There is only 1 socket in the selector so it should be ready if |
| 109 | // wait returns true but it doesn't hurt to return isReady... |
| 110 | if(!mSockSelector.wait(sf::milliseconds(5))) |
| 111 | return false; |
| 112 | return mSockSelector.isReady(mSockClient); |
| 113 | } |
| 114 | case ODSource::file: |
| 115 | { |
| 116 | if(mReplayInputStream.eof()) |
| 117 | return false; |
| 118 | |
| 119 | if(mPendingTimestamp == -1) |
| 120 | mPendingTimestamp = mPendingPacket.readPacket(mReplayInputStream); |
| 121 | |
| 122 | if(mPendingTimestamp < 0) |
| 123 | return false; |
| 124 | |
| 125 | if(mPendingTimestamp < mGameClock.getElapsedTime().asMilliseconds()) |
| 126 | return true; |
| 127 | |
| 128 | return false; |
| 129 | } |
| 130 | default: |
| 131 | assert(false); |
| 132 | break; |
| 133 | } |
| 134 | |
| 135 | return false; |
| 136 | } |
| 137 | |
| 138 | ODSocketClient::ODComStatus ODSocketClient::send(ODPacket& s) |
| 139 | { |
nothing calls this directly
no test coverage detected