#include "StdAfx.h" #include "T2RequestArray.h" 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* towerDoc, int) { for (int i = 0; i < 64; i++) { if (mRequests[i].IsUsed()) mRequests[i].Idle(towerDoc); } } 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& archive, T2TowerDoc* towerDoc) { for (int i = 0; i < 64; i++) mRequests[i].Load(archive, towerDoc); } void T2RequestArray::Write(T2Archive& archive) { for (int i = 0; i < 64; i++) mRequests[i].Save(archive); }