本文整理汇总了C++中MessageQueue类的典型用法代码示例。如果您正苦于以下问题:C++ MessageQueue类的具体用法?C++ MessageQueue怎么用?C++ MessageQueue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MessageQueue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sceneHandler10_clickGum
void sceneHandler10_clickGum() {
if (g_vars->scene10_hasGum) {
if (sceneHandler10_inflaterIsBlind()) {
if (g_vars->scene10_hasGum) {
int x = g_vars->scene10_gum->_ox - 139;
int y = g_vars->scene10_gum->_oy - 48;
if (abs(x - g_fp->_aniMan->_ox) > 1 || abs(y - g_fp->_aniMan->_oy) > 1) {
MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, x, y, 1, ST_MAN_RIGHT);
if (mq) {
ExCommand *ex = new ExCommand(0, 17, MSG_SC10_CLICKGUM, 0, 0, 0, 1, 0, 0, 0);
ex->_excFlags = 2;
mq->addExCommandToEnd(ex);
postExCommand(g_fp->_aniMan->_id, 2, x, y, 0, -1);
}
} else {
g_vars->scene10_hasGum = 0;
chainQueue(QU_SC10_TAKEGUM, 1);
}
}
} else {
g_vars->scene10_inflater->changeStatics2(ST_NDV_SIT);
if (g_fp->getObjectState(sO_Inflater) == g_fp->getObjectEnumState(sO_Inflater, sO_WithGum))
g_vars->scene10_inflater->startAnim(MV_NDV_DENIES, 0, -1);
else
g_vars->scene10_inflater->startAnim(MV_NDV_DENY_NOGUM, 0, -1);
}
}
}
示例2: sceneHandler11_jumpOver
void sceneHandler11_jumpOver(double angle) {
MGMInfo mgminfo;
sceneHandler11_emptySwing();
g_fp->_aniMan->show1(690 - (int)(sin(g_vars->scene11_swingAngle) * -267.0), 215 - (int)(cos(g_vars->scene11_swingAngle) * -267.0),
MV_MAN11_JUMPOVER, 0);
g_fp->_aniMan->_priority = 0;
mgminfo.staticsId2 = ST_MAN_1PIX;
mgminfo.ani = g_fp->_aniMan;
mgminfo.x1 = 1163;
mgminfo.y1 = 837 - (int)(angle * 153.0);
mgminfo.field_1C = 0;
mgminfo.field_10 = 1;
mgminfo.flags = 78;
mgminfo.movementId = MV_MAN11_JUMPOVER;
MessageQueue *mq = g_vars->scene11_mgm.genMovement(&mgminfo);
if (mq) {
g_vars->scene11_crySound = SND_11_022;
ExCommand *ex = new ExCommand(0, 17, MSG_SC11_RESTARTMAN, 0, 0, 0, 1, 0, 0, 0);
ex->_excFlags = 2;
mq->addExCommandToEnd(ex);
if (!mq->chain(g_fp->_aniMan))
delete mq;
}
}
示例3: debug
void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, BehaviorEntry *bhe) {
debug(0, "BehaviorManager::updateStaticAniBehavior(%s)", transCyrillic((byte *)ani->_objectName));
MessageQueue *mq = 0;
if (bhe->_flags & 1) {
uint rnd = g_fullpipe->_rnd->getRandomNumber(32767);
uint runPercent = 0;
for (int i = 0; i < bhe->_itemsCount; i++) {
if (!(bhe->_items[i]->_flags & 1) && bhe->_items[i]->_percent) {
if ((rnd >= runPercent && rnd <= runPercent + bhe->_items[i]->_percent) || i == bhe->_itemsCount - 1) {
mq = new MessageQueue(bhe->_items[i]->_messageQueue, 0, 1);
break;
}
runPercent += bhe->_items[i]->_percent;
}
}
} else {
for (int i = 0; i < bhe->_itemsCount; i++) {
if (!(bhe->_items[i]->_flags & 1) && delay >= bhe->_items[i]->_delay) {
if (bhe->_items[i]->_percent) {
if (g_fullpipe->_rnd->getRandomNumber(32767) <= bhe->_items[i]->_percent) {
mq = new MessageQueue(bhe->_items[i]->_messageQueue, 0, 1);
break;
}
}
}
}
}
if (mq) {
mq->replaceKeyCode(-1, ani->_okeyCode);
mq->chain(ani);
}
}
示例4: handleMessages
void TeamDataProvider::handleMessages(MessageQueue& teamReceiver)
{
if(theInstance)
teamReceiver.handleAllMessages(*theInstance);
teamReceiver.clear();
}
示例5: sceneHandler03_takeEgg
void sceneHandler03_takeEgg(ExCommand *ex) {
MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(ex->_parId);
if (mq && mq->getCount() > 0) {
ExCommand *ex0 = mq->getExCommandByIndex(0);
ExCommand *ex1 = mq->getExCommandByIndex(1);
int egg1 = sceneHandler03_swallowedEgg1State();
if (egg1 && ex0) {
ex0->_parentId = egg1;
sceneHandler03_pushEggStack();
}
if ( g_vars->swallowedEgg1->_value.intValue == ANI_INV_EGGAPL
&& !g_vars->swallowedEgg2->_value.intValue
&& !g_vars->swallowedEgg3->_value.intValue
&& ex1) {
if (ex1->_objtype == kObjTypeObjstateCommand) {
ObjstateCommand *com = (ObjstateCommand *)ex1;
com->_value = g_fp->getObjectEnumState(sO_EggGulper, sO_WantsNothing);
}
}
}
}
示例6: pad
void OldDiversifiedKeccakPadding::pad(unsigned int rate, MessageQueue& queue) const
{
append10star(8, queue);
queue.appendByte(diversifier);
queue.appendByte(rate/8);
append10star(rate, queue);
}
示例7: sceneHandler25_animateBearders
void sceneHandler25_animateBearders() {
if (g_fp->_rnd->getRandomNumber(32767) < 218) {
MessageQueue *mq;
mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED), 0, 1);
mq->replaceKeyCode(-1, g_vars->scene25_bearders[0]->_okeyCode);
mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
mq->chain(0);
g_vars->scene25_beardersCounter = 0;
if (g_fp->_rnd->getRandomNumber(32767) < 0x1FFF) {
mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED2), 0, 1);
mq->replaceKeyCode(-1, g_vars->scene25_bearders[1]->_okeyCode);
mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
mq->chain(0);
if (g_fp->_rnd->getRandomNumber(32767) < 8191) {
mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED3), 0, 1);
mq->replaceKeyCode(-1, g_vars->scene25_bearders[2]->_okeyCode);
mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100;
mq->chain(0);
}
}
}
}
示例8: getExCommandByIndex
bool MessageQueue::checkGlobalExCommandList1() {
ExCommand *ex, *ex1;
for (uint i = 0; i < getCount(); i++) {
ex = getExCommandByIndex(i);
if (ex->_messageKind != 1 && ex->_messageKind != 20 && ex->_messageKind != 5 && ex->_messageKind != 27)
continue;
for (Common::List<ExCommand *>::iterator it = g_fullpipe->_exCommandList.begin(); it != g_fullpipe->_exCommandList.end(); it++) {
ex1 = *it;
if (ex1->_messageKind != 1 && ex1->_messageKind != 20 && ex1->_messageKind != 5 && ex1->_messageKind != 27)
continue;
if (ex1->_keyCode != ex->_keyCode && ex1->_keyCode != -1 && ex->_keyCode != -1)
continue;
MessageQueue *mq = g_fullpipe->_globalMessageQueueList->getMessageQueueById(ex1->_parId);
if (mq) {
if (mq->getFlags() & 1)
return false;
}
}
}
return true;
}
示例9: PEG_METHOD_ENTER
void CIMExportRequestDispatcher::handleEnqueue(Message* message)
{
PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
"CIMExportRequestDispatcher::handleEnqueue");
PEGASUS_ASSERT(message != 0);
switch (message->getType())
{
case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
{
CIMExportIndicationResponseMessage* response =
_handleExportIndicationRequest(
(CIMExportIndicationRequestMessage*) message);
PEG_TRACE((
TRC_HTTP,
Tracer::LEVEL4,
"_CIMExportRequestDispatcher::handleEnqueue(message) - "
"message->getCloseConnect() returned %d",
message->getCloseConnect()));
response->setCloseConnect(message->getCloseConnect());
MessageQueue* queue = MessageQueue::lookup(response->dest);
PEGASUS_ASSERT(queue != 0);
queue->enqueue(response);
break;
}
default:
PEGASUS_UNREACHABLE(PEGASUS_ASSERT(0);)
break;
}
示例10: PEG_METHOD_ENTER
void CIMListenerIndicationDispatcher::handleEnqueue(Message* message)
{
PEG_METHOD_ENTER(TRC_SERVER,
"CIMListenerIndicationDispatcher::handleEnqueue");
if(message!=NULL)
{
switch (message->getType())
{
case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
{
CIMExportIndicationRequestMessage* request =
(CIMExportIndicationRequestMessage*)message;
CIMExportIndicationResponseMessage* response =
static_cast<CIMListenerIndicationDispatcherRep*>(_rep)->
handleIndicationRequest(request);
MessageQueue* queue = MessageQueue::lookup(response->dest);
PEGASUS_ASSERT(queue != 0);
queue->enqueue(response);
}
break;
default:
break;
}
delete message;
}
PEG_METHOD_EXIT();
}
示例11: sceneHandler28_makeFaces
void sceneHandler28_makeFaces(ExCommand *cmd) {
g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0)->_flags &= 0xFFFB;
g_vars->scene28_lighteningObject = 0;
MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId);
if (mq) {
int frames[5];
frames[0] = MV_WMN28_IN_1;
frames[1] = MV_WMN28_IN_2;
frames[2] = MV_WMN28_IN_3;
frames[3] = MV_WMN28_IN_4;
frames[4] = MV_WMN28_IN_5;
for (int i = 0; i < 5; i++) {
int pos;
while (frames[pos = g_fp->_rnd->getRandomNumber(4)] == 0)
;
mq->getExCommandByIndex(i)->_messageNum = frames[pos];
frames[pos] = 0;
}
}
}
示例12: handle_AsyncLegacyOperationStart
void MessageQueueService::handle_AsyncLegacyOperationStart(AsyncLegacyOperationStart *req)
{
// remove the legacy message from the request and enqueue it to its destination
Uint32 result = async_results::CIM_NAK;
Message *legacy = req->_act;
if (legacy != 0)
{
MessageQueue* queue = MessageQueue::lookup(req->_legacy_destination);
if (queue != 0)
{
if (queue->isAsync() == true)
{
(static_cast<MessageQueueService *>(queue))->handleEnqueue(legacy);
}
else
{
// Enqueue the response:
queue->enqueue(req->get_action());
}
result = async_results::OK;
}
}
_make_response(req, result);
}
示例13: sceneHandler14_showBallMan
void sceneHandler14_showBallMan() {
if (g_vars->scene14_flyingBall) {
g_vars->scene14_flyingBall->show1(g_vars->scene14_dudeX - 166, g_vars->scene14_dudeY + 40, MV_BAL14_TOGMA, 0);
g_vars->scene14_flyingBall->_priority = 27;
MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
ExCommand *ex = new ExCommand(ANI_BALL14, 1, MV_BAL14_TOGMA, 0, 0, 0, 1, 0, 0, 0);
ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode;
ex->_excFlags |= 2;
ex->_field_24 = 1;
mq->addExCommandToEnd(ex);
ex = new ExCommand(ANI_BALL14, 6, 0, 0, 0, 0, 1, 0, 0, 0);
ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode;
ex->_excFlags |= 3;
mq->addExCommandToEnd(ex);
mq->chain(0);
g_vars->scene14_flyingBall->startAnim(MV_BAL14_TOGMA, 0, -1);
g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall);
g_vars->scene14_flyingBall = 0;
if (g_vars->scene14_dudeX >= 1300)
sceneHandler14_exitScene();
}
}
示例14: SendIPCMessage
void SendIPCMessage(ipc_message_t msg, bool blocking) {
MessageQueue* q = msg.ConsumableEarly() ? ipcEarlyMessageQueue : ipcMessageQueue;
msg.blocking = blocking;
#ifdef IPC_DEBUG
lk_lock(printing_lock, 1);
std::cerr << "[SEND] IPC message, ID: " << msg.id << std::endl;
lk_unlock(printing_lock);
#endif
lk_lock(lk_ipcMessageQueue, 1);
q->push_back(msg);
if (blocking)
ackMessages->operator[](msg) = false;
lk_unlock(lk_ipcMessageQueue);
if (blocking) {
lk_lock(lk_ipcMessageQueue, 1);
while (ackMessages->at(msg) == false) {
lk_unlock(lk_ipcMessageQueue);
xio_sleep(10);
lk_lock(lk_ipcMessageQueue, 1);
}
lk_unlock(lk_ipcMessageQueue);
}
}
示例15: writeIntoMessageQueue
void Kernel::writeIntoMessageQueue(Task* task, int length, int params[]) {
int activeTaskId = _taskManager->getActiveTask()->id;
if ((std::strcmp(_taskManager->getActiveTask()->name, "ScreenSwitcher") == 0) && (params[0] == 398)) {
activeTaskId = -1;
int nextTaskId = -1;
Task** tasks = _taskManager->getTaskList();
for (int i = _displayTaskId + 1; nextTaskId < 0; i++) {
if (i >= MAX_TASKS) {
i = 0;
}
if (tasks[i] != NULL) {
nextTaskId = i;
}
}
_displayTaskId = nextTaskId;
params[1] = _displayTaskId;
}
// if (task->status == Blocked) {
// task->status = Ready;
// }
MemoryManager* memoryManager = task->memoryManager;
MessageQueue* messageQueue = memoryManager->getMessageQueueWithoutVirtualOffset();
if (!messageQueue->isFull()) {
Message* message = memoryManager->createMessage(activeTaskId, length, params);
messageQueue->pushMessage(message);
};
}