Files
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

186 lines
4.5 KiB
C++

//===========================================================================//
// File: NetStatCollector.hpp
// Contents : All movement messages and rewind capabilites
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 03/07/00 JSE Inital coding
//---------------------------------------------------------------------------//
// Copyright (C) 1998, Microsoft Corp. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#pragma once
#include "Adept.hpp"
#include "Network.hpp"
#include "Application.hpp"
namespace Adept
{
class NetStatCollector
{
private:
bool m_dirtyFlag;
MString m_statName;
int m_numberAccumulator[Maximum_Players];
int m_publishedStat[Maximum_Players];
int m_publishedLifetimeStatTotal[Maximum_Players];
int m_publishedStatTotal;
int m_lifeTimeTotal;
Stuff::Time lastPublish;
public:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
NetStatCollector()
{
m_dirtyFlag = true;
lastPublish = gos_GetElapsedTime();
for (int i = 0; i < Maximum_Players; ++i)
{
m_numberAccumulator[i] = 0;
m_publishedStat[i] = 0;
m_publishedLifetimeStatTotal[i] = 0;
}
m_publishedStatTotal = 0;
m_lifeTimeTotal = 0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
bool IsDirty(void)
{
return m_dirtyFlag;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void ClearDirty(void)
{
m_dirtyFlag = false;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void SetName(char *name)
{
m_dirtyFlag = true;
m_statName = name;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
const char *GetName(void)
{
return m_statName;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void AddToStatistic(int index, int number)
{
Verify(index >= 0 && index < Maximum_Players);
m_numberAccumulator[index] += number;
m_lifeTimeTotal += number;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
int GetPublishedStat(int index)
{
Verify(index >= 0 && index < Maximum_Players);
return m_publishedStat[index];
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
int GetPublishedStatLifetimeTotal(int index)
{
Verify(index >= 0 && index < Maximum_Players);
return m_publishedLifetimeStatTotal[index];
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
int GetPublishedStatTotal()
{
return m_publishedStatTotal;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
int GetLifetimeTotal()
{
return m_lifeTimeTotal;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void AddConnection(int connection_index)
{
m_dirtyFlag = true;
m_numberAccumulator[connection_index] = 0;
m_publishedStat[connection_index] = 0;
m_publishedLifetimeStatTotal[connection_index] = 0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void RemoveConnection(int connection_index)
{
m_dirtyFlag = true;
m_numberAccumulator[connection_index] = 0;
m_publishedStat[connection_index] = 0;
m_publishedLifetimeStatTotal[connection_index] = 0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void AdvanceTime(void)
{
if ( (gos_GetElapsedTime() - lastPublish) > 1.0f)
{
m_dirtyFlag = true;
lastPublish = gos_GetElapsedTime();
m_publishedStatTotal = 0;
for (int i = 0; i < Maximum_Players; ++i)
{
m_publishedStat[i] = m_numberAccumulator[i];
m_numberAccumulator[i] = 0;
m_publishedStatTotal += m_publishedStat[i];
m_publishedLifetimeStatTotal[i]+= m_publishedStat[i];
}
}
}
};
}