summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2EquipPtrList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/T2DLL/T2EquipPtrList.cpp')
-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);
+ }
}