Definition at line 11 of file FinderField.h.
Public Member Functions | |
FinderField (int w, int h) | |
Two dimensional array of booleans. | |
virtual | ~FinderField () |
void | reset () |
Erase all marks. | |
void | markClosed (const V2 &loc) |
Mark given place as closed. | |
bool | isClosed (const V2 &loc) const |
Returns true when place is closed. |
|
Two dimensional array of booleans.
Definition at line 19 of file FinderField.cpp. 00020 { 00021 m_w = w; 00022 m_h = h; 00023 00024 //NOTE: [y][x] indexes 00025 m_closed = new bool*[m_h]; 00026 for (int y = 0; y < m_h; ++y) { 00027 m_closed[y] = new bool[m_w]; 00028 memset(m_closed[y], false, sizeof(bool) * m_w); 00029 } 00030 }
|
|
Definition at line 32 of file FinderField.cpp. 00033 { 00034 for (int y = 0; y < m_h; ++y) { 00035 delete[] m_closed[y]; 00036 } 00037 delete[] m_closed; 00038 }
|
|
Returns true when place is closed. NOTE: all places outside array are marked as closed Definition at line 70 of file FinderField.cpp. 00071 { 00072 int x = loc.getX(); 00073 int y = loc.getY(); 00074 00075 bool result = true; 00076 if ((0 <= x && x < m_w) && (0 <= y && y < m_h)) { 00077 result = m_closed[y][x]; 00078 } 00079 return result; 00080 }
|
|
Mark given place as closed.
Definition at line 55 of file FinderField.cpp. 00056 { 00057 int x = loc.getX(); 00058 int y = loc.getY(); 00059 00060 if ((0 <= x && x < m_w) && (0 <= y && y < m_h)) { 00061 m_closed[y][x] = true; 00062 } 00063 }
|
|
Erase all marks.
Definition at line 44 of file FinderField.cpp. 00045 { 00046 for (int y = 0; y < m_h; ++y) { 00047 memset(m_closed[y], false, sizeof(bool) * m_w); 00048 } 00049 }
|