| 488 | } |
| 489 | |
| 490 | void Server::updateSharedMemory() |
| 491 | { |
| 492 | for (Unit u : BroodwarImpl.evadeUnits) |
| 493 | data->units[getUnitID(u)] = static_cast<UnitImpl*>(u)->data; |
| 494 | |
| 495 | data->frameCount = Broodwar->getFrameCount(); |
| 496 | data->replayFrameCount = Broodwar->getReplayFrameCount(); |
| 497 | data->randomSeed = Broodwar->getRandomSeed(); |
| 498 | data->fps = Broodwar->getFPS(); |
| 499 | data->botAPM_noselects = Broodwar->getAPM(false); |
| 500 | data->botAPM_selects = Broodwar->getAPM(true); |
| 501 | data->latencyFrames = Broodwar->getLatencyFrames(); |
| 502 | data->latencyTime = Broodwar->getLatencyTime(); |
| 503 | data->remainingLatencyFrames = Broodwar->getRemainingLatencyFrames(); |
| 504 | data->remainingLatencyTime = Broodwar->getRemainingLatencyTime(); |
| 505 | data->elapsedTime = Broodwar->elapsedTime(); |
| 506 | data->countdownTimer = Broodwar->countdownTimer(); |
| 507 | data->averageFPS = Broodwar->getAverageFPS(); |
| 508 | data->mouseX = Broodwar->getMousePosition().x; |
| 509 | data->mouseY = Broodwar->getMousePosition().y; |
| 510 | data->isInGame = Broodwar->isInGame(); |
| 511 | if (Broodwar->isInGame()) |
| 512 | { |
| 513 | data->gameType = Broodwar->getGameType(); |
| 514 | data->latency = Broodwar->getLatency(); |
| 515 | |
| 516 | // Copy the mouse states |
| 517 | for(int i = 0; i < M_MAX; ++i) |
| 518 | data->mouseState[i] = Broodwar->getMouseState((MouseButton)i); |
| 519 | |
| 520 | // Copy the key states |
| 521 | for(int i = 0; i < K_MAX; ++i) |
| 522 | data->keyState[i] = Broodwar->getKeyState((Key)i); |
| 523 | |
| 524 | // Copy the screen position |
| 525 | data->screenX = Broodwar->getScreenPosition().x; |
| 526 | data->screenY = Broodwar->getScreenPosition().y; |
| 527 | |
| 528 | for ( int i = 0; i < BWAPI::Flag::Max; ++i ) |
| 529 | data->flags[i] = Broodwar->isFlagEnabled(i); |
| 530 | |
| 531 | data->isPaused = Broodwar->isPaused(); |
| 532 | data->selectedUnitCount = Broodwar->getSelectedUnits().size(); |
| 533 | |
| 534 | int idx = 0; |
| 535 | for(Unit t : Broodwar->getSelectedUnits()) |
| 536 | data->selectedUnits[idx++] = getUnitID(t); |
| 537 | |
| 538 | //dynamic map data |
| 539 | Map::copyToSharedMemory(); |
| 540 | //(no dynamic force data) |
| 541 | |
| 542 | //dynamic player data |
| 543 | for(Player i : Broodwar->getPlayers()) |
| 544 | { |
| 545 | int id = getPlayerID(i); |
| 546 | if ( id >= 12 ) |
| 547 | continue; |
nothing calls this directly
no test coverage detected