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

Method initializeData

bwapi/BWAPI/Source/BWAPI/GameInternals.cpp:284–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282 return true;
283 }
284 void GameImpl::initializeData()
285 {
286 // Delete forces
287 for ( Forceset::iterator f = this->forces.begin(); f != this->forces.end(); ++f)
288 delete (static_cast<ForceImpl*>(*f));
289 this->forces.clear();
290
291 // Remove player references
292 this->BWAPIPlayer = nullptr;
293 this->enemyPlayer = nullptr;
294
295 // Set random seed
296 srand(GetTickCount());
297
298 // clear all sets
299 this->aliveUnits.clear();
300 this->dyingUnits.clear();
301 this->discoverUnits.clear();
302 this->accessibleUnits.clear();
303 this->evadeUnits.clear();
304 this->selectedUnitSet.clear();
305 this->startLocations.clear();
306 this->playerSet.clear();
307 this->minerals.clear();
308 this->geysers.clear();
309 this->neutralUnits.clear();
310 this->bullets.clear();
311 this->pylons.clear();
312 this->staticMinerals.clear();
313 this->staticGeysers.clear();
314 this->staticNeutralUnits.clear();
315 this->_allies.clear();
316 this->_enemies.clear();
317 this->_observers.clear();
318
319 // Reset saved selection
320 this->savedUnitSelection.fill(nullptr);
321 this->wantSelectionUpdate = false;
322
323 // Disable all game flags
324 flags.fill(false);
325
326 // Clear the latency buffer
327 this->commandBuffer.clear();
328 this->commandBuffer.reserve(16);
329
330 commandOptimizer.init();
331
332 // Delete all dead units
333 for ( Unitset::iterator d = this->deadUnits.begin(); d != this->deadUnits.end(); ++d )
334 delete static_cast<UnitImpl*>(*d);
335 this->deadUnits.clear();
336
337 // Delete all regions
338 for ( Regionset::iterator r = this->regionsList.begin(); r != this->regionsList.end(); ++r )
339 delete static_cast<RegionImpl*>(*r);
340 this->regionsList.clear();
341 this->regionMap.clear();

Callers 4

onGameStartMethod · 0.95
onGameEndMethod · 0.95
GameImplMethod · 0.95
~GameImplMethod · 0.95

Calls 12

setLocalSpeedDirectMethod · 0.95
setFrameSkipMethod · 0.95
setTextSizeMethod · 0.95
setGUIMethod · 0.95
loadAutoMenuDataMethod · 0.95
beginMethod · 0.80
endMethod · 0.80
fillMethod · 0.80
clearMethod · 0.45
initMethod · 0.45
setIDMethod · 0.45
clearAllMethod · 0.45

Tested by

no test coverage detected