| 150 | } |
| 151 | |
| 152 | void ServerQueryThread::buildPlayerResponse() { |
| 153 | int64_t now = Time::monotonicMilliseconds(); |
| 154 | if (now < m_lastPlayersResponse + responseCacheTime) { |
| 155 | return; |
| 156 | } |
| 157 | |
| 158 | auto clientIds = m_universe->clientIdsAndCreationTime(); |
| 159 | uint8_t cnt = (uint8_t)clientIds.count(); |
| 160 | int32_t kills = 0; // Not currently supported |
| 161 | |
| 162 | m_playersResponse.clear(); |
| 163 | m_playersResponse << A2S_HEAD_INT << A2S_PLAYER_REPLY << cnt; |
| 164 | |
| 165 | uint8_t i = 0; |
| 166 | for (auto& pair : clientIds) { |
| 167 | auto timeConnected = float(now - pair.second) / 1000.f; |
| 168 | m_playersResponse << i++ << m_universe->clientNick(pair.first) << kills << timeConnected; |
| 169 | } |
| 170 | |
| 171 | m_lastPlayersResponse = now; |
| 172 | } |
| 173 | |
| 174 | void ServerQueryThread::buildRuleResponse() { |
| 175 | int64_t now = Time::monotonicMilliseconds(); |
nothing calls this directly
no test coverage detected