Files
wowdecomp/Engine/Source/ComSat/ComSatRunningAverageCalculator.cpp
T
SatyandClaude Opus 5.5 c790ecb4a0 Port Streaming/Storage/Transport/HTTP, Mopaq write path and missing-function batches
- Streaming: StreamingManager, Manifests, Storage (.part files, write queue),
  Transport (HTTP split download, throttle), Tracker/StartupReport, streaming
  filestack verbs (s_streamstack, StreamingOpen), RepairCache static
- URL: HttpRequest, InternetCallback, ReadResponseData, DownloadURL
- Mopaq write path: SFileCreateArchive/CreateFile/WriteFile, IOMpqWriteUnit,
  WriteArchiveChanges, RebuildHashTable, listfile acquire/release;
  SComp::Compress with RLE/zlib/bzip2/pkware compressors; MPQEncrypt::Encrypt
- LaunchChildProcessWithArguments, Debug::DefaultCallback/Breakpoint
- Earlier batches: ComSat, Battlenet Tumor, Glue/Ui/WowServices fixes,
  luaL_error returns in Script_ files

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-03 16:51:23 +02:00

58 lines
1.6 KiB
C++

#include "Engine/Source/ComSat/ComSatRunningAverageCalculator.h"
// VERIFY: 08159cc8 auto
// OFFSET: 0x00886600
ComSat::RunningAverageCalculator::RunningAverageCalculator(ComSat::Allocator& allocator) {
this->m_sum = 0.0;
this->m_allocator = &allocator;
this->m_values = nullptr;
this->m_count = 0;
this->m_index = 0;
}
// VERIFY: 94225611 auto
// OFFSET: 0x00886750
ComSat::RunningAverageCalculator::~RunningAverageCalculator() {
if (this->m_values) {
this->m_allocator->Free(this->m_values);
this->m_values = nullptr;
}
this->m_count = 0;
this->m_sum = 0.0;
this->m_index = 0;
}
// VERIFY: fac249da manual
// OFFSET: 0x00886630
void ComSat::RunningAverageCalculator::Init(double value, uint32_t count) {
if (this->m_values) {
this->m_allocator->Free(this->m_values);
this->m_values = nullptr;
}
this->m_sum = 0.0;
this->m_count = 0;
this->m_index = 0;
this->m_values = static_cast<double*>(this->m_allocator->Alloc(sizeof(double) * count));
this->m_count = count;
for (uint32_t i = 0; i < count; i++) {
this->m_values[i] = value;
this->m_sum += value;
}
}
// VERIFY: daa1cb75 auto
// OFFSET: 0x008866F0
void ComSat::RunningAverageCalculator::SubmitData(double value) {
if (this->m_values) {
this->m_sum = this->m_sum - this->m_values[this->m_index] + value;
this->m_values[this->m_index] = value;
this->m_index = (this->m_index + 1) % this->m_count;
}
}
// VERIFY: e888bf5d auto
// OFFSET: 0x00886730
double ComSat::RunningAverageCalculator::GetCurrentAverage() {
return this->m_sum / this->m_count;
}