Update -- we forgot we can have multiple people logged on from one connection.

This commit is contained in:
Charles Lohr
2005-01-12 05:40:23 +00:00
parent c7679f7304
commit f997d3cdf8
3 changed files with 14 additions and 8 deletions
+11 -5
View File
@@ -69,7 +69,8 @@ NetworkSyncManager::NetworkSyncManager( LoadingWindow *ld )
useSMserver = false; useSMserver = false;
isSMOnline = false; isSMOnline = false;
isSMOLoggedIn = false; FOREACH_PlayerNumber(pn)
isSMOLoggedIn[pn] = false;
m_startupStatus = 0; //By default, connection not tried. m_startupStatus = 0; //By default, connection not tried.
@@ -98,7 +99,8 @@ void NetworkSyncManager::CloseConnection()
return ; return ;
m_ServerVersion = 0; m_ServerVersion = 0;
useSMserver = false; useSMserver = false;
isSMOLoggedIn = false; FOREACH_PlayerNumber(pn)
isSMOLoggedIn[pn] = false;
m_startupStatus = 0; m_startupStatus = 0;
NetPlayerClient->close(); NetPlayerClient->close();
} }
@@ -126,7 +128,8 @@ void NetworkSyncManager::PostStartUp(const CString& ServerIP)
} }
} }
isSMOLoggedIn = false; FOREACH_PlayerNumber(pn)
isSMOLoggedIn[pn] = false;
useSMserver = true; useSMserver = true;
@@ -510,7 +513,9 @@ void NetworkSyncManager::ProcessInput()
SCREENMAN->SystemMessageNoAnimate("Connection to server dropped."); SCREENMAN->SystemMessageNoAnimate("Connection to server dropped.");
useSMserver=false; useSMserver=false;
isSMOnline = false; isSMOnline = false;
isSMOLoggedIn = false; FOREACH_PlayerNumber(pn)
isSMOLoggedIn[pn] = false;
NetPlayerClient->close();
return; return;
} }
@@ -815,7 +820,8 @@ void PacketFunctions::ClearPacket()
LuaFunction_NoArgs( IsNetConnected, NSMAN->useSMserver ) LuaFunction_NoArgs( IsNetConnected, NSMAN->useSMserver )
LuaFunction_NoArgs( IsNetSMOnline, NSMAN->isSMOnline ) LuaFunction_NoArgs( IsNetSMOnline, NSMAN->isSMOnline )
LuaFunction_NoArgs( IsSMOnlineLoggedIn, NSMAN->isSMOLoggedIn )
LuaFunction_PlayerNumber( IsSMOnlineLoggedIn, NSMAN->isSMOLoggedIn[pn] )
/* /*
* (c) 2003-2004 Charles Lohr, Joshua Allen * (c) 2003-2004 Charles Lohr, Joshua Allen
* All rights reserved. * All rights reserved.
+1 -1
View File
@@ -109,7 +109,7 @@ public:
bool useSMserver; bool useSMserver;
bool isSMOnline; bool isSMOnline;
bool isSMOLoggedIn; bool isSMOLoggedIn[NUM_PLAYERS];
vector <int> m_PlayerStatus; vector <int> m_PlayerStatus;
int m_ActivePlayers; int m_ActivePlayers;
+2 -2
View File
@@ -60,7 +60,7 @@ ScreenSMOnlineLogin::ScreenSMOnlineLogin( const CString& sName ) : ScreenWithMen
SET_XY_AND_ON_COMMAND( m_textLoginMessage ); SET_XY_AND_ON_COMMAND( m_textLoginMessage );
this->AddChild( &m_textLoginMessage ); this->AddChild( &m_textLoginMessage );
NSMAN->isSMOLoggedIn = false; NSMAN->isSMOLoggedIn[m_iPlayer] = false;
} }
void ScreenSMOnlineLogin::Input( const DeviceInput& DeviceI, const InputEventType type, void ScreenSMOnlineLogin::Input( const DeviceInput& DeviceI, const InputEventType type,
@@ -157,7 +157,7 @@ void ScreenSMOnlineLogin::HandleScreenMessage( const ScreenMessage SM )
int Status = NSMAN->m_SMOnlinePacket.Read1(); int Status = NSMAN->m_SMOnlinePacket.Read1();
if ( Status == 0 ) if ( Status == 0 )
{ {
NSMAN->isSMOLoggedIn = true; NSMAN->isSMOLoggedIn[m_iPlayer] = true;
SCREENMAN->SendMessageToTopScreen( SM_GoToNextScreen ); SCREENMAN->SendMessageToTopScreen( SM_GoToNextScreen );
} }
else else