This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void Surface::listFriendlyEntities(const MapPosition& position, | |
| ForceID forceID, | |
| double maxDistance, | |
| std::vector<EntityWithOwner*>& result, | |
| bool onlyUnits) | |
| { | |
| BoundingBox searchingBox(-maxDistance, -maxDistance, maxDistance, maxDistance); | |
| searchingBox += position; | |
| ChunkPosition leftTop(TilePosition(searchingBox.leftTop)); | |
| ChunkPosition rightBottom(TilePosition(searchingBox.rightBottom)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TEST(SpiderSetupPositionDoesNotGenerateChunks) | |
| { | |
| TestScenario scenario; | |
| const size_t chunksTotalBefore = scenario.getMap().chunksTotal; | |
| ScopedSetter guard(CorePrototypes::defaultTile, TileID("out-of-map").getPrototype()); | |
| for (bool simulation : { true, false }) | |
| { | |
| auto spider = scenario.constructEntity("spidertron", MapPosition(5000, 5000), IsSimulation::fromBool(simulation)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void SpacePlatform::spawnAsteroids() | |
| { | |
| const bool randomOrientation = this->speed < 0.2; | |
| if (SpaceLocationID locationID = this->position.getCurrentLocation()) | |
| for (auto& spawnDefinition : locationID->asteroidSpawnDefinitions) | |
| this->trySpawnAsteroid(spawnDefinition.asteroid, spawnDefinition.chunk, spawnDefinition, randomOrientation); | |
| else | |
| { | |
| const PointOnSpaceConnection& pointOnConnection = this->position.getPointOnConnection(); | |
| for (auto& spawnDefinition : pointOnConnection.connection->asteroidSpawnDefinitions) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void SpacePlatform::updateAsteroidChunks() | |
| { | |
| if (this->asteroidChunks.empty()) | |
| return; | |
| const SimpleBoundingBox asteroidSpawningArea = this->getAsteroidSpawningArea(); | |
| const double left = asteroidSpawningArea.leftTop.x.getDouble(); | |
| const double top = asteroidSpawningArea.leftTop.y.getDouble(); | |
| const double right = asteroidSpawningArea.rightBottom.x.getDouble(); | |
| const double bottom = asteroidSpawningArea.rightBottom.y.getDouble(); |
OlderNewer