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

Method copyToSharedMemory

bwapi/BWAPI/Source/BWAPI/Map.cpp:56–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 return BW::BWDATA::Game.mapTitle;
55 }
56 void Map::copyToSharedMemory()
57 {
58 const int width = getWidth();
59 const int height = getHeight();
60
61 GameData* const data = BroodwarImpl.server.data;
62 if ( BroodwarImpl.isReplay() )
63 {
64 for(int x = 0; x < width; ++x)
65 {
66 for(int y = 0; y < height; ++y)
67 {
68 BW::activeTile tileData = getActiveTile(x, y);
69 data->isVisible[x][y] = tileData.bVisibilityFlags != 255;
70 data->isExplored[x][y] = tileData.bExploredFlags != 255;
71 data->hasCreep[x][y] = tileData.bTemporaryCreep != 0;
72 data->isOccupied[x][y] = tileData.bCurrentlyOccupied != 0;
73 }
74 }
75 }
76 else
77 {
78 const bool completeMapInfo = Broodwar->isFlagEnabled(Flag::CompleteMapInformation);
79 const u32 playerFlag = 1 << BroodwarImpl.BWAPIPlayer->getIndex();
80 for(int x = 0; x < width; ++x)
81 {
82 for(int y = 0; y < height; ++y)
83 {
84 const BW::activeTile tileData = getActiveTile(x, y);
85 data->isVisible[x][y] = !(tileData.bVisibilityFlags & playerFlag);
86 data->isExplored[x][y] = !(tileData.bExploredFlags & playerFlag);
87 data->hasCreep[x][y] = (data->isVisible[x][y] || completeMapInfo) && (tileData.bTemporaryCreep != 0 || tileData.bHasCreep != 0);
88 data->isOccupied[x][y] = (data->isVisible[x][y] || completeMapInfo) && tileData.bCurrentlyOccupied != 0;
89 }
90 }
91 }
92 }
93 //------------------------------------------------ BUILDABLE -----------------------------------------------
94 bool Map::buildable(int x, int y)
95 {

Callers

nothing calls this directly

Calls 3

isReplayMethod · 0.45
isFlagEnabledMethod · 0.45
getIndexMethod · 0.45

Tested by

no test coverage detected