-
Notifications
You must be signed in to change notification settings - Fork 464
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
Conversation
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.
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
plugins/changevein.cpp
Outdated
{ | ||
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)]; |
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.
isn't j-1 == 255 since it's a uint8_t and has a starting value of 0?
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.
Great catch! Got used to using uint as if it was an int and didn't notice.
plugins/changevein.cpp
Outdated
for (size_t j = 0; j < newBlock->block_events.size(); j++) | ||
{ | ||
df::block_square_event* evt = newBlock->block_events[j]; |
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.
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) | |
{ |
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.
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
Fixes #4519
changevein will now convert any connected veins in the same tile and neighboring tiles.