RetrievesthenameoftheForce.ReturnsAstd::stringobjectcontainingthenameoftheforce.Exampleusage:BWAPI::ForcemyForce=BWAPI::Broodwar->self()->getForce();if(myForce->getName()=="Observers")BWAPI::Broodwar<<"Looks like we're observing a match."<<std::endl;NoteDon'tforgettousestd::string::c_str()whenpassingthisparametertoGame::sendTextandothervariadicfunctions.
RetrievesthesetofplayersthatbelongtothisForce.ReturnsAPlayersetobjectcontainingtheplayersthatarepartofthisForce.Exampleusage:// Get the enemy force, but make sure we have an enemy BWAPI::Force myEnemyForce = BWAPI::Broodwar->enemy() ? BWAPI::Broodwar->enemy()->getForce() : nullptr; if ( myEnemyForce != nullptr ) { Broodwar << "The allies of my enemy are..." << std::endl; for ( auto i = myEnemyForce.begin(); i != myEnemyForce.end(); ++i ) Broodwar << " - " << i->getName() << std::endl; }