-
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
Cuboid struct/class for df::coord bounds #4595
Comments
Is this version any good?
|
I think the Maps module header might be a good place. I think the best way to determine if the abstraction is correct is to try porting existing tools to use it. If they look cleaner afterwards, then the abstraction is useful. |
Any thoughts on using get/set vs having the user check |
We use the isValid pattern elsewhere, so I think it's fine here too |
Testing if a
df::coord
is inside a given box is an issue that comes up when dealing with map positions. There doesn't seem to be anything handy in the DFHack library, so every tool has to implement its own logic.Not sure where the struct should be defined.
MiscUtils
?I created an example while working on an improved
plugins/plants.cpp
:This could probably be refined. Maybe add a constructor, a
clear()
function, and get/set (so we can keep track of isValid state.) I don't know if there's a use-case for supporting negative values (e.g., relative coordinates,) but this implementation doesn't.Some existing plugins that could make use of this include
plugins/blueprint.cpp
,plugins/dig-now.cpp
, andplugins/regrass.cpp
.Units::isUnitInBox
could be made to support this.plugins/cleaners.cpp
could have this as an alternative to cleaning the entire map.gui/teleport.lua
could probably make use of this if Lua doesn't make that a pain.The text was updated successfully, but these errors were encountered: