use a real UUID for the stage ID
This commit is contained in:
@@ -396,6 +396,24 @@ RString CryptManager::GetPublicKeyFileName()
|
||||
return PUBLIC_KEY_PATH;
|
||||
}
|
||||
|
||||
/* Generate a version 4 random UUID. */
|
||||
RString CryptManager::GenerateRandomUUID()
|
||||
{
|
||||
uint32_t buf[4];
|
||||
CryptManager::GetRandomBytes( buf, sizeof(buf) );
|
||||
|
||||
buf[1] &= 0xFFFF0FFF;
|
||||
buf[1] |= 0x00004000;
|
||||
buf[2] &= 0x0FFFFFFF;
|
||||
buf[2] |= 0xA0000000;
|
||||
|
||||
return ssprintf("%08x-%04x-%04x-%04x-%04x%08x\n",
|
||||
buf[0],
|
||||
buf[1] >> 16, buf[1] & 0xFFFF,
|
||||
buf[2] >> 16, buf[2] & 0xFFFF,
|
||||
buf[3]);
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2004-2007 Chris Danford, Glenn Maynard
|
||||
* All rights reserved.
|
||||
|
||||
@@ -21,6 +21,7 @@ public:
|
||||
static bool Verify( RageFileBasic &file, RString sSignature, RString sPublicKey );
|
||||
|
||||
static void GetRandomBytes( void *pData, int iBytes );
|
||||
static RString GenerateRandomUUID();
|
||||
|
||||
static RString GetMD5ForFile( RString fn ); // in binary
|
||||
static RString GetMD5ForString( RString sData ); // in binary
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "CharacterManager.h"
|
||||
#include "CommonMetrics.h"
|
||||
#include "Course.h"
|
||||
#include "CryptManager.h"
|
||||
#include "Foreach.h"
|
||||
#include "Game.h"
|
||||
#include "GameCommand.h"
|
||||
@@ -692,6 +693,7 @@ void GameState::BeginStage()
|
||||
if( CurrentOptionsDisqualifyPlayer(pn) )
|
||||
STATSMAN->m_CurStageStats.m_player[pn].m_bDisqualified = true;
|
||||
m_bEarnedExtraStage = false;
|
||||
m_sStageGUID = CryptManager::GenerateRandomUUID();
|
||||
}
|
||||
|
||||
void GameState::CancelStage()
|
||||
|
||||
@@ -86,6 +86,7 @@ public:
|
||||
|
||||
/* This is set to a random number per-game/round; it can be used for a random seed. */
|
||||
int m_iGameSeed, m_iStageSeed;
|
||||
RString m_sStageGUID;
|
||||
|
||||
bool PlayersCanJoin() const; // true if it's not too late for a player to join
|
||||
int GetCoinsNeededToJoin() const;
|
||||
|
||||
@@ -192,8 +192,7 @@ XNode* MakeRecentScoreNode( const StageStats &ss, Trail *pTrail, const PlayerSta
|
||||
|
||||
XNode* pHighScore = pss.m_HighScore.CreateNode();
|
||||
pHighScore->AppendChild("Pad", mp);
|
||||
RString sStageGuid = ssprintf("%08x-0000-1000-0000-53FA337761C6", GAMESTATE->m_iStageSeed);
|
||||
pHighScore->AppendChild("StageGuid", sStageGuid);
|
||||
pHighScore->AppendChild("StageGuid", GAMESTATE->m_sStageGUID);
|
||||
|
||||
pNode->AppendChild( pHighScore );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user