mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-15 03:25:01 -05:00
fix intersection code in Patch
This commit is contained in:
parent
ba88e12cb0
commit
45ce360836
1 changed files with 5 additions and 5 deletions
|
@ -46,13 +46,13 @@ std::vector<Patch::Impl*>& Patch::Impl::allEnabled() {
|
|||
}
|
||||
|
||||
Result<> Patch::Impl::enable() {
|
||||
auto const thisMin = this->getAddress();
|
||||
auto const thisMax = this->getAddress() + this->m_patch.size() - 1;
|
||||
// TODO: this feels slow. can be faster
|
||||
for (const auto& other : allEnabled()) {
|
||||
auto thisMin = this->getAddress();
|
||||
auto thisMax = this->getAddress() + this->m_patch.size();
|
||||
auto otherMin = other->getAddress();
|
||||
auto otherMax = other->getAddress() + other->m_patch.size();
|
||||
bool intersects = !((otherMax < thisMin) || (thisMax < otherMin));
|
||||
auto const otherMin = other->getAddress();
|
||||
auto const otherMax = other->getAddress() + other->m_patch.size() - 1;
|
||||
bool intersects = (thisMin >= otherMin && thisMin <= otherMax) || (thisMax >= otherMin && thisMax <= otherMax);
|
||||
if (!intersects)
|
||||
continue;
|
||||
return Err(
|
||||
|
|
Loading…
Reference in a new issue