From c2efba6907fab934a04959b9bb644cf7141cc955 Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Sat, 1 Jul 2023 23:04:04 +0100 Subject: matched T2DLL as well as i can --- src/T2DLL/T2MoverArrayList.cpp | 44 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/T2DLL/T2MoverArrayList.cpp') diff --git a/src/T2DLL/T2MoverArrayList.cpp b/src/T2DLL/T2MoverArrayList.cpp index d36c2de..716419a 100644 --- a/src/T2DLL/T2MoverArrayList.cpp +++ b/src/T2DLL/T2MoverArrayList.cpp @@ -35,37 +35,37 @@ T2Mover* T2MoverArrayList::GetMoverByID(unsigned int inMoverID) { if (inMoverID == 0) return NULL; - int groupID = (inMoverID - 1) / T2MoverArray::kGroupSize; + int groupNum = (inMoverID - 1) / T2MoverArray::kGroupSize; int indexInGroup = (inMoverID - 1) % T2MoverArray::kGroupSize; - if (GetCount() > groupID) - return GetItemAt(groupID + 1)->GetIndexMover(indexInGroup); + if (GetCount() > groupNum) + return GetItemAt(groupNum + 1)->GetIndexMover(indexInGroup); else return NULL; } T2Mover* T2MoverArrayList::FindUnusedMover() { - T2Mover *result = NULL; - LArrayIterator iterator(*this); + T2Mover *theMover = NULL; + LArrayIterator iter(*this); T2MoverArray *theArray = NULL; - while (!result && iterator.Next(&theArray)) - result = theArray->FindUnusedMover(); + while (!theMover && iter.Next(&theArray)) + theMover = theArray->FindUnusedMover(); - if (!result) { - unsigned int startID = 1; + if (!theMover) { + unsigned int lastStartID = 1; if (theArray) - startID = theArray->GetStartID() + T2MoverArray::kGroupSize; + lastStartID = theArray->GetStartID() + T2MoverArray::kGroupSize; - if ((startID + T2MoverArray::kGroupSize) < 1000) { - theArray = new T2MoverArray(startID); + if ((lastStartID + T2MoverArray::kGroupSize) < 1000) { + theArray = new T2MoverArray(lastStartID); if (theArray) { Add(theArray); - result = theArray->FindUnusedMover(); + theMover = theArray->FindUnusedMover(); } } } - return result; + return theMover; } void T2MoverArrayList::DrawMoverAll(T2TowerDoc* inDoc, const RECT& inRect) { @@ -96,10 +96,10 @@ void T2MoverArrayList::Read(T2Archive& inArchive, T2TowerDoc* inDoc) { startID += T2MoverArray::kGroupSize; } - LArrayIterator iterator(*this); + LArrayIterator iter(*this); T2MoverArray *theArray; - while (iterator.Next(&theArray)) + while (iter.Next(&theArray)) theArray->Read(inArchive, inDoc); } @@ -116,10 +116,10 @@ void T2MoverArrayList::Write(T2Archive& inArchive) { int T2MoverArrayList::CalcMentenanceCost(T2TowerDoc* inDoc) const { int cost = 0; - LArrayIterator iterator(*this); + LArrayIterator iter(*this); T2MoverArray *theArray; - while (iterator.Next(&theArray)) + while (iter.Next(&theArray)) cost += theArray->CalcMentenanceCost(inDoc); return cost; @@ -128,12 +128,12 @@ int T2MoverArrayList::CalcMentenanceCost(T2TowerDoc* inDoc) const { LArray* T2MoverArrayList::MakeMoverList(int inType) { LArray *result = new LArray(sizeof(T2Mover *)); - LArrayIterator iterator(*this); - T2MoverArray *theArray; + LArrayIterator iter(*this); + T2MoverArray *theMoverArray; - while (iterator.Next(&theArray)) { + while (iter.Next(&theMoverArray)) { for (int i = 0; i < T2MoverArray::kGroupSize; i++) { - T2Mover *theMover = &theArray->mMover[i]; + T2Mover *theMover = &theMoverArray->mMover[i]; if (theMover->IsUsed() && theMover->GetEquipType() == inType) result->Add(&theMover); } -- cgit v1.2.3