#include "T2Archive.h" #include "T2CrossEquipArray.h" #include "T2FloorCEArray.h" #include "T2MoverCEArray.h" #include "T2RouteCEArray.h" #include "T2TenantCEArray.h" T2CrossEquipArray::T2CrossEquipArray() { } /*virtual*/ T2CrossEquipArray::~T2CrossEquipArray() { } void T2CrossEquipArray::AllClear() { RemoveItemsAt(mItemCount, 1); } void T2CrossEquipArray::ReplaceID(unsigned int oldID, unsigned int newID) { if (FetchIndexOf(&newID) == 0) { int oldIDIndex = FetchIndexOf(&oldID); if (oldIDIndex != 0) AssignItemsAt(1, oldIDIndex, &newID); } else { int oldIDIndex = FetchIndexOf(&oldID); if (oldIDIndex != 0) RemoveItemsAt(1, oldIDIndex); } } void T2CrossEquipArray::Union(T2CrossEquipArray* other) { LArrayIterator iter(*other); unsigned int id; while (iter.Next(&id)) InsertItemsAt(1, mItemCount + 1, &id); } /*virtual*/ void T2CrossEquipArray::InsertItemsAt(int count, int where, unsigned int* id) { if (FetchIndexOf(id) == 0) LArray::InsertItemsAt(count, where, id); } /*virtual*/ void T2CrossEquipArray::Add(unsigned int id) { if (FetchIndexOf(&id) == 0) LArray::Add(&id); } /*static*/ T2CrossEquipArray* T2CrossEquipArray::ReadCEArray(T2Archive& archive) { T2CrossEquipArray *array = NULL; DWORD classID; archive >> classID; switch (classID) { case '_CEA': array = new T2CrossEquipArray; break; case 'TCEA': array = new T2TenantCEArray; break; case 'RCEA': array = new T2RouteCEArray; break; case 'FCEA': array = new T2FloorCEArray; break; case 'MCEA': array = new T2MoverCEArray; break; } if (array) array->ReadAsWord(archive); return array; } /*static*/ void T2CrossEquipArray::WriteCEArray(T2CrossEquipArray* array, T2Archive& archive) { DWORD classID; if (!array) { classID = 'xCEA'; archive << classID; } else { classID = array->GetCEClassID(); archive << classID; array->WriteAsWord(archive); } }