diff options
Diffstat (limited to 'src/T2DLL/T2RequestArray.cpp')
-rw-r--r-- | src/T2DLL/T2RequestArray.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/T2DLL/T2RequestArray.cpp b/src/T2DLL/T2RequestArray.cpp index ddaf603..65c34a3 100644 --- a/src/T2DLL/T2RequestArray.cpp +++ b/src/T2DLL/T2RequestArray.cpp @@ -1,22 +1,45 @@ #include "T2RequestArray.h" -T2RequestArray::T2RequestArray(unsigned int) { +T2RequestArray::T2RequestArray(unsigned int startID) + : T2ObjectArray(startID) +{ + for (unsigned int i = 0; i < 64; i++) + mRequests[i].mRequestID = mStartID + i; } /*virtual*/ T2RequestArray::~T2RequestArray() { } T2Request* T2RequestArray::FindUnusedRequest() { + for (int i = 0; i < 64; i++) { + if (!mRequests[i].IsUsed()) + return &mRequests[i]; + } + + return NULL; } -/*virtual*/ void T2RequestArray::DispatchIdle(T2TowerDoc*, int) { +/*virtual*/ void T2RequestArray::DispatchIdle(T2TowerDoc* towerDoc, int) { + for (int i = 0; i < 64; i++) { + if (mRequests[i].IsUsed()) + mRequests[i].Idle(towerDoc); + } } -void T2RequestArray::BreakoutEmergency(T2TowerDoc*) { +void T2RequestArray::BreakoutEmergency(T2TowerDoc* towerDoc) { + for (unsigned int i = 0; i < 64; i++) { + T2Request *request = &mRequests[i]; + if (request->IsUsed()) + request->BreakoutEmergency(towerDoc); + } } -void T2RequestArray::Read(T2Archive&, T2TowerDoc*) { +void T2RequestArray::Read(T2Archive& archive, T2TowerDoc* towerDoc) { + for (int i = 0; i < 64; i++) + mRequests[i].Load(archive, towerDoc); } -void T2RequestArray::Write(T2Archive&) { +void T2RequestArray::Write(T2Archive& archive) { + for (int i = 0; i < 64; i++) + mRequests[i].Save(archive); } |