mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Added all raknet headers for full raknet support Added Testclass "TestCB.cpp" which is a test implementation for raknet plugin "File List Transfer". We will use this plugin for file transfer in multiplayer git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2638 3b4a5df2-a311-0410-b5c6-a8a6f20db521
55 lines
789 B
C++
55 lines
789 B
C++
/// \file
|
|
/// \brief \b [Internal] Generates and validates checksums
|
|
///
|
|
/// \note I didn't write this, but took it from http://www.flounder.com/checksum.htm
|
|
///
|
|
|
|
#ifndef __CHECKSUM_H
|
|
#define __CHECKSUM_H
|
|
|
|
#include "RakMemoryOverride.h"
|
|
|
|
/// Generates and validates checksums
|
|
class CheckSum
|
|
{
|
|
|
|
public:
|
|
|
|
/// Default constructor
|
|
|
|
CheckSum()
|
|
{
|
|
Clear();
|
|
}
|
|
|
|
void Clear()
|
|
{
|
|
sum = 0;
|
|
r = 55665;
|
|
c1 = 52845;
|
|
c2 = 22719;
|
|
}
|
|
|
|
void Add ( unsigned int w );
|
|
|
|
|
|
void Add ( unsigned short w );
|
|
|
|
void Add ( unsigned char* b, unsigned int length );
|
|
|
|
void Add ( unsigned char b );
|
|
|
|
unsigned int Get ()
|
|
{
|
|
return sum;
|
|
}
|
|
|
|
protected:
|
|
unsigned short r;
|
|
unsigned short c1;
|
|
unsigned short c2;
|
|
unsigned int sum;
|
|
};
|
|
|
|
#endif
|