Improve match

This commit is contained in:
Christian Semmler 2024-01-31 09:01:31 -05:00
parent 693d3d2601
commit 5b75bf0145
2 changed files with 7 additions and 8 deletions

View File

@ -741,10 +741,14 @@ MxBool Infocenter::VTable0x5c()
void Infocenter::FUN_10070d10(MxS32 p_x, MxS32 p_y) void Infocenter::FUN_10070d10(MxS32 p_x, MxS32 p_y)
{ {
MxS16 i; MxS16 i;
for (i = 0; i < sizeof(m_mapAreas) / sizeof(m_mapAreas[0]); i++) { for (i = 0; i < (MxS32) (sizeof(m_mapAreas) / sizeof(m_mapAreas[0])); i++) {
if (m_mapAreas[i].m_area.ContainsPoint(p_x, p_y)) { MxS32 right = m_mapAreas[i].m_area.GetRight();
MxS32 bottom = m_mapAreas[i].m_area.GetBottom();
MxS32 left = m_mapAreas[i].m_area.GetLeft();
MxS32 top = m_mapAreas[i].m_area.GetTop();
if (left <= p_x && p_x <= right && top <= p_y && p_y <= bottom)
break; break;
}
} }
if (i == 7) { if (i == 7) {

View File

@ -71,11 +71,6 @@ class MxRect32 {
return m_left < p_rect.m_right && p_rect.m_left < m_right && m_top < p_rect.m_bottom && p_rect.m_top < m_bottom; return m_left < p_rect.m_right && p_rect.m_left < m_right && m_top < p_rect.m_bottom && p_rect.m_top < m_bottom;
} }
inline MxBool ContainsPoint(MxS32 p_x, MxS32 p_y)
{
return m_left <= p_x && p_x <= m_right && m_top <= p_y && p_y <= m_bottom;
}
inline MxS32 GetWidth() const { return (m_right - m_left) + 1; } inline MxS32 GetWidth() const { return (m_right - m_left) + 1; }
inline MxS32 GetHeight() const { return (m_bottom - m_top) + 1; } inline MxS32 GetHeight() const { return (m_bottom - m_top) + 1; }