summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2FInfoPtIterator.h
blob: 95c0660ec3800d748f7affa48af8d17d98cdc098 (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
#pragma once
#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);
}