Permalink
Browse files

rehosting a game with a name over 31 characters in length is now igno…

…red (previously this would cause a ban from Battle.net)

git-svn-id: http://ghostplusplus.googlecode.com/svn/trunk@492 a7494f72-a4b0-11dd-a887-7ffe1a420f8d
  • Loading branch information...
1 parent 5d1d8f7 commit e03f395186754f039e0ba1ed3758e336d31ba392 xXZyZXx@gmail.com committed May 9, 2010
Showing with 53 additions and 44 deletions.
  1. +53 −44 ghost/game.cpp
View
@@ -1310,35 +1310,40 @@ bool CGame :: EventPlayerBotCommand( CGamePlayer *player, string command, string
if( Command == "priv" && !Payload.empty( ) && !m_CountDownStarted && !m_SaveGame )
{
- CONSOLE_Print( "[GAME: " + m_GameName + "] trying to rehost as private game [" + Payload + "]" );
- SendAllChat( m_GHost->m_Language->TryingToRehostAsPrivateGame( Payload ) );
- m_GameState = GAME_PRIVATE;
- m_LastGameName = m_GameName;
- m_GameName = Payload;
- m_HostCounter = m_GHost->m_HostCounter++;
- m_RefreshError = false;
- m_RefreshRehosted = true;
-
- for( vector<CBNET *> :: iterator i = m_GHost->m_BNETs.begin( ); i != m_GHost->m_BNETs.end( ); i++ )
+ if( Payload.length() < 31 )
{
- // unqueue any existing game refreshes because we're going to assume the next successful game refresh indicates that the rehost worked
- // this ignores the fact that it's possible a game refresh was just sent and no response has been received yet
- // we assume this won't happen very often since the only downside is a potential false positive
+ CONSOLE_Print( "[GAME: " + m_GameName + "] trying to rehost as private game [" + Payload + "]" );
+ SendAllChat( m_GHost->m_Language->TryingToRehostAsPrivateGame( Payload ) );
+ m_GameState = GAME_PRIVATE;
+ m_LastGameName = m_GameName;
+ m_GameName = Payload;
+ m_HostCounter = m_GHost->m_HostCounter++;
+ m_RefreshError = false;
+ m_RefreshRehosted = true;
- (*i)->UnqueueGameRefreshes( );
- (*i)->QueueGameUncreate( );
- (*i)->QueueEnterChat( );
+ for( vector<CBNET *> :: iterator i = m_GHost->m_BNETs.begin( ); i != m_GHost->m_BNETs.end( ); i++ )
+ {
+ // unqueue any existing game refreshes because we're going to assume the next successful game refresh indicates that the rehost worked
+ // this ignores the fact that it's possible a game refresh was just sent and no response has been received yet
+ // we assume this won't happen very often since the only downside is a potential false positive
- // we need to send the game creation message now because private games are not refreshed
+ (*i)->UnqueueGameRefreshes( );
+ (*i)->QueueGameUncreate( );
+ (*i)->QueueEnterChat( );
- (*i)->QueueGameCreate( m_GameState, m_GameName, string( ), m_Map, NULL, m_HostCounter );
+ // we need to send the game creation message now because private games are not refreshed
- if( (*i)->GetPasswordHashType( ) != "pvpgn" )
- (*i)->QueueEnterChat( );
- }
+ (*i)->QueueGameCreate( m_GameState, m_GameName, string( ), m_Map, NULL, m_HostCounter );
+
+ if( (*i)->GetPasswordHashType( ) != "pvpgn" )
+ (*i)->QueueEnterChat( );
+ }
- m_CreationTime = GetTime( );
- m_LastRefreshTime = GetTime( );
+ m_CreationTime = GetTime( );
+ m_LastRefreshTime = GetTime( );
+ }
+ else
+ SendAllChat( m_GHost->m_Language->UnableToCreateGameNameTooLong( Payload ) );
}
//
@@ -1347,32 +1352,36 @@ bool CGame :: EventPlayerBotCommand( CGamePlayer *player, string command, string
if( Command == "pub" && !Payload.empty( ) && !m_CountDownStarted && !m_SaveGame )
{
- CONSOLE_Print( "[GAME: " + m_GameName + "] trying to rehost as public game [" + Payload + "]" );
- SendAllChat( m_GHost->m_Language->TryingToRehostAsPublicGame( Payload ) );
- m_GameState = GAME_PUBLIC;
- m_LastGameName = m_GameName;
- m_GameName = Payload;
- m_HostCounter = m_GHost->m_HostCounter++;
- m_RefreshError = false;
- m_RefreshRehosted = true;
-
- for( vector<CBNET *> :: iterator i = m_GHost->m_BNETs.begin( ); i != m_GHost->m_BNETs.end( ); i++ )
+ if( Payload.length() < 31 )
{
- // unqueue any existing game refreshes because we're going to assume the next successful game refresh indicates that the rehost worked
- // this ignores the fact that it's possible a game refresh was just sent and no response has been received yet
- // we assume this won't happen very often since the only downside is a potential false positive
+ CONSOLE_Print( "[GAME: " + m_GameName + "] trying to rehost as public game [" + Payload + "]" );
+ SendAllChat( m_GHost->m_Language->TryingToRehostAsPublicGame( Payload ) );
+ m_GameState = GAME_PUBLIC;
+ m_LastGameName = m_GameName;
+ m_GameName = Payload;
+ m_HostCounter = m_GHost->m_HostCounter++;
+ m_RefreshError = false;
+ m_RefreshRehosted = true;
- (*i)->UnqueueGameRefreshes( );
- (*i)->QueueGameUncreate( );
- (*i)->QueueEnterChat( );
+ for( vector<CBNET *> :: iterator i = m_GHost->m_BNETs.begin( ); i != m_GHost->m_BNETs.end( ); i++ )
+ {
+ // unqueue any existing game refreshes because we're going to assume the next successful game refresh indicates that the rehost worked
+ // this ignores the fact that it's possible a game refresh was just sent and no response has been received yet
+ // we assume this won't happen very often since the only downside is a potential false positive
- // the game creation message will be sent on the next refresh
- }
+ (*i)->UnqueueGameRefreshes( );
+ (*i)->QueueGameUncreate( );
+ (*i)->QueueEnterChat( );
- m_CreationTime = GetTime( );
- m_LastRefreshTime = GetTime( );
- }
+ // the game creation message will be sent on the next refresh
+ }
+ m_CreationTime = GetTime( );
+ m_LastRefreshTime = GetTime( );
+ }
+ else
+ SendAllChat( m_GHost->m_Language->UnableToCreateGameNameTooLong( Payload ) );
+ }
//
// !REFRESH (turn on or off refresh messages)
//

0 comments on commit e03f395

Please sign in to comment.