summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2RequestArray.cpp
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-06-28 22:22:32 +0100
committerAsh Wolf <ninji@wuffs.org>2023-06-28 22:22:32 +0100
commitc0c336500955a23e344651e5412c9d9d441ef4ee (patch)
tree790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2RequestArray.cpp
parent37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff)
downloadt2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz
t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r--src/T2DLL/T2RequestArray.cpp33
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);
}