@ -23,33 +23,18 @@ namespace devilution {
namespace {
std : : unique_ptr < net : : abstract_net > dvlnet_inst ;
bool GameIsPublic = { } ;
thread_local uint32_t dwLastError = 0 ;
# ifndef NONET
SdlMutex storm_net_mutex ;
# endif
} // namespace
uint32_t SErrGetLastError ( )
{
return dwLastError ;
}
void SErrSetLastError ( uint32_t dwErrCode )
{
dwLastError = dwErrCode ;
}
bool SNetReceiveMessage ( uint8_t * senderplayerid , void * * data , uint32_t * databytes )
{
# ifndef NONET
std : : lock_guard < SdlMutex > lg ( storm_net_mutex ) ;
# endif
if ( ! dvlnet_inst - > SNetReceiveMessage ( senderplayerid , data , databytes ) ) {
SErrSetLastError ( STORM_ERROR_NO_MESSAGES_WAITING ) ;
return false ;
}
return true ;
return dvlnet_inst - > SNetReceiveMessage ( senderplayerid , data , databytes ) ;
}
bool SNetSendMessage ( int playerID , void * data , unsigned int databytes )
@ -67,11 +52,7 @@ bool SNetReceiveTurns(int arraysize, char **arraydata, size_t *arraydatabytes, u
# endif
if ( arraysize ! = MAX_PLRS )
UNIMPLEMENTED ( ) ;
if ( ! dvlnet_inst - > SNetReceiveTurns ( arraydata , arraydatabytes , arrayplayerstatus ) ) {
SErrSetLastError ( STORM_ERROR_NO_MESSAGES_WAITING ) ;
return false ;
}
return true ;
return dvlnet_inst - > SNetReceiveTurns ( arraydata , arraydatabytes , arrayplayerstatus ) ;
}
bool SNetSendTurn ( char * data , unsigned int databytes )