-
Notifications
You must be signed in to change notification settings - Fork 23
Allow digger on an adjacent unexcavated tile #2176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| <ItemGroup> | ||
| <ClCompile Include="MapOffset.test.cpp"> | ||
| <Filter>Source Files</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="RandomNumberGenerator.test.cpp"> | ||
| <Filter>Source Files</Filter> | ||
| <ItemGroup> | ||
| <ClCompile Include="DiggerUtility.test.cpp"> | ||
| <Filter>Source Files</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="MapOffset.test.cpp"> | ||
| <Filter>Source Files</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="RandomNumberGenerator.test.cpp"> | ||
| <Filter>Source Files</Filter> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the line ending have changed unexpectedly for a few lines here. MSVC project files should use Windows style line endings (CR LF).
For non Windows specific files, such as source code files, the convention is to use Linux style line endings (LF).
| /** | ||
| * Picks a digger orientation that points away from already excavated neighbors. | ||
| * | ||
| * The neighbor array uses the same ordering as DirectionClockwise8: | ||
| * North, NorthEast, East, SouthEast, South, SouthWest, West, NorthWest. | ||
| */ | ||
| Direction chooseDiggerDirectionAwayFromExcavated(const std::array<bool, 8>& excavatedNeighbors); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the objectives of the issue is to eliminate the mDirection field, rather than auto set it.
| constexpr std::size_t AdjacentTileCount = 8; | ||
|
|
||
|
|
||
| std::array<bool, AdjacentTileCount> gatherExcavatedNeighbors(const TileMap& tileMap, const Tile& tile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming we get rid of mDirection, we shouldn't need to gather an array of data for placement checks. We only need to know if there is some adjacent tile which is excavated and unoccupied.
| void RobotPool::deployDigger(Tile& tile, Direction direction) | ||
| void RobotPool::deployDigger(Tile& tile, Direction direction, MapCoordinate target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the position is obtained from the tile, there is no need to pass it separately here.
Rather than add a new parameter, we should look at removing the direction parameter, as it should no longer be needed.
Addresses request in #2050
The attached video, I showcases the change. First, I select an empty tile that is not adjacent to an excavated square, which displays an error message to the user. Next, I select a tile adjacent to an excavated tile, and the digger is placed, then completes the excavation after a few turns.
Screen.Recording.2025-11-26.at.10.13.37.pm.420p.mov