| 223 | LocalFree(this->pSD); |
| 224 | } |
| 225 | void Server::update() |
| 226 | { |
| 227 | // Reset data coming in to server |
| 228 | data->stringCount = 0; |
| 229 | data->commandCount = 0; |
| 230 | data->unitCommandCount = 0; |
| 231 | data->shapeCount = 0; |
| 232 | if (gameTable && gameTableIndex >= 0) |
| 233 | { |
| 234 | gameTable->gameInstances[gameTableIndex].lastKeepAliveTime = GetTickCount(); |
| 235 | gameTable->gameInstances[gameTableIndex].isConnected = connected; |
| 236 | } |
| 237 | if (connected) |
| 238 | { |
| 239 | // Update BWAPI Client |
| 240 | updateSharedMemory(); |
| 241 | auto const onFrameStart = GetTickCount(); |
| 242 | callOnFrame(); |
| 243 | BroodwarImpl.setLastEventTime(GetTickCount() - onFrameStart); |
| 244 | processCommands(); |
| 245 | } |
| 246 | else |
| 247 | { |
| 248 | // Update BWAPI DLL |
| 249 | BroodwarImpl.processEvents(); |
| 250 | |
| 251 | BroodwarImpl.events.clear(); |
| 252 | if (!BroodwarImpl.startedClient) |
| 253 | checkForConnections(); |
| 254 | } |
| 255 | // Reset data going out to client |
| 256 | data->eventCount = 0; |
| 257 | data->eventStringCount = 0; |
| 258 | } |
| 259 | bool Server::isConnected() const |
| 260 | { |
| 261 | return connected; |
no test coverage detected