summaryrefslogtreecommitdiff
path: root/game/shared/econ/econ_game_account_server.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/shared/econ/econ_game_account_server.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/shared/econ/econ_game_account_server.cpp')
-rw-r--r--game/shared/econ/econ_game_account_server.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/game/shared/econ/econ_game_account_server.cpp b/game/shared/econ/econ_game_account_server.cpp
new file mode 100644
index 0000000..4ce65ba
--- /dev/null
+++ b/game/shared/econ/econ_game_account_server.cpp
@@ -0,0 +1,40 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Code for the CEconGameAccount object
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#include "cbase.h"
+
+#include "econ_game_account_server.h"
+
+using namespace GCSDK;
+
+#ifdef GC_DLL
+//---------------------------------------------------------------------------------
+// Purpose:
+//---------------------------------------------------------------------------------
+IMPLEMENT_CLASS_MEMPOOL( CEconGameServerAccount, 100, UTLMEMORYPOOL_GROW_SLOW );
+
+void GameServerAccount_GenerateIdentityToken( char* pIdentityToken, uint32 unMaxChars )
+{
+ static const char s_ValidChars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890./+!$%^-_+?<>()&~:";
+ const int nLastValidIndex = ARRAYSIZE(s_ValidChars) - 2; // last = size - 1, minus another one for null terminator
+
+ // create a randomized token
+ for ( uint32 i = 0; i < unMaxChars - 1; ++i )
+ {
+ pIdentityToken[i] = s_ValidChars[ RandomInt( 0, nLastValidIndex ) ];
+ }
+ pIdentityToken[unMaxChars - 1] = 0;
+}
+
+//---------------------------------------------------------------------------------
+// Purpose: Selective account-level data for game servers
+//---------------------------------------------------------------------------------
+IMPLEMENT_CLASS_MEMPOOL( CEconGameAccountForGameServers, 10 * 1000, UTLMEMORYPOOL_GROW_SLOW );
+#endif
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"