mirror of
https://github.com/UOX3DevTeam/UOX3
synced 2026-08-13 12:27:04 -04:00
Misc cleanup and standardization of style and naming conventions in code and scripts Added missing code for showing race in paperdoll based on ini setting Players can no longer use Polymorph spell while incognitoed, or while under effect of tribal paint Players can no longer use Incognito spell while polymorphed, or while under the effects of tribal paint Facial hair is now removed from players who are under the effects of Incognito spell that changes their gender for female
64 lines
2 KiB
C++
64 lines
2 KiB
C++
#include "cThreadQueue.h"
|
|
#include <algorithm>
|
|
|
|
//==============================================================================
|
|
// We instantiate this right at the start
|
|
CThreadQueue messageLoop;
|
|
|
|
//=============================================================
|
|
auto CThreadQueue::operator << ( MessageType newMessage ) -> CThreadQueue &
|
|
{
|
|
NewMessage( newMessage, "" );
|
|
return ( *this );
|
|
}
|
|
//=============================================================
|
|
auto CThreadQueue::operator << ( char *toPush ) -> CThreadQueue &
|
|
{
|
|
NewMessage( MSG_PRINT, toPush );
|
|
return ( *this );
|
|
}
|
|
//=============================================================
|
|
auto CThreadQueue::operator << ( const char *toPush ) -> CThreadQueue &
|
|
{
|
|
NewMessage( MSG_PRINT, toPush );
|
|
return ( *this );
|
|
}
|
|
//=============================================================
|
|
auto CThreadQueue::operator << ( const std::string& toPush ) -> CThreadQueue &
|
|
{
|
|
NewMessage( MSG_PRINT, toPush.c_str() );
|
|
return ( *this );
|
|
}
|
|
//=============================================================
|
|
auto CThreadQueue::Empty() -> bool
|
|
{
|
|
std::scoped_lock lock( queuelock );
|
|
bool retVal = internalQueue.empty();
|
|
return retVal;
|
|
}
|
|
//=============================================================
|
|
auto CThreadQueue::GrabMessage() -> MessagePassed_st
|
|
{
|
|
std::scoped_lock lock( queuelock );
|
|
MessagePassed_st toReturn = internalQueue.front();
|
|
internalQueue.pop();
|
|
|
|
return toReturn;
|
|
}
|
|
//=============================================================
|
|
auto CThreadQueue::NewMessage( MessageType toAdd, const std::string& data ) -> void
|
|
{
|
|
MessagePassed_st adding;
|
|
adding.actualMessage = toAdd;
|
|
adding.data = data;
|
|
std::scoped_lock lock( queuelock );
|
|
internalQueue.push( adding );
|
|
}
|
|
//=============================================================
|
|
auto CThreadQueue::BulkData() -> std::queue<MessagePassed_st>
|
|
{
|
|
std::queue<MessagePassed_st> returnQueue;
|
|
std::scoped_lock lock( queuelock );
|
|
std::swap( returnQueue, internalQueue );
|
|
return returnQueue;
|
|
}
|