diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-07-01 02:43:29 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-07-01 02:43:29 +0100 |
commit | 5c6a48b2ff362a70416a6a00fda7d06e0f276f2d (patch) | |
tree | 62cf542c68d91aa6f7a4e3bfa9eddca4ab352970 /src/T2DLL/T2FloorInfo.cpp | |
parent | c0c336500955a23e344651e5412c9d9d441ef4ee (diff) | |
download | t2win-5c6a48b2ff362a70416a6a00fda7d06e0f276f2d.tar.gz t2win-5c6a48b2ff362a70416a6a00fda7d06e0f276f2d.zip |
i am in hell
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2FloorInfo.cpp | 431 |
1 files changed, 219 insertions, 212 deletions
diff --git a/src/T2DLL/T2FloorInfo.cpp b/src/T2DLL/T2FloorInfo.cpp index 7ab47a6..0bd508c 100644 --- a/src/T2DLL/T2FloorInfo.cpp +++ b/src/T2DLL/T2FloorInfo.cpp @@ -2,6 +2,7 @@ #include "GlobalFunc.h" #include "T2Archive.h" #include "T2FInfoAreaIterator.h" +#include "T2FInfoPtIterator.h" #include "T2FloorInfo.h" #include "T2Mover.h" #include "T2MoverArray.h" @@ -74,7 +75,12 @@ T2FloorInfo::T2FloorInfo(const T2WorldDef* inWorldDef) { } int T2FloorInfo::UnitToFloor(int unit) const { - return (unit < mGroundLine) ? (mGroundLine - unit) : ((mGroundLine - unit) - 1); + int result; + if (unit < mGroundLine) + result = mGroundLine - unit; + else + result = mGroundLine - unit - 1; + return result; } void T2FloorInfo::InitMask(CResFile& inResFile) { @@ -86,10 +92,10 @@ void T2FloorInfo::InitMask(CResFile& inResFile) { #line 211 _ASSERT((vcheck == mVRange) && (hcheck == mHRange)); - int tmp; - RECT tmpRect; - inResFile >> tmp; - inResFile >> tmpRect; + int someUnkVal; + RECT someUnkRect; + inResFile >> someUnkVal; + inResFile >> someUnkRect; for (int i = 0; i < (mVRange * mHRange); i++) mUnitInfo[i].InitMask(inResFile); @@ -107,35 +113,35 @@ void T2FloorInfo::Read(T2Archive& inArchive, T2TowerDoc* inDoc) { #line 234 _ASSERT((vcheck == mVRange) && (hcheck == mHRange)); - DWORD code; - inArchive >> code; + DWORD classID; + inArchive >> classID; #line 239 - _ASSERT(code == 'UntI'); + _ASSERT(classID == 'UntI'); - for (int i = 0; i < (mVRange * mHRange); i++) + for (int i = 0; i < (mHRange * mVRange); i++) mUnitInfo[i].Read(inArchive, inDoc); - inArchive >> code; - if (code == 'TntA') { + inArchive >> classID; + if (classID == 'TntA') { mTenantArrayList->Read(inArchive, inDoc); T2RegistedTenantDB *theDB = inDoc->towerDoc_vf174(); theDB->Init(mTenantArrayList); mTenantArrayList->RecoverRelatedTenantList(theDB); - inArchive >> code; + inArchive >> classID; } - if (code == 'MvrA') { + if (classID == 'MvrA') { mMoverArrayList->Read(inArchive, inDoc); - inArchive >> code; + inArchive >> classID; } - if (code == 'ReqA') { + if (classID == 'ReqA') { mRequestArrayList->Read(inArchive, inDoc); - inArchive >> code; + inArchive >> classID; } - if (code == 'OObA') { + if (classID == 'OObA') { mOutObjArrayList->Read(inArchive, inDoc); - inArchive >> code; + inArchive >> classID; } - if (code == 'OutI') + if (classID == 'OutI') mOutsideInfo->Read(inArchive); } @@ -143,29 +149,29 @@ void T2FloorInfo::Write(T2Archive& inArchive) { inArchive << mVRange; inArchive << mHRange; - DWORD code = 'UntI'; - inArchive << code; - for (int i = 0; i < (mVRange * mHRange); i++) + DWORD classID = 'UntI'; + inArchive << classID; + for (int i = 0; i < (mHRange * mVRange); i++) mUnitInfo[i].Write(inArchive); - code = 'TntA'; - inArchive << code; + classID = 'TntA'; + inArchive << classID; mTenantArrayList->Write(inArchive); - code = 'MvrA'; - inArchive << code; + classID = 'MvrA'; + inArchive << classID; mMoverArrayList->Write(inArchive); - code = 'ReqA'; - inArchive << code; + classID = 'ReqA'; + inArchive << classID; mRequestArrayList->Write(inArchive); - code = 'OObA'; - inArchive << code; + classID = 'OObA'; + inArchive << classID; mOutObjArrayList->Write(inArchive); - code = 'OutI'; - inArchive << code; + classID = 'OutI'; + inArchive << classID; mOutsideInfo->Write(inArchive); } @@ -198,10 +204,10 @@ BOOL T2FloorInfo::IsAllTenant(const RECT& inRect) { BOOL result = true; T2FInfoAreaIterator iterator(*this, inRect); - T2UnitInfo *unitInfo; + T2UnitInfo *theUnitInfo; - while (iterator.Next(unitInfo)) { - if (unitInfo->GetTenantID() < 1000) { + while (iterator.Next(theUnitInfo)) { + if (theUnitInfo->GetTenantID() < 1000) { result = false; break; } @@ -227,58 +233,58 @@ BOOL T2FloorInfo::IsThereNoFloorTenant(const RECT& inRect) { } BOOL T2FloorInfo::IsThereMover(const RECT& inRect) { - BOOL result = false; + BOOL found = false; T2FInfoAreaIterator iterator(*this, inRect); T2UnitInfo *theUnitInfo; while (iterator.Next(theUnitInfo)) { if (theUnitInfo->GetMoverID()) { - result = true; + found = true; break; } } - return result; + return found; } BOOL T2FloorInfo::IsThereOtherKindMover(const RECT& inRect, int inType) { - BOOL result = false; - unsigned int zero = 0; + BOOL found = false; + unsigned int noMoverID = 0; T2FInfoAreaIterator iterator(*this, inRect); T2UnitInfo *theUnitInfo; while (iterator.Next(theUnitInfo)) { unsigned int moverID = theUnitInfo->GetMoverID(); - if (moverID != 0 && moverID != zero) { + if (moverID != 0 && moverID != noMoverID) { T2Mover *theMover = GetMover(moverID); if (theMover && theMover->GetEquipType() != inType) { - result = true; + found = true; break; } } } - return result; + return found; } BOOL T2FloorInfo::IsEnoughSideSpace(const RECT& inRect) { - BOOL result = true; + BOOL isEnough = true; RECT rect = inRect; rect.right = rect.left; rect.left -= T2MoverDef::GetRequiredRequestSpace() * 2; - result = !IsThereMover(rect); + isEnough = !IsThereMover(rect); - if (result) { + if (isEnough) { rect = inRect; - rect.right = rect.left; - rect.left += T2MoverDef::GetRequiredRequestSpace() * 2; - result = !IsThereMover(rect); + rect.left = rect.right; + rect.right += T2MoverDef::GetRequiredRequestSpace() * 2; + isEnough = !IsThereMover(rect); } - return result; + return isEnough; } T2Tenant* T2FloorInfo::GetTenant(unsigned int inTenantID) const { @@ -305,19 +311,19 @@ T2Tenant* T2FloorInfo::GetPoolTenant() const { } T2Tenant* T2FloorInfo::GetFloor(int inV, int inH) const { - T2Tenant *result = NULL; + T2Tenant *floor = NULL; T2Tenant *theTenant = GetTenant(inV, inH); if (theTenant) { if (theTenant->IsFloor()) { - result = theTenant; + floor = theTenant; } else { unsigned int floorID = theTenant->GetFloorID(inV); - result = GetTenant(floorID); + floor = GetTenant(floorID); } } - return result; + return floor; } T2Mover* T2FloorInfo::GetMover(unsigned int inMoverID) { @@ -426,13 +432,13 @@ unsigned int T2FloorInfo::GetTenantID(int inV, int inH) const { } unsigned int T2FloorInfo::GetFloorID(int inV, int inH) { - unsigned int result = 0; + unsigned int theID = 0; T2Tenant *theTenant = GetTenant(inV, inH); if (theTenant) - result = theTenant->GetFloorID(inV); + theID = theTenant->GetFloorID(inV); - return result; + return theID; } unsigned int T2FloorInfo::GetEntranceFloorID(unsigned int inTenantID) { @@ -555,57 +561,57 @@ void T2FloorInfo::FillRequestID(const RECT& inRect, unsigned int inRequestID) { } int T2FloorInfo::FillRequestID(POINT inPt, ERequestUpDown inUpDown, unsigned int inRequestID) { - int result = 0; + int theWidth = 0; POINT pt = inPt; if (inUpDown == ERequestUpDown_1) { pt.x += 2; - T2Request *theRequest = GetRequest(pt.y, pt.x); - if (theRequest) { - POINT head = theRequest->GetHeadPosition(); - result = ((head.x - inPt.x) / 2) - 2; - int width = result + ((head.x - inPt.x) % 2); - theRequest->SetDrawWidth(width); + T2Request *theRightReq = GetRequest(pt.y, pt.x); + if (theRightReq) { + POINT headPtR = theRightReq->GetHeadPosition(); + theWidth = ((headPtR.x - inPt.x) / 2) - 2; + int theRemain = theWidth + ((headPtR.x - inPt.x) % 2); + theRightReq->SetDrawWidth(theRemain); } else { T2Tenant *theFloor = GetFloor(pt.y, pt.x); if (theFloor) { RECT floorArea; theFloor->GetEquipArea(floorArea); - result = CalcRequestRightEnd(pt, floorArea.right) - inPt.x - 2; + theWidth = CalcRequestRightEnd(pt, floorArea.right) - inPt.x - 2; } } } else { pt.x -= 3; - T2Request *theRequest = GetRequest(pt.y, pt.x); - if (theRequest) { - POINT head = theRequest->GetHeadPosition(); - int width = ((inPt.x - head.x) / 2) - 2; - theRequest->SetDrawWidth(width); - result = width + ((inPt.x - head.x) % 2); + T2Request *theLeftReq = GetRequest(pt.y, pt.x); + if (theLeftReq) { + POINT headPtL = theLeftReq->GetHeadPosition(); + int theRemain = ((inPt.x - headPtL.x) / 2) - 2; + theLeftReq->SetDrawWidth(theRemain); + theWidth = theRemain + ((inPt.x - headPtL.x) % 2); } else { T2Tenant *theFloor = GetFloor(pt.y, pt.x); if (theFloor) { RECT floorArea; theFloor->GetEquipArea(floorArea); - result = inPt.x - CalcRequestLeftEnd(pt, floorArea.left) - 2; + theWidth = inPt.x - CalcRequestLeftEnd(pt, floorArea.left) - 2; } } } - RECT area; - area.top = inPt.y; - area.bottom = inPt.y + 1; - area.left = area.right = inPt.x; + RECT theFillArea; + theFillArea.top = inPt.y; + theFillArea.bottom = inPt.y + 1; + theFillArea.left = theFillArea.right = inPt.x; if (inUpDown == ERequestUpDown_1) - area.right = inPt.x + result + 2; + theFillArea.right = inPt.x + theWidth + 2; else - area.left = inPt.x - result - 2; + theFillArea.left = inPt.x - theWidth - 2; - FillRequestID(area, inRequestID); - return result; + FillRequestID(theFillArea, inRequestID); + return theWidth; } void T2FloorInfo::RemoveRequestID(ERequestUpDown inUpDown, const RECT& inRect) { @@ -636,126 +642,126 @@ void T2FloorInfo::FillOutObjID(const RECT& inRect, unsigned int inOutObjID) { } unsigned int T2FloorInfo::FindTenantID(int inV, int inH, BOOL inRight, int inMaxDistance, unsigned int inExclTenantID) { - unsigned int result = 0; + unsigned int id = 0; - POINT pt; - SetPt(&pt, inH, inV); - T2FInfoPtIterator iterator(*this, pt); + POINT ptStart; + SetPt(&ptStart, inH, inV); + T2FInfoPtIterator iterator(*this, ptStart); - int distance = 0; + int count = 0; T2UnitInfo *theUnitInfo; - unsigned int checkID; + unsigned int theUnitID; if (!inRight) { - while (iterator.Left(theUnitInfo) && distance < inMaxDistance) { - checkID = theUnitInfo->GetTenantID(); - if (checkID != 0 && checkID != inExclTenantID) { - result = checkID; + while (iterator.Left(theUnitInfo) && count < inMaxDistance) { + theUnitID = theUnitInfo->GetTenantID(); + if (theUnitID != 0 && theUnitID != inExclTenantID) { + id = theUnitID; break; } - distance++; + count++; } } else { - while (iterator.Right(theUnitInfo) && distance < inMaxDistance) { - checkID = theUnitInfo->GetTenantID(); - if (checkID != 0 && checkID != inExclTenantID) { - result = checkID; + while (iterator.Right(theUnitInfo) && count < inMaxDistance) { + theUnitID = theUnitInfo->GetTenantID(); + if (theUnitID != 0 && theUnitID != inExclTenantID) { + id = theUnitID; break; } - distance++; + count++; } } - return result; + return id; } int T2FloorInfo::CalcRequestRightEnd(POINT inPt, int inMaxH) { - int h = inPt.x + 1; + int currH = inPt.x + 1; T2FInfoPtIterator iterator(*this, inPt); - T2UnitInfo *theUnitInfo; + T2UnitInfo *theInfo; - while (iterator.Right(theUnitInfo) && h < inMaxH) { - if (theUnitInfo->GetMoverID() != 0) { - h -= 2; + while (iterator.Right(theInfo) && currH < inMaxH) { + if (theInfo->GetMoverID() != 0) { + currH -= 2; break; } - h++; + currH++; } - return h; + return currH; } int T2FloorInfo::CalcRequestLeftEnd(POINT inPt, int inMinH) { - int h = inPt.x; + int currH = inPt.x; T2FInfoPtIterator iterator(*this, inPt); - T2UnitInfo *theUnitInfo; + T2UnitInfo *theInfo; - while (iterator.Left(theUnitInfo) && h > inMinH) { - if (theUnitInfo->GetMoverID() != 0) { - h += 2; + while (iterator.Left(theInfo) && currH > inMinH) { + if (theInfo->GetMoverID() != 0) { + currH += 2; break; } - h--; + currH--; } - return h; + return currH; } int T2FloorInfo::GetLeftMoverID(POINT inPt, int inMinH) const { - int result = 0; - int h = inPt.x; + int moverID = 0; + int currH = inPt.x; T2FInfoPtIterator iterator(*this, inPt); - T2UnitInfo *theUnitInfo; + T2UnitInfo *theInfo; - while (iterator.Left(theUnitInfo) && h > inMinH && result == 0) { - result = theUnitInfo->GetMoverID(); - h--; + while (iterator.Left(theInfo) && currH > inMinH && moverID == 0) { + moverID = theInfo->GetMoverID(); + currH--; } - return result; + return moverID; } void T2FloorInfo::UpdeteRequestByUnionFloor(T2Tenant* inTenant, POINT inPt) { - POINT rightPt = inPt; - rightPt.x++; + POINT ptR = inPt; + ptR.x++; - T2Request *theLeftRequest = GetRequest(inPt.y, inPt.x); - T2Request *theRightRequest = GetRequest(rightPt.y, rightPt.x); + T2Request *theLeftReq = GetRequest(inPt.y, inPt.x); + T2Request *theRightReq = GetRequest(ptR.y, ptR.x); - if (theLeftRequest) { - POINT leftHeadPt = theLeftRequest->GetHeadPosition(); - if (theRightRequest) { - POINT rightHeadPt = theRightRequest->GetHeadPosition(); + if (theLeftReq) { + POINT headPtLeft = theLeftReq->GetHeadPosition(); + if (theRightReq) { + POINT headPtRight = theRightReq->GetHeadPosition(); - int width = ((rightHeadPt.x - leftHeadPt.x) / 2) - 2; - theLeftRequest->SetDrawWidth(width); - theRightRequest->SetDrawWidth(width + ((rightHeadPt.x - leftHeadPt.x) % 2)); + int theWidth = ((headPtRight.x - headPtLeft.x) / 2) - 2; + theLeftReq->SetDrawWidth(theWidth); + theRightReq->SetDrawWidth(theWidth + ((headPtRight.x - headPtLeft.x) % 2)); RECT rightArea; - theRightRequest->CalcArea(rightArea); - FillRequestID(rightArea, theRightRequest->GetRequestID()); + theRightReq->CalcArea(rightArea); + FillRequestID(rightArea, theRightReq->GetRequestID()); } else { - RECT floorArea; - inTenant->GetEquipArea(floorArea); - theLeftRequest->SetDrawWidth(CalcRequestRightEnd(inPt, floorArea.right) - leftHeadPt.x - 2); + RECT rightArea; + inTenant->GetEquipArea(rightArea); + theLeftReq->SetDrawWidth(CalcRequestRightEnd(inPt, rightArea.right) - headPtLeft.x - 2); } RECT leftArea; - theLeftRequest->CalcArea(leftArea); - FillRequestID(leftArea, theLeftRequest->GetRequestID()); - } else if (theRightRequest) { - POINT rightHeadPt = theRightRequest->GetHeadPosition(); + theLeftReq->CalcArea(leftArea); + FillRequestID(leftArea, theLeftReq->GetRequestID()); + } else if (theRightReq) { + POINT headPtRight = theRightReq->GetHeadPosition(); - RECT floorArea; - inTenant->GetEquipArea(floorArea); - theRightRequest->SetDrawWidth(rightHeadPt.x - CalcRequestLeftEnd(rightPt, floorArea.left) - 2); + RECT leftArea; + inTenant->GetEquipArea(leftArea); + theRightReq->SetDrawWidth(headPtRight.x - CalcRequestLeftEnd(ptR, leftArea.left) - 2); RECT rightArea; - theRightRequest->CalcArea(rightArea); - FillRequestID(rightArea, theRightRequest->GetRequestID()); + theRightReq->CalcArea(rightArea); + FillRequestID(rightArea, theRightReq->GetRequestID()); } } @@ -770,12 +776,12 @@ void T2FloorInfo::MoverAreaRemoved(const RECT& inRect) { } void T2FloorInfo::UpdeteRequestByBuildMover(const RECT& inRect) { - POINT pt; - pt.x = inRect.left; - pt.y = inRect.top; + POINT ptStart; + ptStart.x = inRect.left; + ptStart.y = inRect.top; - for (int v = inRect.top; v < inRect.bottom; v++, pt.y++) { - T2Request *theRequest = GetRequest(pt.y, pt.x); + for (int v = inRect.top; v < inRect.bottom; v++, ptStart.y++) { + T2Request *theRequest = GetRequest(ptStart.y, ptStart.x); if (theRequest) { POINT headPt = theRequest->GetHeadPosition(); int width = theRequest->GetDrawWidth() + 2; @@ -785,45 +791,45 @@ void T2FloorInfo::UpdeteRequestByBuildMover(const RECT& inRect) { area.bottom = v + 1; if (theRequest->GetUpDown() == ERequestUpDown_1) { - POINT pt2 = pt; + POINT ptEnd = ptStart; area.left = inRect.left - 2; area.right = headPt.x + width; theRequest->SetDrawWidth(area.left - headPt.x - 2); FillRequestID(area, 0); - pt2.x = area.right; - T2Request *theOtherRequest = GetRequest(pt2.y, pt2.x); - if (theOtherRequest) { - POINT headPt2 = theOtherRequest->GetHeadPosition(); - if (pt2.x < (inRect.right + 2)) { - area.left = pt2.x; + ptEnd.x = area.right; + T2Request *theOtherReq = GetRequest(ptEnd.y, ptEnd.x); + if (theOtherReq) { + POINT headPt2 = theOtherReq->GetHeadPosition(); + if (ptEnd.x < (inRect.right + 2)) { + area.left = ptEnd.x; area.right = inRect.right + 2; - theOtherRequest->SetDrawWidth(headPt2.x - area.right - 2); + theOtherReq->SetDrawWidth(headPt2.x - area.right - 2); FillRequestID(area, 0); - } else if (pt2.x > (inRect.right + 2)) { + } else if (ptEnd.x > (inRect.right + 2)) { area.left = inRect.right + 2; - area.right = pt2.x; - theOtherRequest->SetDrawWidth(headPt.x - area.left - 2); - FillRequestID(area, theOtherRequest->GetRequestID()); + area.right = ptEnd.x; + theOtherReq->SetDrawWidth(headPt2.x - area.left - 2); + FillRequestID(area, theOtherReq->GetRequestID()); } } } else { - POINT pt2 = pt; + POINT ptEnd = ptStart; area.left = headPt.x - width; area.right = inRect.right + 2; theRequest->SetDrawWidth(headPt.x - area.right - 2); FillRequestID(area, 0); - pt2.x = area.left - 1; - T2Request *theOtherRequest = GetRequest(pt2.y, pt2.x); - if (theOtherRequest) { - POINT headPt2 = theOtherRequest->GetHeadPosition(); - area.left = pt2.x + 1; + ptEnd.x = area.left - 1; + T2Request *theOtherReq = GetRequest(ptEnd.y, ptEnd.x); + if (theOtherReq) { + POINT headPt2 = theOtherReq->GetHeadPosition(); + area.left = ptEnd.x + 1; area.right = inRect.left - 2; - theOtherRequest->SetDrawWidth(area.right - headPt2.x - 2); - FillRequestID(area, theOtherRequest->GetRequestID()); + theOtherReq->SetDrawWidth(area.right - headPt2.x - 2); + FillRequestID(area, theOtherReq->GetRequestID()); } } } @@ -831,55 +837,55 @@ void T2FloorInfo::UpdeteRequestByBuildMover(const RECT& inRect) { } void T2FloorInfo::UpdeteRequestByRemoveMover(const RECT& inRect) { - POINT pt1; - POINT pt2; + POINT ptL; + POINT ptR; - pt2.y = pt1.y = inRect.top; + ptR.y = ptL.y = inRect.top; - pt1.x = inRect.left - 3; - pt2.x = inRect.right + 2; + ptL.x = inRect.left - 3; + ptR.x = inRect.right + 2; - for (; pt1.y < inRect.bottom; pt1.y++, pt2.y++) { - T2Request *theRequest1 = GetRequest(pt1.y, pt1.x); - T2Request *theRequest2 = GetRequest(pt2.y, pt2.x); + for (; ptL.y < inRect.bottom; ptL.y++, ptR.y++) { + T2Request *theLeftReq = GetRequest(ptL.y, ptL.x); + T2Request *theRightReq = GetRequest(ptR.y, ptR.x); - if (theRequest1) { - POINT headPt1 = theRequest1->GetHeadPosition(); - if (theRequest2) { - POINT headPt2 = theRequest2->GetHeadPosition(); + if (theLeftReq) { + POINT headPtLeft = theLeftReq->GetHeadPosition(); + if (theRightReq) { + POINT headPtRight = theRightReq->GetHeadPosition(); - int width = ((headPt2.x - headPt1.x) / 2) - 2; - theRequest1->SetDrawWidth(width); - theRequest2->SetDrawWidth(width + ((headPt2.x - headPt1.x) % 2)); + int theWidth = ((headPtRight.x - headPtLeft.x) / 2) - 2; + theLeftReq->SetDrawWidth(theWidth); + theRightReq->SetDrawWidth(theWidth + ((headPtRight.x - headPtLeft.x) % 2)); - RECT area2; - theRequest2->CalcArea(area2); - FillRequestID(area2, theRequest2->GetRequestID()); + RECT rightArea; + theRightReq->CalcArea(rightArea); + FillRequestID(rightArea, theRightReq->GetRequestID()); } else { - T2Tenant *theFloor = GetFloor(pt1.y, pt1.x); - if (theFloor) { + T2Tenant *theLeftFloor = GetFloor(ptL.y, ptL.x); + if (theLeftFloor) { RECT floorArea; - theFloor->GetEquipArea(floorArea); - theRequest1->SetDrawWidth(CalcRequestRightEnd(pt1, floorArea.right) - headPt1.x - 2); + theLeftFloor->GetEquipArea(floorArea); + theLeftReq->SetDrawWidth(CalcRequestRightEnd(ptL, floorArea.right) - headPtLeft.x - 2); } } - RECT area1; - theRequest1->CalcArea(area1); - FillRequestID(area1, theRequest1->GetRequestID()); - } else if (theRequest2) { - POINT headPt2 = theRequest2->GetHeadPosition(); + RECT leftArea; + theLeftReq->CalcArea(leftArea); + FillRequestID(leftArea, theLeftReq->GetRequestID()); + } else if (theRightReq) { + POINT headPtRight = theRightReq->GetHeadPosition(); - T2Tenant *theFloor = GetFloor(pt1.y, pt1.x); - if (theFloor) { + T2Tenant *theRightFloor = GetFloor(ptR.y, ptR.x); + if (theRightFloor) { RECT floorArea; - theFloor->GetEquipArea(floorArea); - theRequest2->SetDrawWidth(headPt2.x - CalcRequestLeftEnd(pt2, floorArea.left) - 2); + theRightFloor->GetEquipArea(floorArea); + theRightReq->SetDrawWidth(headPtRight.x - CalcRequestLeftEnd(ptR, floorArea.left) - 2); } - RECT area2; - theRequest2->CalcArea(area2); - FillRequestID(area2, theRequest2->GetRequestID()); + RECT rightArea; + theRightReq->CalcArea(rightArea); + FillRequestID(rightArea, theRightReq->GetRequestID()); } } } @@ -910,10 +916,10 @@ T2Tenant* T2FloorInfo::FindNumberredTenant(int inV, unsigned int inTenantNumber) #line 1399 _ASSERT((inV >= 0) && (inV < mVRange)); - POINT pt; - SetPt(&pt, mBuildArea.left, inV); + POINT leftPt; + SetPt(&leftPt, mBuildArea.left, inV); - T2FInfoPtIterator iterator(*this, pt); + T2FInfoPtIterator iterator(*this, leftPt); T2Tenant *theTenant = NULL; while (iterator.RightTenant(theTenant)) { @@ -937,7 +943,7 @@ void T2FloorInfo::FinishBuildFloor(T2TowerDoc* inDoc, const RECT& inRect) { } void T2FloorInfo::SetTenantDrawModeByRect(const RECT& inRect, int inDrawMode) { - RECT rect = inRect; + RECT theRect = inRect; int actualMode; switch (inDrawMode) { @@ -952,7 +958,7 @@ void T2FloorInfo::SetTenantDrawModeByRect(const RECT& inRect, int inDrawMode) { while (iterator.NextTenant(theTenant)) theTenant->SetDrawMode(inDrawMode); - rect.top++; + theRect.top++; actualMode = DrawMode2; break; } @@ -964,7 +970,7 @@ void T2FloorInfo::SetTenantDrawModeByRect(const RECT& inRect, int inDrawMode) { break; } - T2FInfoAreaIterator iterator(*this, rect); + T2FInfoAreaIterator iterator(*this, theRect); T2Tenant *theTenant; while (iterator.NextTenant(theTenant)) @@ -1006,20 +1012,21 @@ T2Tenant* T2FloorInfo::GetTenantByPID(DWORD inPluginID) { } BOOL T2FloorInfo::BuildFinishForce(const RECT& inRect) { - BOOL result = false; + BOOL finished = false; POINT pt; + T2Tenant *theTenant; for (pt.y = inRect.top; pt.y < inRect.bottom; pt.y++) { for (pt.x = inRect.left; pt.x < inRect.right; pt.x++) { - T2Tenant *theTenant = GetTenant(pt.y, pt.x); + theTenant = GetTenant(pt.y, pt.x); if (theTenant && theTenant->GetStatus() < kTenantStatus10) { theTenant->SetStatus(kTenantStatus9); theTenant->Idle(GetCurrentT2TowerDoc()); GetCurrentT2TowerDoc()->mTowerMainView->tmv_vf128(theTenant->mArea); - result = true; + finished = true; } } } - return result; + return finished; } |