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

Method getStartLocation

bwapi/BWAPI/Source/BWAPI/PlayerImpl.cpp:89–109  ·  view source on GitHub ↗

--------------------------------------------- GET START POSITION -----------------------------------------

Source from the content-addressed store, hash-verified

87 }
88 //--------------------------------------------- GET START POSITION -----------------------------------------
89 TilePosition PlayerImpl::getStartLocation() const
90 {
91 // Clear last error
92 BroodwarImpl.setLastError();
93
94 // Return None if there is no start location
95 if (index >= BW::PLAYABLE_PLAYER_COUNT || BW::BWDATA::Game.startPositions[index] == BW::Positions::Origin)
96 return TilePositions::None;
97
98 // Return unknown and set Access_Denied if the start location
99 // should not be made available.
100 if ( !BroodwarImpl.isReplay() &&
101 BroodwarImpl.self()->isEnemy(const_cast<PlayerImpl*>(this)) &&
102 !BroodwarImpl.isFlagEnabled(Flag::CompleteMapInformation) )
103 {
104 BroodwarImpl.setLastError(Errors::Access_Denied);
105 return TilePositions::Unknown;
106 }
107 // return the start location as a tile position
108 return TilePosition(BW::BWDATA::Game.startPositions[index] - BW::Position((TILE_SIZE * 4) / 2, (TILE_SIZE * 3) / 2));
109 }
110 //--------------------------------------------- IS VICTORIOUS ----------------------------------------------
111 bool PlayerImpl::isVictorious() const
112 {

Callers 2

onStartMethod · 0.45
onMatchStartMethod · 0.45

Calls 6

setLastErrorMethod · 0.80
PositionClass · 0.50
isReplayMethod · 0.45
isEnemyMethod · 0.45
selfMethod · 0.45
isFlagEnabledMethod · 0.45

Tested by

no test coverage detected