diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-07-01 23:04:04 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-07-01 23:04:04 +0100 |
commit | c2efba6907fab934a04959b9bb644cf7141cc955 (patch) | |
tree | c047244f99870e44a7a5d7e733c2857434c03765 /src/T2DLL/T2MoverArrayList.cpp | |
parent | 1eb8da84d77d0c865623421069ec38bfc7b0d461 (diff) | |
download | t2win-c2efba6907fab934a04959b9bb644cf7141cc955.tar.gz t2win-c2efba6907fab934a04959b9bb644cf7141cc955.zip |
matched T2DLL as well as i can
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2MoverArrayList.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
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); } |