Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Code for the CEconGameAccount object
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "econ_game_account_server.h"
  9. using namespace GCSDK;
  10. #ifdef GC_DLL
  11. //---------------------------------------------------------------------------------
  12. // Purpose:
  13. //---------------------------------------------------------------------------------
  14. IMPLEMENT_CLASS_MEMPOOL( CEconGameServerAccount, 100, UTLMEMORYPOOL_GROW_SLOW );
  15. void GameServerAccount_GenerateIdentityToken( char* pIdentityToken, uint32 unMaxChars )
  16. {
  17. static const char s_ValidChars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890./+!$%^-_+?<>()&~:";
  18. const int nLastValidIndex = ARRAYSIZE(s_ValidChars) - 2; // last = size - 1, minus another one for null terminator
  19. // create a randomized token
  20. for ( uint32 i = 0; i < unMaxChars - 1; ++i )
  21. {
  22. pIdentityToken[i] = s_ValidChars[ RandomInt( 0, nLastValidIndex ) ];
  23. }
  24. pIdentityToken[unMaxChars - 1] = 0;
  25. }
  26. //---------------------------------------------------------------------------------
  27. // Purpose: Selective account-level data for game servers
  28. //---------------------------------------------------------------------------------
  29. IMPLEMENT_CLASS_MEMPOOL( CEconGameAccountForGameServers, 10 * 1000, UTLMEMORYPOOL_GROW_SLOW );
  30. #endif
  31. // memdbgon must be the last include file in a .cpp file!!!
  32. #include "tier0/memdbgon.h"