void calculateSpecialUnits() { worker = getAction(race.getWorker()); resourceDepot = getAction(race.getCenter()); supplyProvider = getAction(race.getSupplyProvider()); refinery = getAction(race.getRefinery()); std::cout << race.getCenter().getName() << std::endl; // also set what builds actions for (size_t i=0; i<actions.size(); i++) { if (actions[i].whatBuilds() == BWAPI::UnitTypes::Zerg_Larva) { Action a = 255; actions[i].setWhatBuildsAction(a, false, true); } else { Action a = getAction(actions[i].whatBuilds()); actions[i].setWhatBuildsAction(a, DATA[a].isBuilding(), false); } } }
void LizurdModule::onStart() { //Initialise everything once we know what race we are playing BWAPI::Race race = Broodwar->self()->getRace(); _initialised = _gateway.Initialise(BroodwarPtr, race); if(_initialised != Result::Success) { Broodwar->sendText("Failed to initialise the bot, most likely as it only works with Zerg."); } Logger::GetInstance().Log("LizurdModule", "We are playing: " + race.getName()); Broodwar->setLocalSpeed(10); }
void Observer::onStart() { currFrame = 0; pullFrequency = 50; // THIS DISPLAYS THE CURRENT DIRECTORY //TCHAR pwd[MAX_PATH]; //GetCurrentDirectory(MAX_PATH,pwd); //MessageBox(NULL,pwd,pwd,0); if (Broodwar->isReplay()) return; // Enable some cheat flags Broodwar->enableFlag(Flag::UserInput); //Broodwar->enableFlag(Flag::CompleteMapInformation); // Run BWTA BWTA::readMap(); BWTA::analyze(); this->analyzed=true; // get information about our bot BWAPI::Race race = Broodwar->self()->getRace(); BWAPI::Race enemyRace = Broodwar->enemy()->getRace(); BWAPI::UnitType workerType=race.getWorker(); double minDist; BWTA::BaseLocation* natural=NULL; BWTA::BaseLocation* home=BWTA::getStartLocation(Broodwar->self()); for(std::set<BWTA::BaseLocation*>::const_iterator b=BWTA::getBaseLocations().begin();b!=BWTA::getBaseLocations().end();b++) { if (*b==home) continue; double dist=home->getGroundDistance(*b); if (dist>0) { if (natural==NULL || dist<minDist) { minDist=dist; natural=*b; } } } gsDumper.setup(this->analyzed); }