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/T2Request.cpp | |
parent | c0c336500955a23e344651e5412c9d9d441ef4ee (diff) | |
download | t2win-5c6a48b2ff362a70416a6a00fda7d06e0f276f2d.tar.gz t2win-5c6a48b2ff362a70416a6a00fda7d06e0f276f2d.zip |
i am in hell
Diffstat (limited to 'src/T2DLL/T2Request.cpp')
-rw-r--r-- | src/T2DLL/T2Request.cpp | 181 |
1 files changed, 91 insertions, 90 deletions
diff --git a/src/T2DLL/T2Request.cpp b/src/T2DLL/T2Request.cpp index a1607d0..3ff951a 100644 --- a/src/T2DLL/T2Request.cpp +++ b/src/T2DLL/T2Request.cpp @@ -63,15 +63,14 @@ void T2Request::InitRequest(T2FloorInfo* floorInfo, unsigned int moverID, POINT } void T2Request::RemoveRequest(T2TowerDoc* towerDoc) { - T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); - T2TowerMainView *mainView = towerDoc->GetTowerMainView(); + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); + T2TowerMainView *theView = towerDoc->GetTowerMainView(); - RemoveContents(floorInfo); + RemoveContents(theFloorInfo); - CRect prevArea; - CRect area; - CalcPrevArea(area); - CalcArea(area); + CRect thePrevArea, theNextArea; + CalcPrevArea(thePrevArea); + CalcArea(theNextArea); ERequestUpDown upDown; if (mIsGoDown) @@ -79,12 +78,12 @@ void T2Request::RemoveRequest(T2TowerDoc* towerDoc) { else upDown = ERequestUpDown_0; - floorInfo->RemoveRequestID(upDown, area); + theFloorInfo->RemoveRequestID(upDown, theNextArea); SetUsed(false); - floorInfo->SetTenantDrawModeByRect(prevArea, DrawMode1); + theFloorInfo->SetTenantDrawModeByRect(thePrevArea, DrawMode1); - if (mainView) - mainView->tmv_vf128(area, false); + if (theView) + theView->tmv_vf128(theNextArea, false); } void T2Request::RemoveContents(T2FloorInfo* floorInfo) { @@ -129,17 +128,17 @@ void T2Request::StopRemoved(T2TowerDoc* towerDoc, int y) { } T2PeopleLinkIterator iterator(mFirst); - T2People *people = NULL; - T2People *nextPeople = NULL; - iterator.Next(&people); - while (people) { - iterator.Next(&nextPeople); - if (people->GetCurrDestPos().y == y) { - Leave(people); - theFloor->Enter(people); + T2People *thePeople = NULL; + T2People *theNextPeople = NULL; + iterator.Next(&thePeople); + while (thePeople) { + iterator.Next(&theNextPeople); + if (thePeople->GetCurrDestPos().y == y) { + Leave(thePeople); + theFloor->Enter(thePeople); } - people = nextPeople; - nextPeople = NULL; + thePeople = theNextPeople; + theNextPeople = NULL; } } @@ -314,17 +313,17 @@ T2People* T2Request::LeaveFirst() { } BOOL T2Request::Regist(T2TowerDoc* towerDoc, T2People* people) { - BOOL result = false; + BOOL isRegist = false; T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); - POINT position = mHeadPosition; - POINT curPos = people->GetCurPosition(); + POINT headPt = mHeadPosition; + POINT curPt = people->GetCurPosition(); if (mIsGoDown) - position.x += 2; + headPt.x += 2; else - position.x -= 4; + headPt.x -= 4; - if (curPos.y == position.y && curPos.x == position.x) { + if (curPt.y == headPt.y && curPt.x == headPt.x) { POINT destPos = people->GetCurrDestPos(); if (people->IsGoDown() == mIsGoDown) { T2Mover *theMover = theFloorInfo->GetMover(mMoverID); @@ -341,13 +340,13 @@ BOOL T2Request::Regist(T2TowerDoc* towerDoc, T2People* people) { people->SetDirection(0); people->ChangeStatus(6); - result = true; + isRegist = true; } } } } - return result; + return isRegist; } void T2Request::ChangeOffPPLStatus(T2FloorInfo* floorInfo, T2People* people) { @@ -356,8 +355,8 @@ void T2Request::ChangeOffPPLStatus(T2FloorInfo* floorInfo, T2People* people) { else people->MoveHTo(mHeadPosition.x - 4); - POINT pt = people->GetCurPosition(); - T2Tenant *floor = floorInfo->GetFloor(pt.y, pt.x); + POINT curPos = people->GetCurPosition(); + T2Tenant *floor = floorInfo->GetFloor(curPos.y, curPos.x); if (floor) { floor->Enter(people); people->ChangeStatus(4); @@ -430,25 +429,25 @@ T2People* T2Request::RemoveOffPeople() { #line 541 _ASSERT(theView != NULL); - CRect rect; + CRect area; if (mPeopleRemoved) { - CalcOnArea(rect); - theFloorInfo->SetTenantDrawModeByRect(rect, DrawMode1); - theView->tmv_vf128(rect, false); + CalcOnArea(area); + theFloorInfo->SetTenantDrawModeByRect(area, DrawMode1); + theView->tmv_vf128(area, false); } else if (mOnPeople || mOffPeople) { - CalcOnArea(rect); - theView->tmv_vf128(rect, false); + CalcOnArea(area); + theView->tmv_vf128(area, false); } if (m44) { - CalcPrevArea(rect); - theFloorInfo->SetTenantDrawModeByRect(rect, DrawMode1); - theView->tmv_vf128(rect, false); + CalcPrevArea(area); + theFloorInfo->SetTenantDrawModeByRect(area, DrawMode1); + theView->tmv_vf128(area, false); } - if (CalcIncQueueArea(rect)) - theView->tmv_vf128(rect, false); + if (CalcIncQueueArea(area)) + theView->tmv_vf128(area, false); return result; } @@ -462,44 +461,44 @@ T2People* T2Request::RemoveOffPeople() { } void T2Request::DrawUp(T2TowerDoc* towerDoc, const RECT& inRect) { - RECT myRect; - SetRect(&myRect, mHeadPosition.x - 2, mHeadPosition.y, mHeadPosition.x, mHeadPosition.y + 1); + RECT rect; + SetRect(&rect, mHeadPosition.x - 2, mHeadPosition.y, mHeadPosition.x, mHeadPosition.y + 1); - if (myRect.left < inRect.right) { + if (rect.left < inRect.right) { if (mOffPeople) - mOffPeople->Draw(towerDoc, inRect); + mOffPeople->Draw(towerDoc, rect); if (mOnPeople) - mOnPeople->Draw(towerDoc, inRect); + mOnPeople->Draw(towerDoc, rect); } - OffsetRect(&myRect, -2, 0); + OffsetRect(&rect, -2, 0); T2PeopleLinkIterator iterator(mFirst); T2People *people; - while (iterator.Next(&people) && myRect.right > inRect.left) { - if (myRect.left < inRect.right) - people->Draw(towerDoc, inRect); - OffsetRect(&myRect, -people->GetWidth(), 0); + while (iterator.Next(&people) && rect.right > inRect.left) { + if (rect.left < inRect.right) + people->Draw(towerDoc, rect); + OffsetRect(&rect, -people->GetWidth(), 0); } } void T2Request::DrawDown(T2TowerDoc* towerDoc, const RECT& inRect) { - RECT myRect; - SetRect(&myRect, mHeadPosition.x, mHeadPosition.y, mHeadPosition.x + 2, mHeadPosition.y + 1); + RECT rect; + SetRect(&rect, mHeadPosition.x, mHeadPosition.y, mHeadPosition.x + 2, mHeadPosition.y + 1); - if (myRect.right > inRect.left) { + if (rect.right > inRect.left) { if (mOffPeople) - mOffPeople->Draw(towerDoc, inRect); + mOffPeople->Draw(towerDoc, rect); if (mOnPeople) - mOnPeople->Draw(towerDoc, inRect); + mOnPeople->Draw(towerDoc, rect); } - OffsetRect(&myRect, 2, 0); + OffsetRect(&rect, 2, 0); T2PeopleLinkIterator iterator(mFirst); T2People *people; - while (iterator.Next(&people) && myRect.left < inRect.right) { - if (myRect.right > inRect.left) - people->Draw(towerDoc, inRect); - OffsetRect(&myRect, people->GetWidth(), 0); + while (iterator.Next(&people) && rect.left < inRect.right) { + if (rect.right > inRect.left) + people->Draw(towerDoc, rect); + OffsetRect(&rect, people->GetWidth(), 0); } } @@ -534,6 +533,7 @@ void T2Request::BreakoutEmergency(T2TowerDoc* towerDoc) { T2Object::LoadSelf(archive, towerDoc); if (IsUsed()) { +#pragma var_order(uc, c, s, us, ui) unsigned int ui; unsigned short us; unsigned char uc; @@ -597,6 +597,7 @@ void T2Request::BreakoutEmergency(T2TowerDoc* towerDoc) { T2Object::SaveSelf(archive); if (IsUsed()) { +#pragma var_order(uc, c, s, us, ui) unsigned int ui; unsigned short us; unsigned char uc; @@ -688,61 +689,61 @@ void T2Request::DrawFinished() { } T2People* T2Request::FindUpPeople(int inH) const { - T2People *result = NULL; + T2People *theUpPeople = NULL; - int minH = mHeadPosition.x; - int maxH = minH - 2; + int rightH = mHeadPosition.x; + int leftH = rightH - 2; - if (inH >= maxH) { + if (inH >= leftH) { if (mOffPeople) - result = mOffPeople; + theUpPeople = mOffPeople; else if (mOnPeople) - result = mOnPeople; + theUpPeople = mOnPeople; } - if (!result) { - minH = maxH; + if (!theUpPeople) { + rightH = leftH; T2PeopleLinkIterator iterator(mFirst); T2People *people; - while (!result && iterator.Next(&people)) { - maxH -= people->GetWidth(); - if (inH >= maxH && inH < minH) - result = people; - minH = maxH; + while (!theUpPeople && iterator.Next(&people)) { + leftH -= people->GetWidth(); + if (inH >= leftH && inH < rightH) + theUpPeople = people; + rightH = leftH; } } - return result; + return theUpPeople; } T2People* T2Request::FindDownPeople(int inH) const { - T2People *result = NULL; + T2People *theDownPeople = NULL; - int minH = mHeadPosition.x; - int maxH = minH + 2; + int leftH = mHeadPosition.x; + int rightH = leftH + 2; - if (inH < maxH) { + if (inH < rightH) { if (mOffPeople) - result = mOffPeople; + theDownPeople = mOffPeople; else if (mOnPeople) - result = mOnPeople; + theDownPeople = mOnPeople; } - if (!result) { - minH = maxH; + if (!theDownPeople) { + leftH = rightH; T2PeopleLinkIterator iterator(mFirst); T2People *people; - while (!result && iterator.Next(&people)) { - maxH += people->GetWidth(); - if (inH < maxH && inH >= minH) - result = people; - minH = maxH; + while (!theDownPeople && iterator.Next(&people)) { + rightH += people->GetWidth(); + if (inH < rightH && inH >= leftH) + theDownPeople = people; + leftH = rightH; } } - return result; + return theDownPeople; } void T2Request::CalcValidArea(RECT& rect) { |