本文整理汇总了C++中NetClient::disconnectFromServer方法的典型用法代码示例。如果您正苦于以下问题:C++ NetClient::disconnectFromServer方法的具体用法?C++ NetClient::disconnectFromServer怎么用?C++ NetClient::disconnectFromServer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetClient
的用法示例。
在下文中一共展示了NetClient::disconnectFromServer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clientStopper
int NetClient::clientStopper (void* instance) {
NetClient* pNetClient = (NetClient*) instance;
while (!pNetClient->m_stopClient)
SDL_Delay (1000);
SDL_Delay ( NetControl::M_THREAD_FINISH_WAIT_TIME );
if (pNetClient->m_deadReckoningIsOn){
SDL_KillThread( pNetClient->m_pThreadDeadReckoning );
pNetClient->m_deadReckoningIsOn = false;
}
if (pNetClient->m_syncSenderIsOn){
SDL_KillThread( pNetClient->m_pThreadSyncSender );
pNetClient->m_syncSenderIsOn = false;
}
if (pNetClient->m_receiverIsOn){
SDL_KillThread( pNetClient->m_pThreadReceiver );
pNetClient->m_receiverIsOn = false;
SDL_SemPost (pNetClient->m_pSemEntityValues); /** terminou de mexer nas entidades... liberar acesso **/
NetControl::postForSync(); /** terminou de mexer nas entidades. pode liberar para o SceneManager::update() **/
}
if (pNetClient->m_isConnected)
pNetClient->disconnectFromServer();
pNetClient->killAllEntities();
if (pNetClient->m_clientIsOn){
SDLNet_UDP_Close(pNetClient->m_sock);
if (pNetClient->m_pSemEntityValues != NULL){
SDL_DestroySemaphore(pNetClient->m_pSemEntityValues);
pNetClient->m_pSemEntityValues = NULL;
}
pNetClient->m_clientIsOn = false;
}
//PIPOCA todas as entidades um dia instanciadas
/**
REMOVER T O D A S AS ENTIDADES DO JOGO[?]
**/
//limpar lista de entidades
pNetClient->m_vMyEntities.clear();
pNetClient->m_vOthersNames.clear();
for (int vRunner = 0; vRunner < pNetClient->m_vOthersEntities.size(); vRunner++){
pNetClient->m_vOthersEntities[vRunner].clear();
}
//limpar fila de NetCustomMessages recebidas
while ( !pNetClient->m_qCustomMessageQueue.empty() ){
delete ( pNetClient->m_qCustomMessageQueue.front() );
pNetClient->m_qCustomMessageQueue.pop();
}
return 0;
}