blob: 50fdb529987ad6f60f13547afe5dd9d6b2afff0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#include "StdAfx.h"
#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);
}
}
|