MCPcopy Create free account
hub / github.com/bwapi/bwapi / updateSharedMemory

Method updateSharedMemory

bwapi/BWAPI/Source/BWAPI/Server.cpp:490–682  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls 15

leftGameMethod · 0.80
canAccessMethod · 0.80
getBulletFromIndexMethod · 0.80
getFrameCountMethod · 0.45
getReplayFrameCountMethod · 0.45
getRandomSeedMethod · 0.45
getFPSMethod · 0.45
getAPMMethod · 0.45
getLatencyFramesMethod · 0.45
getLatencyTimeMethod · 0.45

Tested by

no test coverage detected