uox3/source/cThreadQueue.h
Xoduz 37a76083de Rest of the changes for 0.99.6-RC1
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
2022-10-24 18:39:33 +08:00

51 lines
1.2 KiB
C++

#ifndef __CTHREADQUEUE_H__
#define __CTHREADQUEUE_H__
#include <string>
#include <queue>
#include <mutex>
//o------------------------------------------------------------------------------------------------o
enum MessageType
{
MSG_WORLDSAVE = 0,
MSG_SHUTDOWN,
MSG_UNKNOWN,
MSG_PRINT,
MSG_RELOADJS,
MSG_CONSOLEBCAST,
MSG_PRINTDONE,
MSG_PRINTFAILED,
MSG_SECTIONBEGIN,
MSG_RELOAD,
MSG_COUNT
};
struct MessagePassed_st
{
MessageType actualMessage;
std::string data;
};
//o------------------------------------------------------------------------------------------------o
class CThreadQueue
{
private:
std::queue<MessagePassed_st> internalQueue;
std::mutex queuelock;
public:
CThreadQueue() = default;
auto NewMessage( MessageType toAdd, const std::string& data = "" ) -> void;
auto GrabMessage()->MessagePassed_st;
auto Empty() -> bool;
auto operator<<( MessageType newMessage ) -> CThreadQueue &;
auto operator<<( char *toPush ) -> CThreadQueue &;
auto operator<<( const char *toPush ) -> CThreadQueue &;
auto operator<<( const std::string& toPush ) -> CThreadQueue &;
auto BulkData() -> std::queue<MessagePassed_st>;
};
extern CThreadQueue messageLoop;
#endif