From 1eb8da84d77d0c865623421069ec38bfc7b0d461 Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Sat, 1 Jul 2023 03:41:47 +0100 Subject: game actually works now --- src/T2DLL/T2DateTime.h | 6 +++--- src/T2DLL/T2EquipPtrList.cpp | 10 +++++----- src/T2DLL/T2FloorPtrList.cpp | 16 ++++++++-------- src/T2DLL/T2Mover.cpp | 28 ++++++++++++++-------------- src/T2DLL/T2Settlement.cpp | 2 +- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/T2DLL/T2DateTime.h b/src/T2DLL/T2DateTime.h index 7104fe9..aae18d4 100644 --- a/src/T2DLL/T2DateTime.h +++ b/src/T2DLL/T2DateTime.h @@ -59,13 +59,13 @@ public: protected: int AdjustMinutes(int m) const; - friend BOOL operator>=(const T2DateTime &a, const T2DateTime &b); + friend BOOL operator<=(const T2DateTime &a, const T2DateTime &b); unsigned int CalcTotalCount() const { return mSeconds + ((mYear * 12 + mMonth) * 1440 + mRawMinutes) * 4; } }; -inline BOOL operator>=(const T2DateTime &a, const T2DateTime &b) { - return a.CalcTotalCount() >= b.CalcTotalCount(); +inline BOOL operator<=(const T2DateTime &a, const T2DateTime &b) { + return a.CalcTotalCount() <= b.CalcTotalCount(); } diff --git a/src/T2DLL/T2EquipPtrList.cpp b/src/T2DLL/T2EquipPtrList.cpp index 913bb51..a8b57c2 100644 --- a/src/T2DLL/T2EquipPtrList.cpp +++ b/src/T2DLL/T2EquipPtrList.cpp @@ -33,15 +33,15 @@ int T2EquipPtrList::GetIndex(T2Equip* equip) { int T2EquipPtrList::GetIndex(unsigned int equipID) { int result = 0; LArrayIterator iterator(*this); - BOOL found = false; + BOOL done = false; int i = 1; - T2Equip *equip; + T2Equip *theEquip; - while (!found && iterator.Next(&equip)) { - if (equip->GetEquipID() == equipID) { + while (!done && iterator.Next(&theEquip)) { + if (theEquip->GetEquipID() == equipID) { result = i; - found = true; + done = true; } else { i++; } diff --git a/src/T2DLL/T2FloorPtrList.cpp b/src/T2DLL/T2FloorPtrList.cpp index f716e76..fec528d 100644 --- a/src/T2DLL/T2FloorPtrList.cpp +++ b/src/T2DLL/T2FloorPtrList.cpp @@ -20,19 +20,19 @@ T2FloorPtrList::T2FloorPtrList(T2TenantArrayList* inList) { } int T2FloorPtrList::CalcDistance(int inIndexA, int inIndexB) { - int distance = -1; + int theDistance = -1; T2Tenant *theFloorA = (T2Tenant *) GetItem(inIndexA); T2Tenant *theFloorB = (T2Tenant *) GetItem(inIndexB); if (theFloorA && theFloorB) { - RECT rectA, rectB; - theFloorA->GetEquipArea(rectA); - theFloorB->GetEquipArea(rectB); + RECT theRectA, theRectB; + theFloorA->GetEquipArea(theRectA); + theFloorB->GetEquipArea(theRectB); - distance = (rectA.bottom - 1) - (rectB.bottom - 1); - if (distance < 0) - distance *= -1; + theDistance = (theRectA.bottom - 1) - (theRectB.bottom - 1); + if (theDistance < 0) + theDistance *= -1; } - return distance; + return theDistance; } diff --git a/src/T2DLL/T2Mover.cpp b/src/T2DLL/T2Mover.cpp index df3d264..f62f502 100644 --- a/src/T2DLL/T2Mover.cpp +++ b/src/T2DLL/T2Mover.cpp @@ -168,9 +168,9 @@ void T2Mover::GetTypicalName(CString& outStr) const { GetEquipArea(rect); T2FloorInfo *theFloorInfo = towerDoc->mFloorInfo; - for (int i = 0; i < mLength; i++) { - if (IsStopPosition(i)) - RemoveStopBoth(towerDoc, i); + for (int p = 0; p < mLength; p++) { + if (IsStopPosition(p)) + RemoveStopBoth(towerDoc, p); } theFloorInfo->FillMoverID(rect, 0); @@ -196,9 +196,9 @@ void T2Mover::GetTypicalName(CString& outStr) const { T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); mModuleList->Destruct(towerDoc); - for (int i = 0; i < mLength; i++) { - if (IsStopPosition(i)) - RemoveStopBoth(towerDoc, i); + for (int p = 0; p < mLength; p++) { + if (IsStopPosition(p)) + RemoveStopBoth(towerDoc, p); } theFloorInfo->FillMoverID(rect, 00); @@ -206,11 +206,11 @@ void T2Mover::GetTypicalName(CString& outStr) const { SetUsed(false); - BOOL result = true; + BOOL done = true; towerDoc->towerDoc_vf124()->MoverRemoved(this, 1); - return result; + return done; } /*virtual*/ void T2Mover::Draw(T2TowerDoc* towerDoc, const RECT& rect) { @@ -221,8 +221,8 @@ void T2Mover::GetTypicalName(CString& outStr) const { int T2Mover::GetNumStop() const { int count = 0; - for (int i = 0; i < mLength; i++) { - if (IsStopPosition(i)) + for (int p = 0; p < mLength; p++) { + if (IsStopPosition(p)) count++; } @@ -243,14 +243,14 @@ void T2Mover::AddStopBoth(T2TowerDoc* towerDoc, int position) { BOOL T2Mover::AddStop(T2FloorInfo* floorInfo, int position, ERequestUpDown upDown) { BOOL result = false; - POINT stopPt = PositionToStopPt(position, upDown); - T2Tenant *theFloor = floorInfo->GetFloor(stopPt.y, stopPt.x); + POINT theNewStopPt = PositionToStopPt(position, upDown); + T2Tenant *theFloor = floorInfo->GetFloor(theNewStopPt.y, theNewStopPt.x); if (theFloor) { CRect rect; - GetEquipArea(rect); + theFloor->GetEquipArea(rect); - if (rect.Height() == 1 || stopPt.y == (rect.bottom - 1)) { + if (rect.Height() == 1 || theNewStopPt.y == (rect.bottom - 1)) { if (!IsStopPosition(position)) AddCrossEquipID(floorInfo, position); diff --git a/src/T2DLL/T2Settlement.cpp b/src/T2DLL/T2Settlement.cpp index 44de3d1..f67216e 100644 --- a/src/T2DLL/T2Settlement.cpp +++ b/src/T2DLL/T2Settlement.cpp @@ -142,7 +142,7 @@ void T2Settlement::EmitPayToolMessage(T2TowerDoc* towerDoc, T2ToolDef* inToolDef if (length && type) { T2DateTime *theTimeLimit = GetTimeLimitOfMessage(towerDoc, inToolDef, type); - if (theTimeLimit && *theNow >= *theTimeLimit) + if (theTimeLimit && *theNow <= *theTimeLimit) canPay = false; } -- cgit v1.2.3