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

Method setVision

bwapi/BWAPI/Source/BWAPI/GameImpl.cpp:603–630  ·  view source on GitHub ↗

----------------------------------------------- SET VISION -----------------------------------------------

Source from the content-addressed store, hash-verified

601 }
602 //----------------------------------------------- SET VISION -----------------------------------------------
603 bool GameImpl::setVision(BWAPI::Player player, bool enabled)
604 {
605 if ( !player ) // Parameter check
606 return this->setLastError(Errors::Invalid_Parameter);
607
608 if ( this->isReplay() )
609 {
610 u32 vision = BW::BWDATA::ReplayVision;
611 if ( enabled )
612 vision |= 1 << static_cast<PlayerImpl*>(player)->getIndex();
613 else
614 vision &= ~(1 << static_cast<PlayerImpl*>(player)->getIndex() );
615 BW::BWDATA::ReplayVision = vision;
616 }
617 else
618 {
619 if ( !BWAPIPlayer || player == BWAPIPlayer )
620 return this->setLastError(Errors::Invalid_Parameter);
621
622 u16 vision = static_cast<u16>(BW::BWDATA::Game.playerVision[BWAPIPlayer->getIndex()]);
623 if ( enabled )
624 vision |= 1 << static_cast<PlayerImpl*>(player)->getIndex();
625 else
626 vision &= ~(1 << static_cast<PlayerImpl*>(player)->getIndex() );
627 QUEUE_COMMAND(BW::Orders::SetVision, vision);
628 }
629 return this->setLastError();
630 }
631 //--------------------------------------------------- GAME SPEED -------------------------------------------
632 void GameImpl::setLocalSpeed(int speed)
633 {

Callers 2

executeMethod · 0.45
processCommandsMethod · 0.45

Calls 3

setLastErrorMethod · 0.95
isReplayMethod · 0.95
getIndexMethod · 0.45

Tested by

no test coverage detected