summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2FInfoPtIterator.h
blob: 0310c378ee2acb25741957d0f95caa22032b3f55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef T2DLL_T2FINFOPTITERATOR_H
#define T2DLL_T2FINFOPTITERATOR_H
#include "../common.h"

class AFX_CLASS_EXPORT T2FInfoPtIterator {
public:
    T2FInfoPtIterator(const T2FloorInfo& inFloorInfo, POINT inPt);
    virtual ~T2FInfoPtIterator();

    BOOL CurrentH(int& outH) const;
    BOOL Current(T2UnitInfo*& outUnitInfo);
    BOOL Right(T2UnitInfo*& outUnitInfo);
    BOOL Left(T2UnitInfo*& outUnitInfo);
    BOOL RightTenant(T2Tenant*& outTenant);
    BOOL LeftTenant(T2Tenant*& outTenant);

protected:
    BOOL CalcRightUnitInfo();
    BOOL CalcLeftUnitInfo();
    BOOL IsValidPosition() const;

    const T2FloorInfo &mFloorInfo;
    int mLeftBound;
    int mRightBound;
    int mCurrH;
    T2UnitInfo *mCurrUnitInfo;
    unsigned int mLastIDSeen;
};

inline BOOL T2FInfoPtIterator::IsValidPosition() const {
    return (mCurrH > -1);
}
#endif