Skip to content
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

Make changevein affect connected veins #4592

Merged
merged 3 commits into from
May 16, 2024

Conversation

tatoyoda600
Copy link
Contributor

@tatoyoda600 tatoyoda600 commented May 15, 2024

Fixes #4519
changevein will now convert any connected veins in the same tile and neighboring tiles.

Copy link
Member

@myk002 myk002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work!

please add a line to the changelog under "Misc Improvements" for the "Future" version

also, please document the change in behavior in docs/changevein.rst

{
for (uint8_t j = 0; j < 15; j++)
{
uint16_t bitmask = cur->tile_bitmask.bits[j] | cur->tile_bitmask.bits[std::max(j - 1, 0)] | cur->tile_bitmask.bits[std::min(j + 1, 15)];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't j-1 == 255 since it's a uint8_t and has a starting value of 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! Got used to using uint as if it was an int and didn't notice.

Comment on lines 153 to 155
for (size_t j = 0; j < newBlock->block_events.size(); j++)
{
df::block_square_event* evt = newBlock->block_events[j];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (size_t j = 0; j < newBlock->block_events.size(); j++)
{
df::block_square_event* evt = newBlock->block_events[j];
for (auto evt : newBlock->block_events)
{

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for other similar for loops in this file. the original code was written before this syntax was available in C++, but there's no reason not to use the modern syntax

@myk002 myk002 merged commit 95fe714 into DFHack:develop May 16, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

changevein should follow veins across map blocks
2 participants