Skip to content

Commit

Permalink
Move MaxSlots from Map to GHost class.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruk33 committed Oct 13, 2022
1 parent a565cec commit ef539bc
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 65 deletions.
10 changes: 5 additions & 5 deletions ghost/bnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,7 @@ void CBNET :: BotCommand( string Message, string User, bool Whisper, bool ForceR
if( UTIL_FileExists( File ) )
{
QueueChatCommand( m_GHost->m_Language->LoadingReplay( File ), User, Whisper );
CReplay *Replay = new CReplay( m_GHost->m_Map->m_MaxSlots );
CReplay *Replay = new CReplay( m_GHost->m_MaxSlots );
Replay->Load( File, false );
Replay->ParseReplay( false );
m_GHost->m_EnforcePlayers = Replay->GetPlayers( );
Expand Down Expand Up @@ -2267,9 +2267,9 @@ void CBNET :: QueueGameRefresh( unsigned char state, string gameName, string hos
boost::mutex::scoped_lock packetsLock( m_PacketsMutex );

if( m_GHost->m_Reconnect )
m_OutPackets.push( m_Protocol->SEND_SID_STARTADVEX3( state, UTIL_CreateByteArray( MapGameType, false ), map->GetMapGameFlags( ), MapWidth, MapHeight, gameName, hostName, upTime, "Save\\Multiplayer\\" + saveGame->GetFileNameNoPath( ), saveGame->GetMagicNumber( ), map->GetMapSHA1( ), m_GHost->m_Map->m_MaxSlots, FixedHostCounter ) );
m_OutPackets.push( m_Protocol->SEND_SID_STARTADVEX3( state, UTIL_CreateByteArray( MapGameType, false ), map->GetMapGameFlags( ), MapWidth, MapHeight, gameName, hostName, upTime, "Save\\Multiplayer\\" + saveGame->GetFileNameNoPath( ), saveGame->GetMagicNumber( ), map->GetMapSHA1( ), m_GHost->m_MaxSlots, FixedHostCounter ) );
else
m_OutPackets.push( m_Protocol->SEND_SID_STARTADVEX3( state, UTIL_CreateByteArray( MapGameType, false ), map->GetMapGameFlags( ), UTIL_CreateByteArray( (uint16_t)0, false ), UTIL_CreateByteArray( (uint16_t)0, false ), gameName, hostName, upTime, "Save\\Multiplayer\\" + saveGame->GetFileNameNoPath( ), saveGame->GetMagicNumber( ), map->GetMapSHA1( ), m_GHost->m_Map->m_MaxSlots, FixedHostCounter ) );
m_OutPackets.push( m_Protocol->SEND_SID_STARTADVEX3( state, UTIL_CreateByteArray( MapGameType, false ), map->GetMapGameFlags( ), UTIL_CreateByteArray( (uint16_t)0, false ), UTIL_CreateByteArray( (uint16_t)0, false ), gameName, hostName, upTime, "Save\\Multiplayer\\" + saveGame->GetFileNameNoPath( ), saveGame->GetMagicNumber( ), map->GetMapSHA1( ), m_GHost->m_MaxSlots, FixedHostCounter ) );

packetsLock.unlock( );
}
Expand All @@ -2295,9 +2295,9 @@ void CBNET :: QueueGameRefresh( unsigned char state, string gameName, string hos
boost::mutex::scoped_lock packetsLock( m_PacketsMutex );

if( m_GHost->m_Reconnect )
m_OutPackets.push( m_Protocol->SEND_SID_STARTADVEX3( state, UTIL_CreateByteArray( MapGameType, false ), map->GetMapGameFlags( ), MapWidth, MapHeight, gameName, hostName, upTime, map->GetMapPath( ), map->GetMapCRC( ), map->GetMapSHA1( ), m_GHost->m_Map->m_MaxSlots, FixedHostCounter ) );
m_OutPackets.push( m_Protocol->SEND_SID_STARTADVEX3( state, UTIL_CreateByteArray( MapGameType, false ), map->GetMapGameFlags( ), MapWidth, MapHeight, gameName, hostName, upTime, map->GetMapPath( ), map->GetMapCRC( ), map->GetMapSHA1( ), m_GHost->m_MaxSlots, FixedHostCounter ) );
else
m_OutPackets.push( m_Protocol->SEND_SID_STARTADVEX3( state, UTIL_CreateByteArray( MapGameType, false ), map->GetMapGameFlags( ), map->GetMapWidth( ), map->GetMapHeight( ), gameName, hostName, upTime, map->GetMapPath( ), map->GetMapCRC( ), map->GetMapSHA1( ), m_GHost->m_Map->m_MaxSlots, FixedHostCounter ) );
m_OutPackets.push( m_Protocol->SEND_SID_STARTADVEX3( state, UTIL_CreateByteArray( MapGameType, false ), map->GetMapGameFlags( ), map->GetMapWidth( ), map->GetMapHeight( ), gameName, hostName, upTime, map->GetMapPath( ), map->GetMapCRC( ), map->GetMapSHA1( ), m_GHost->m_MaxSlots, FixedHostCounter ) );

packetsLock.unlock( );
}
Expand Down
8 changes: 4 additions & 4 deletions ghost/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ bool CGame :: EventPlayerBotCommand( CGamePlayer *player, string command, string
{
unsigned char SID = (unsigned char)( Slot - 1 );

if( !( m_Map->GetMapOptions( ) & MAPOPT_FIXEDPLAYERSETTINGS ) && Colour < ((uint32_t) m_GHost->m_Map->m_MaxSlots) && SID < m_Slots.size( ) )
if( !( m_Map->GetMapOptions( ) & MAPOPT_FIXEDPLAYERSETTINGS ) && Colour < ((uint32_t) m_GHost->m_MaxSlots) && SID < m_Slots.size( ) )
{
if( m_Slots[SID].GetSlotStatus( ) == SLOTSTATUS_OCCUPIED && m_Slots[SID].GetComputer( ) == 1 )
ColourSlot( SID, Colour );
Expand Down Expand Up @@ -879,7 +879,7 @@ bool CGame :: EventPlayerBotCommand( CGamePlayer *player, string command, string
{
unsigned char SID = (unsigned char)( Slot - 1 );

if( !( m_Map->GetMapOptions( ) & MAPOPT_FIXEDPLAYERSETTINGS ) && Team < ((uint32_t) m_GHost->m_Map->m_MaxSlots) && SID < m_Slots.size( ) )
if( !( m_Map->GetMapOptions( ) & MAPOPT_FIXEDPLAYERSETTINGS ) && Team < ((uint32_t) m_GHost->m_MaxSlots) && SID < m_Slots.size( ) )
{
if( m_Slots[SID].GetSlotStatus( ) == SLOTSTATUS_OCCUPIED && m_Slots[SID].GetComputer( ) == 1 )
{
Expand Down Expand Up @@ -1466,15 +1466,15 @@ bool CGame :: EventPlayerBotCommand( CGamePlayer *player, string command, string
BYTEARRAY MapHeight;
MapHeight.push_back( 0 );
MapHeight.push_back( 0 );
m_GHost->m_UDPSocket->SendTo( IP, Port, m_Protocol->SEND_W3GS_GAMEINFO( m_GHost->m_TFT, m_GHost->m_LANWar3Version, UTIL_CreateByteArray( MapGameType, false ), m_Map->GetMapGameFlags( ), MapWidth, MapHeight, m_GameName, "Varlock", GetTime( ) - m_CreationTime, "Save\\Multiplayer\\" + m_SaveGame->GetFileNameNoPath( ), m_SaveGame->GetMagicNumber( ), m_GHost->m_Map->m_MaxSlots, m_GHost->m_Map->m_MaxSlots, m_HostPort, FixedHostCounter, m_EntryKey ) );
m_GHost->m_UDPSocket->SendTo( IP, Port, m_Protocol->SEND_W3GS_GAMEINFO( m_GHost->m_TFT, m_GHost->m_LANWar3Version, UTIL_CreateByteArray( MapGameType, false ), m_Map->GetMapGameFlags( ), MapWidth, MapHeight, m_GameName, "Varlock", GetTime( ) - m_CreationTime, "Save\\Multiplayer\\" + m_SaveGame->GetFileNameNoPath( ), m_SaveGame->GetMagicNumber( ), m_GHost->m_MaxSlots, m_GHost->m_MaxSlots, m_HostPort, FixedHostCounter, m_EntryKey ) );
}
else
{
// note: the PrivateGame flag is not set when broadcasting to LAN (as you might expect)
// note: we do not use m_Map->GetMapGameType because none of the filters are set when broadcasting to LAN (also as you might expect)

uint32_t MapGameType = MAPGAMETYPE_UNKNOWN0;
m_GHost->m_UDPSocket->SendTo( IP, Port, m_Protocol->SEND_W3GS_GAMEINFO( m_GHost->m_TFT, m_GHost->m_LANWar3Version, UTIL_CreateByteArray( MapGameType, false ), m_Map->GetMapGameFlags( ), m_Map->GetMapWidth( ), m_Map->GetMapHeight( ), m_GameName, "Varlock", GetTime( ) - m_CreationTime, m_Map->GetMapPath( ), m_Map->GetMapCRC( ), m_GHost->m_Map->m_MaxSlots, m_GHost->m_Map->m_MaxSlots, m_HostPort, FixedHostCounter, m_EntryKey ) );
m_GHost->m_UDPSocket->SendTo( IP, Port, m_Protocol->SEND_W3GS_GAMEINFO( m_GHost->m_TFT, m_GHost->m_LANWar3Version, UTIL_CreateByteArray( MapGameType, false ), m_Map->GetMapGameFlags( ), m_Map->GetMapWidth( ), m_Map->GetMapHeight( ), m_GameName, "Varlock", GetTime( ) - m_CreationTime, m_Map->GetMapPath( ), m_Map->GetMapCRC( ), m_GHost->m_MaxSlots, m_GHost->m_MaxSlots, m_HostPort, FixedHostCounter, m_EntryKey ) );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ghost/game_admin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ bool CAdminGame :: EventPlayerBotCommand( CGamePlayer *player, string command, s
if( UTIL_FileExists( File ) )
{
SendChat( player, m_GHost->m_Language->LoadingReplay( File ) );
CReplay *Replay = new CReplay( m_GHost->m_Map->m_MaxSlots );
CReplay *Replay = new CReplay( m_GHost->m_MaxSlots );
Replay->Load( File, false );
Replay->ParseReplay( false );
m_GHost->m_EnforcePlayers = Replay->GetPlayers( );
Expand Down
Loading

0 comments on commit ef539bc

Please sign in to comment.