summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2EquipPtrList.cpp
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-06-28 22:22:32 +0100
committerAsh Wolf <ninji@wuffs.org>2023-06-28 22:22:32 +0100
commitc0c336500955a23e344651e5412c9d9d441ef4ee (patch)
tree790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2EquipPtrList.cpp
parent37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff)
downloadt2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz
t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r--src/T2DLL/T2EquipPtrList.cpp55
1 files changed, 47 insertions, 8 deletions
diff --git a/src/T2DLL/T2EquipPtrList.cpp b/src/T2DLL/T2EquipPtrList.cpp
index 472790a..913bb51 100644
--- a/src/T2DLL/T2EquipPtrList.cpp
+++ b/src/T2DLL/T2EquipPtrList.cpp
@@ -1,28 +1,67 @@
+#include "T2Equip.h"
#include "T2EquipPtrList.h"
+#include "T2Tenant.h"
-T2EquipPtrList::T2EquipPtrList(unsigned int) {
+T2EquipPtrList::T2EquipPtrList(unsigned int attribute)
+ : LArray(sizeof(T2Equip *))
+{
+ mAttribute = attribute;
}
/*virtual*/ T2EquipPtrList::~T2EquipPtrList() {
}
-void T2EquipPtrList::AddItem(T2Equip*) {
+void T2EquipPtrList::AddItem(T2Equip* equip) {
+ InsertItemsAt(1, mItemCount + 1, &equip);
}
-void T2EquipPtrList::RemoveItem(T2Equip*) {
+void T2EquipPtrList::RemoveItem(T2Equip* equip) {
+ Remove(&equip);
}
-void T2EquipPtrList::RemoveItem(int) {
+void T2EquipPtrList::RemoveItem(int index) {
+ RemoveItemsAt(1, index);
}
-int T2EquipPtrList::GetIndex(T2Equip*) {
+int T2EquipPtrList::GetIndex(T2Equip* equip) {
+ int index = 0;
+ if (equip)
+ index = FetchIndexOf(&equip);
+ return index;
}
-int T2EquipPtrList::GetIndex(unsigned int) {
+int T2EquipPtrList::GetIndex(unsigned int equipID) {
+ int result = 0;
+ LArrayIterator iterator(*this);
+ BOOL found = false;
+ int i = 1;
+
+ T2Equip *equip;
+
+ while (!found && iterator.Next(&equip)) {
+ if (equip->GetEquipID() == equipID) {
+ result = i;
+ found = true;
+ } else {
+ i++;
+ }
+ }
+
+ return result;
}
-T2Equip* T2EquipPtrList::GetItem(int) {
+T2Equip* T2EquipPtrList::GetItem(int index) {
+ T2Equip *equip = NULL;
+ FetchItemAt(index, &equip);
+ return equip;
}
-void T2EquipPtrList::SetRelatedTenantID(unsigned int) {
+void T2EquipPtrList::SetRelatedTenantID(unsigned int id) {
+ LArrayIterator iterator(*this);
+ T2Tenant *tenant;
+
+ while (iterator.Next(&tenant)) {
+ if (!tenant->IsSetRelatedTenantID())
+ tenant->SetRelatedTenantID(id);
+ }
}