| 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(); |
no test coverage detected