void BtPhysics::addPhysical(uint32_t id, const std::string& tmp, float *mat, bool isCharacter) { if(isCharacter) { pushMessage(new AddCharObjMsg(id, tmp, mat)); } else { pushMessage(new AddPhysObjMsg(id, tmp, mat)); } }
static NEObject& _searchModuleSet(NEModuleCodeSet& moduleset, NEStringSet& work_position, onObjectFound& handler = onObjectFound()) { // pre: NEObject* null_pointer = NE_NULL; if( ! &work_position) { pushMessage("작업위치 문자열이 없습니다."); return *null_pointer; } if(work_position.getLength() <= 0) return moduleset; NEString& position = work_position[0]; int type = 0; // 0은 unknown을 의미한다. int index = _getPositionTypeAndIndex(position, type); if(type != 0 && type != 2) { pushMessage(NEString("잘못된 위치 문자열입니다 : " + position + "타입이 모듈이 아닙니다.")); return *null_pointer; } if(index < 0 || index > moduleset.getLengthLastIndex()) return *null_pointer; // main: NEModule& module = moduleset[index]; handler.onModuleFound(module); work_position.popFront(); if (work_position.getLength() > 0) return _searchArguments(module.getArguments(), work_position, handler); return module; }
void BtPhysics::delPhysical(uint32_t id, bool isCharacter) { if(isCharacter) { pushMessage(new DelCharObjMsg(id)); } else { pushMessage(new DelPhysObjMsg(id)); } }
void DevConsole::executeCommand(string& command) { StringUtils::toLower(command); Tokenizer tokenizer(command); string a = tokenizer.nextToken(); string b = tokenizer.nextToken(); string c = tokenizer.nextToken(); if (command == "fps") playerHud->toggleFPS(); else if (a == "fov" && b.length() > 0) { float fov; fov = atof(b.c_str()); if (fov < 10) fov = 10; glutDisplay->setFOV(fov); glutDisplay->reshapeFunction(width, height); } else if(command == "position") playerHud->togglePosition(); else if(command == "angles") playerHud->toggleAngles(); else if (command == "clear") messages.clear(); else if (command == "now folks") { pushMessage(Message("Some of you might already know... what this car is.", Colour(0.4f, 0.7f, 0.2f))); pushMessage(Message("And some of you do not.", Colour(0.4f, 0.7f, 0.2f))); } else pushMessage(Message("Huh?\n", Colour(0.4f, 0.7f, 0.2f))); }
void SampleBase::onShowMessage() { pushMessage( "fps= %f" , getFPS() ); for( int i = 0 ; i < 7 ; ++i ) pushMessage( mDevMsg[i].c_str() ); }
static void *messagePush_func(void *args) { DEBUG_PRINT("Job progress pusher started\n"); char *buf = (char *)malloc(64); int pendingMsg; LenJob *job = NULL; //////////////////////////////// // hands shaking with sched server // send init message to sched server // we use pending message // for it has to be sent first // sprintf(buf, "#start#%s|end", gl_cfg.localIP); sprintf(buf, "%s%s", PRO_INIT_MESSAGE, PRO_MESSAGE_TAIL); pendingMsg = TRUE; while(gl_cfg.flag != STATUS_EXIT) { // when there are pending messages, send first if(pendingMsg) { if(pushMessage(buf) > 0) { pendingMsg = FALSE; free(buf); } }else if(gl_cfg.pendingReport != 0) { // if there are finished task, then connect to server // else wait for a while job = gl_cfg.lenList[0]; ////////////////////// // currently only 1 len is supported ////////////////////// pthread_mutex_lock(&job->jobMutex); // copy finished list to tmp list and clear it std::vector<Task *> tmpList(job->finishedList); job->finishedList.clear(); pthread_mutex_unlock(&job->jobMutex); pthread_mutex_lock(&gl_cfg.lenMutex); gl_cfg.totalReported += tmpList.size(); gl_cfg.pendingReport -= tmpList.size(); pthread_mutex_unlock(&gl_cfg.lenMutex); // generate progress message buf = genProgressMessage(tmpList); tmpList.clear(); if(pushMessage(buf) < 0) pendingMsg = TRUE; else free(buf); } // sleep for several second mySleep(SERVER_WAIT_TIME); } // save pending message DEBUG_PRINT("Job progress pusher ended\n"); }
static NEObject& _searchNodeSet(NENodeCodeSet& nodeset, NEStringSet& work_position, onObjectFound& handler = onObjectFound()) { // pre: NEObject* null_pointer = NE_NULL; if( ! &work_position) { pushMessage("작업위치 문자열이 없습니다."); return *null_pointer; } if(work_position.getLength() <= 0) return nodeset; NEString& position = work_position[0]; int type = 0; // 0은 unknown을 의미한다. int index = _getPositionTypeAndIndex(position, type); if(type != 0 && type != 1) { pushMessage(NEString("잘못된 위치 문자열입니다 : " + position + "타입이 노드가 아닙니다.")); return *null_pointer; } if(index < 0 || index > nodeset.getLengthLastIndex()) return *null_pointer; // main: NENode& node = nodeset[index]; handler.onNodeFound(node); work_position.popFront(); if(work_position.getLength() > 0) { if(work_position[0] == "m") { work_position.popFront(); return _searchModuleSet(node.getModuleSet(), work_position, handler); } else if(work_position[0] == "k") { work_position.popFront(); return _searchKeySet(node.getKeySet(), work_position, handler); } else { pushMessage("주어진 path = " + path + " 가 잘못되었습니다. 적당한 객체를 찾지 못했습니다."); return *null_pointer; } } else return node; }
void CSwordSlashController::process(const std::shared_ptr<Logic::IMessage> &message) { if((message->getType().compare("TOUCHED") == 0)) { Logic::CEntity *otherEntity = dynamic_cast<TOUCHED*>(message.get())->getEntidad(); if(otherEntity) { if (otherEntity->getTag() == "enemy") { if(_damage>0) { std::shared_ptr<DAMAGED> m(new DAMAGED()); m->setFloat(_damage); m->setString(_entity->getType()); otherEntity->emitMessage(m); std::shared_ptr<PUSH> pushMessage(new PUSH()); pushMessage->setDirection(_direction); pushMessage->setSpeed(0.5f); otherEntity->emitMessage(pushMessage, this); //BaseSubsystems::Log::Debug("ÑAPA: " + std::to_string(_damage)); } Logic::CEntityFactory::getSingletonPtr()->createEntityByType("ChispaDanhoEnemy", otherEntity->getCenterPosition(), _entity->getMap()); } } } } // process
void IoApp::Impl::push(int fd) { int count = 0; ms::IMessage* list = _msg_queue->get(); ms::IMessage* item; while (list) { ++count; item = list; list = list->_next; item->_next = 0; pushMessage(item); } if (count > 256) count = 256; else if (count == 0) count = 1; char buf[256]; int ret = ::read(fd, buf, count); (void)ret; }
void DiagnosticsDialog::exceptionMessage(const std::exception& e, const QString& context) { pushMessage(MS_EXCEPTION, (context.isEmpty() ? "" : context + "\n\n" + QString::fromUtf8(e.what()))); // error message is important, make sure the diagnostics are shown show(); }
void DiagnosticsDialog::errorMessage(const QString& message) { pushMessage(MS_ERROR, message); // error message is important, make sure the diagnostics are shown show(); }
Error push(Message msg) override { auto fun = [this, msg = std::move(msg)] { pushMessage(msg); }; m_loop.invoke(std::move(fun)); return Error::empty(); }
void DiagnosticsDialog::warningMessage(const QString& message) { pushMessage(MS_WARNING, message); // warning message is important, make sure the diagnostics are shown show(); }
void sendPushMessage(Logic::CEntity *otherEntity, float speed, Vector3 direction) { direction.normalise(); std::shared_ptr<Logic::PUSH> pushMessage(new Logic::PUSH()); pushMessage->setDirection(direction); pushMessage->setSpeed(speed); otherEntity->emitMessage(pushMessage); }
void EngineLog::writeWarning( const char *msg, ... ) { if( Modules::config().maxLogLevel < 2 ) return; va_list args; va_start( args, msg ); pushMessage( 2, msg, args ); va_end( args ); }
void ThreadManager::pushMessageToPool(uint8_t destpool, MessageQueueObject* msg) { // since the only ways I can think of to do 'real' RR to a pool involve holding a lock, // a PRNG is used, this should approximate RR over time uint8_t destIndex = rand() % mPools[destpool].size(); pushMessage(mPools[destpool][destIndex], msg); }
void EngineLog::writeDebugInfo( const char *msg, ... ) { if( Modules::config().maxLogLevel < 4 ) return; va_list args; va_start( args, msg ); pushMessage( 4, msg, args ); va_end( args ); }
void pushWait(int id, Message* data){ pthread_mutex_lock(&mut); pushMessage(data); printf("Message Pushed, Waking up Execute\n"); pthread_cond_signal(&newMessage); printf("Sleeping until new Data\n"); pthread_cond_wait(&newData[id], &mut); printf("New Data, Woke Up\n"); pthread_mutex_unlock(&mut); }
void Query::handleQuit(const char *message) { char buf[1024]; snprintf(buf, 1024, "%s has quit (%s)", partner.c_str(), message); pushMessage(buf); }
void ArduinoEngine::pi_returnPirValue(int vl) { std::cout<<__FUNCTION__<<":"<<vl<<std::endl; if (vl != _pirValue) { setPirValue(vl); //write activity log if (_pirValue == HIGH) { _db.writeLog("Motion detected!"); } else { _db.writeLog("Motion ended!"); } //decide to push if (_getOptionsValue<bool>(HSS_DT_MOTION_ENABLE_SETTING)) { //push if (_pirValue == HIGH) { pushMessage("Motion detected!"); } else { pushMessage("Motion ended!"); } } } }
void ArduinoEngine::pi_returnSwitchValue(int vl) { std::cout<<__FUNCTION__<<":"<<vl<<std::endl; if (vl != _switchValue) { setSwitchValue(vl); //write activity log if (_switchValue == LOW) { _db.writeLog("Door opened!"); } else { _db.writeLog("Door closed!"); } //decide to push if (_getOptionsValue<bool>(HSS_DT_DOOR_ENABLE_SETTING)) { //push if (_switchValue == LOW) { pushMessage("Door opened!"); } else { pushMessage("Door closed!"); } } } }
void EngineLog::writeDebugInfo( const char *msg, ... ) { if( Modules::config().maxLogLevel < 4 ) return; va_list args; va_start( args, msg ); #if defined( PLATFORM_ANDROID ) __android_log_vprint(ANDROID_LOG_DEBUG, "PACKT", msg, args); #else pushMessage( 4, msg, args ); #endif va_end( args ); }
static NEObject& _searchArguments(NEArgumentSet& args, NEStringSet& work_position, onObjectFound& handler = onObjectFound()) { NEObject* nullpointer = NE_NULL; if( ! &work_position) { pushMessage("작업위치 문자열이 없습니다."); return *nullpointer; } if(work_position.getLength() <= 0) return args; type_index n = work_position[0].toInt(); work_position.popFront(); if (n < 0 || n > args.getLengthLastIndex()) { pushMessage(NEString("잘못된 위치 문자열 입니다. : ") + n); return *nullpointer; } NEKey& dk = args[n].getDefaultKey(); if(dk.isSubClassOf(NEType::NEMODULE_CODESET_KEY)) { NEModuleCodeSetKey& modulesetkey = static_cast<NEModuleCodeSetKey&>(dk); NEModuleCodeSet& moduleset = modulesetkey.getValue(); return _searchModuleSet(moduleset, work_position, handler); } else if(dk.isSubClassOf(NEType::NENODE_CODESET_KEY)) { NENodeCodeSetKey& managed_nodesetkey = static_cast<NENodeCodeSetKey&>(dk); NENodeCodeSet& nodeset = managed_nodesetkey.getValue(); return _searchNodeSet(nodeset, work_position, handler); } return dk; }
void LocalSpadesGame::sendGameMessage( SpadesCSMessageEnum msg, const std::vector<int>& args, SpadesGameMessageSender* sender ) { //code to figure out which client and send accordingly for(size_t i = 0; i < m_mediators.size(); ++i) { if(m_mediators[i] == sender) { pushMessage(SpadesGameMessage(msg,args,i)); break; } } }
void Query::showNickChange(const UserRef &user, const char *newNick) { char buf[1024]; if (user.isSelf) { snprintf(buf, 1024, "You are now known as %s", newNick); } else { snprintf(buf, 1024, "%s is now known as %s", user.nick.c_str(), newNick); } pushMessage(buf); }
void DevConsole::putChar(unsigned char ch) { if(ch == '\n' || ch == '\r') { pushMessage(Message(currentText, Colour(0.9f, 0.9f, 0.9f))); executeCommand(currentText); currentText = ""; } else if(ch == '\b') { if(currentText.length() > 0) currentText = currentText.substr(0, currentText.length() - 1); } else { currentText += ch; } }
bool xpcc::rpr::Interface<Device, N>::sendMessage(Message *message) { if (status & STATUS_START_DELIMITER_RECEIVED) { // bus is busy, copy the data // this copies the data internally if (pushMessage(messagesToSend, message)) { // get a pointer to the copy of the message return true; } } else { // bus is not busy, send message writeMessage(message); } return false; }
void ArduinoEngine::pi_returnBellValue(int vl) { std::cout<<__FUNCTION__<<":"<<vl<<std::endl; if (vl != _bellValue) { setBellValue(vl); //write activity log if (_bellValue == HIGH) { _db.writeLog("Someone press the door bell!"); camera.capture(); } //decide to push if (_getOptionsValue<bool>(HSS_DOOR_BELL_ENABLE_SETTING)) { //push if (_bellValue == HIGH) { pushMessage("Someone press the door bell!"); } } } }
void Query::handleCtcp(const UserRef &user, const char *type, const char *params) { if (strcmp(type, "ACTION") == 0) { outputUserMessage(user.nick.c_str(), params, /*isAction=*/true); } else { RichTextBuilder rt; rt.foreground(COL_LEVEL_BASE, COL_CHANNEL_NOTICE); rt.append("*** CTCP from "); rt.bold(); rt.appendNick(user.nick.c_str()); rt.endBold(); rt.append(": "); rt.foreground(COL_LEVEL_BASE, COL_DEFAULT_FG); rt.appendIRC(params); pushMessage(rt.c_str(), 3); } }
void Query::outputUserMessage(const char *nick, const char *str, bool isAction) { RichTextBuilder rt; if (isAction) { rt.foreground(COL_LEVEL_BASE, COL_ACTION); rt.append("* "); } else { rt.writeS8('<'); } rt.bold(); rt.appendNick(nick); rt.endBold(); rt.append(isAction ? " " : "> "); rt.appendIRC(str); bool isSelf = (strcmp(nick, server->currentNick) == 0); pushMessage(rt.c_str(), isSelf ? 0 : 3); }