Skip to content

Commit

Permalink
Remove some unused/duplicated methods in hsTArray
Browse files Browse the repository at this point in the history
  • Loading branch information
zrax committed Jan 20, 2021
1 parent f8b4b4c commit 7e9bb1c
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 44 deletions.
39 changes: 0 additions & 39 deletions Sources/Plasma/CoreLib/hsTemplates.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@ template <class T> class hsTArray : public hsTArrayBase
const T& Get(int index) const { hsTArray_ValidateIndex(index); return fArray[index]; }
T& operator[](int index) const { hsTArray_ValidateIndex(index); return fArray[index]; }

T* FirstIter() { return &fArray[0]; }
T* StopIter() { return &fArray[fUseCount]; }

int Count() const { return fUseCount; }
int GetCount() const { return fUseCount; }
inline void SetCount(int count);
Expand Down Expand Up @@ -177,8 +174,6 @@ template <class T> class hsTArray : public hsTArrayBase
hsTArray_CopyForward(item, &fArray[index], count);
}
}
// This guy is a duplicate for compatibility with the older hsDynamicArray<>
void InsertAtIndex(int index, const T& item) { this->Insert(index, item); }

void Remove(int index)
{
Expand Down Expand Up @@ -216,17 +211,7 @@ template <class T> class hsTArray : public hsTArrayBase
kMissingIndex = -1
};
int Find(const T& item) const; // returns kMissingIndex if not found
inline T* ForEach(int32_t (*proc)(T&));
inline T* ForEach(int32_t (*proc)(T&, void* p1), void* p1);
inline T* ForEach(int32_t (*proc)(T&, void* p1, void* p2), void* p1, void* p2);

T* DetachArray()
{
T* array = fArray;
fUseCount = fTotalCount = 0;
fArray = nil;
return array;
}
T* AcquireArray() { return fArray; }
};

Expand Down Expand Up @@ -447,29 +432,5 @@ template <class T> void hsTArray<T>::DecCount(int index, int count)
}
}

template <class T> T* hsTArray<T>::ForEach(int32_t (*proc)(T&))
{
for (int i = 0; i < fUseCount; i++)
if (proc(fArray[i]))
return &fArray[i];
return nil;
}

template <class T> T* hsTArray<T>::ForEach(int32_t (*proc)(T&, void* p1), void* p1)
{
for (int i = 0; i < fUseCount; i++)
if (proc(fArray[i], p1))
return &fArray[i];
return nil;
}

template <class T> T* hsTArray<T>::ForEach(int32_t (*proc)(T&, void* p1, void* p2), void* p1, void* p2)
{
for (int i = 0; i < fUseCount; i++)
if (proc(fArray[i], p1, p2))
return &fArray[i];
return nil;
}

#endif

1 change: 0 additions & 1 deletion Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ class plSynchedTArray : public plSynchedValueBase
void Push(const T& item) { DirtyIfNecessary(); return fValueList.Push(item); }
T Pop() { DirtyIfNecessary(); return fValueList.Pop(); }
const T& Peek() const { return fValue.Peek(); }
T* DetachArray() { DirtyIfNecessary(); return fValueList.DetachArray(); }
T* AcquireArray() { DirtyIfNecessary(); return fValueList.AcquireArray(); }
};

Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1874,7 +1874,7 @@ void plClothingMgr::IAddItem(plClothingItem *item)
if (fItems[i]->fSortOrder >= item->fSortOrder)
break;
}
fItems.InsertAtIndex(i, item);
fItems.Insert(i, item);
}
else
hsAssert(false, "Couldn't match all elements of added clothing item.");
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/PubUtilLib/plGImage/hsCodecManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ bool hsCodecManager::Register(hsCodec *codec, uint32_t compressionFormat, float
++j;

hsCodecEntry tempCodecEntry(priority, codec);
fCodecTable[i].fCodecList.InsertAtIndex(j, tempCodecEntry);
fCodecTable[i].fCodecList.Insert(j, tempCodecEntry);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/PubUtilLib/plInterp/plController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ void plLeafController::GetKeyTimes(hsTArray<float> &keyTimes) const
float cTime = ((hsKeyFrame*)(keyPtr + cIdx * stride))->fFrame / MAX_FRAMES_PER_SEC;
if (cTime < kTime)
{
keyTimes.InsertAtIndex(kIdx, cTime);
keyTimes.Insert(kIdx, cTime);
cIdx++;
kIdx++;
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void hsGMaterial::InsertLayer(plLayerInterface* layer, int32_t which, bool piggy
{
hsTArray<plLayerInterface*>& layers = piggyBack ? fPiggyBacks : fLayers;
hsAssert(which <= layers.GetCount(), "Material layers Exceeding test depth");
layers.InsertAtIndex(which, layer);
layers.Insert(which, layer);
}

void hsGMaterial::SetLayer(plLayerInterface* layer, int32_t which, bool insert, bool piggyBack)
Expand Down

0 comments on commit 7e9bb1c

Please sign in to comment.