From c0c336500955a23e344651e5412c9d9d441ef4ee Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Wed, 28 Jun 2023 22:22:32 +0100 Subject: first pass of T2DLL --- src/T2DLL/T2RequestArray.cpp | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'src/T2DLL/T2RequestArray.cpp') 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); } -- cgit v1.2.3