void CampaignManager::restoreHPMP(const std::string& s) { if (s == "hp") { pc->stats.hp = pc->stats.get(STAT_HP_MAX); addMsg(msg->get("HP restored.")); } else if (s == "mp") { pc->stats.mp = pc->stats.get(STAT_MP_MAX); addMsg(msg->get("MP restored.")); } else if (s == "hpmp") { pc->stats.hp = pc->stats.get(STAT_HP_MAX); pc->stats.mp = pc->stats.get(STAT_MP_MAX); addMsg(msg->get("HP and MP restored.")); } else if (s == "status") { pc->stats.effects.clearNegativeEffects(); addMsg(msg->get("Negative effects removed.")); } else if (s == "all") { pc->stats.hp = pc->stats.get(STAT_HP_MAX); pc->stats.mp = pc->stats.get(STAT_MP_MAX); pc->stats.effects.clearNegativeEffects(); addMsg(msg->get("HP and MP restored, negative effects removed")); } }
/** * @brief Instanciates and starts all listeners thread (chat, online players). * @pre The client have to be connected before to call this function. */ void MainWindow::startListeners() { // Start a thread for listening server requests. _listener = new Listener(_player.socket, this); connect(_listener, SIGNAL(pseudoAlreadyExists(QString)), this, SLOT(pseudoAlreadyExists(QString))); connect(_listener, SIGNAL(addMsg(QString)), this, SLOT(addMsg(QString))); connect(_listener, SIGNAL(addPlayerToView(player)), this, SIGNAL(askAddPlayer(player))); connect(_listener, SIGNAL(removePlayerFromView(player)), this, SIGNAL(askRmPlayer(player))); connect(_listener, SIGNAL(advisePlayerForGame(QString)), this, SLOT(adviseForGame(QString))); connect(_listener, SIGNAL(advisePlayerForAbortedGame(QString)), this, SLOT(adviseForAbortedGame(QString))); connect(_listener, SIGNAL(startGame()), this, SLOT(startGame())); connect(_listener, SIGNAL(clientBusy(player)), ui->rightMenuWidget, SIGNAL(askSetBusy(player))); connect(_listener, SIGNAL(clientFree(player)), ui->rightMenuWidget, SIGNAL(askSetFree(player))); connect(_listener, SIGNAL(setOpponent(player)), this, SLOT(setOpponent(player))); connect(_listener, SIGNAL(opponentQuit(player)), this, SLOT(opponentQuit(player))); connect(_listener, SIGNAL(receiveCheckerboard(checkerboard)), ui->checkerboardwidget, SLOT(receiveCheckerboard(checkerboard))); connect(_listener, SIGNAL(receiveWinner(player)), this, SLOT(displayWinner(player))); }
void resendMsg(char *name, int k, user *head) { int i; message msg; user *sender = getUserName(name, head); follows *cur = sender->head; message *curm = sender->msgs; for(i=0;i<k;i++) curm = curm->prev; msg.id = curm->id; msg.auth = sender; addMsg(sender, msg); if(cur==NULL) return; do { addMsg(cur->usr, msg); cur = cur->next; } while(cur!=sender->head); }
void CampaignManager::removeItem(int item_id) { if (item_id < 0 || static_cast<unsigned>(item_id) >= items->items.size()) return; menu->inv->remove(item_id); addMsg(msg->get("%s removed.", items->getItemName(item_id))); items->playSound(item_id); }
void CampaignManager::rewardXP(int amount, bool show_message) { bonus_xp += (static_cast<float>(amount) * (100.0f + static_cast<float>(pc->stats.get(STAT_XP_GAIN)))) / 100.0f; pc->stats.addXP(static_cast<int>(bonus_xp)); bonus_xp -= static_cast<float>(static_cast<int>(bonus_xp)); pc->stats.refresh_stats = true; if (show_message) addMsg(msg->get("You receive %d XP.", amount)); }
void ChannelFillThread::run() { #ifdef CHAN_DEBUG std::cerr << "ChannelFillThread::run()" << std::endl; #endif std::list<ChannelMsgSummary> msgs; std::list<ChannelMsgSummary>::iterator it; rsChannels->getChannelMsgList(channelId, msgs); msgs.sort(sortChannelMsgSummary); int count = msgs.size(); int pos = 0; for (it = msgs.begin(); it != msgs.end(); it++) { if (stopped) { break; } emit addMsg(QString::fromStdString(channelId), QString::fromStdString(it->msgId), ++pos, count); } #ifdef CHAN_DEBUG std::cerr << "ChannelFillThread::run() stopped: " << (wasStopped() ? "yes" : "no") << std::endl; #endif }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { m_log = new Log(this); m_pragmaDialog = new PragmaDialog(this); m_memoryDialog = new MemoryDialog(this); m_dbWidget = new DatabaseWidget(); connect(m_dbWidget, SIGNAL(logMsg(QString)), m_log, SLOT(addMsg(QString))); connect(m_dbWidget, SIGNAL(active(QSharedPointer<SQLite>)), m_pragmaDialog, SLOT(active(QSharedPointer<SQLite>))); connect(m_dbWidget, SIGNAL(inactive()), m_pragmaDialog, SLOT(inactive())); connect(m_dbWidget, SIGNAL(active(QSharedPointer<SQLite>)), m_memoryDialog, SLOT(active(QSharedPointer<SQLite>))); connect(m_dbWidget, SIGNAL(inactive()), m_memoryDialog, SLOT(inactive())); setCentralWidget(m_dbWidget); createActions(); createMenus(); createToolBars(); statusBar(); QSettings settings("Research In Motion", "sbuilder"); restoreGeometry(settings.value("geometry").toByteArray()); m_recentFiles = settings.value("recentFiles").toStringList(); updateRecentFileActions(); sqlite3_initialize(); }
void CampaignManager::rewardItem(ItemStack istack) { if (carried_items->full()) { drop_stack.item = istack.item; drop_stack.quantity = istack.quantity; } else { carried_items->add(istack); if (istack.quantity <= 1) addMsg(msg->get("reward_item_single", items->items[istack.item].name)); if (istack.quantity > 1) addMsg(msg->get("reward_item_multiple", istack.quantity, items->items[istack.item].name)); items->playSound(istack.item); } }
void CampaignManager::rewardCurrency(int amount) { ItemStack stack; stack.item = CURRENCY_ID; stack.quantity = amount; if (!menu->inv->inventory[CARRIED].full(stack.item)) addMsg(msg->get("You receive %d %s.", amount, CURRENCY)); rewardItem(stack); items->playSound(CURRENCY_ID); }
void CChatWidget::sendButtonClicked() { QString msg = m_pteInput->toPlainText(); if (msg.size() > 0) { m_pteInput->clear(); addMsg(msg, QString("this"), eSend); sendMessage(msg); } }
void CampaignManager::rewardItem(ItemStack istack) { if (istack.empty()) return; if (menu->inv->inventory[CARRIED].full(istack.item)) { drop_stack.push(istack); } else { menu->inv->add(istack, -1, -1, false); if (istack.item != CURRENCY_ID) { if (istack.quantity <= 1) addMsg(msg->get("You receive %s.", items->getItemName(istack.item))); if (istack.quantity > 1) addMsg(msg->get("You receive %s x%d.", istack.quantity, items->getItemName(istack.item))); items->playSound(istack.item); } } }
int main(int argc, char *argv[]) { data_t entry; int dataSize; time_t tcurrent; char *data; FILE *fp; int aflag = 0; // option to do the if stmt char *mvalue = NULL; // should log any value given here int c; // clear any old log that could exist clearLog(); // getopt example while((c = getopt(argc, argv, "am:")) != -1) { // ck options switch(c) { case 'a': aflag = 1; break; case 'm': mvalue = optarg; // send mvalue to logger tcurrent = time(NULL); entry = (data_t){.time = tcurrent, .string = mvalue}; addMsg(entry, argv[0]); break; case '?': if(optopt == 'm') { // init and add entry to log tcurrent = time(NULL); data = "Error: option -m requires an argument"; entry = (data_t){.time = tcurrent, .string = data}; addMsg(entry, argv[0]); } else { // init and add entry to log tcurrent = time(NULL); data = "Error: options available are a & c"; entry = (data_t){.time = tcurrent, .string = data}; addMsg(entry, argv[0]); } break; default: printf("Unknown error occured"); }
void Status::addUniqueMsg(enum statusMsg::msgLevel level, const std::string &nodeId, const std::string &name, const std::string &msg) { bool duplicateFound = false; auto msgRange = m_messages.equal_range(level); for (auto msgIt = msgRange.first; msgIt != msgRange.second && !duplicateFound; ++msgIt) { duplicateFound = (msgIt->second.nodeId == nodeId) && (msgIt->second.attribute == name) && (msgIt->second.msg == msg); } if (!duplicateFound) addMsg(level, nodeId, name, msg); }
void sendMsg(char *name, unsigned long id, user *head) { message *msg = (message*)malloc(sizeof(message)); user *sender = getUserName(name, head); follows *cur = sender->head; msg->auth = sender; msg->id = id; if(DEBUG) printf("User: %s sending message %ld\n", sender->name, msg->id); addMsg(sender, *msg); if(cur==NULL) return; do { addMsg(cur->usr, *msg); cur = cur->next; } while(cur!=sender->head); }
void ChatListener::run() { while(!stop){ //mutex->lock(); frame f; qDebug() << "[Chat_listener]"; read_server_information(_socket_descriptor, &f); if(strcmp(f.data_type,SEND_MSG_CHAT) == 0){ qDebug() << "[SEND_MSG_CHAT] : " << f.data; emit addMsg(QString::fromStdString(f.data)); } //memset(&f, 0, sizeof(f)); //mutex->unlock(); } }
bool CBrainSlot::AddHeadPieceMsg(CAddHeadPieceMsg *msg) { _added = true; _cursorId = CURSOR_HAND; CAddHeadPieceMsg addMsg("NULL"); if (isEquals("AuditoryCentreSlot")) { if (msg->_value == "AuditoryCentre") addMsg._value = "AuditoryCentre"; } else if (isEquals("SpeechCentreSlot")) { if (msg->_value == "SpeechCentre") addMsg._value = "SpeechCentre"; } else if (isEquals("OlfactoryCentreSlot")) { if (msg->_value == "OlfactoryCentre") addMsg._value = "OlfactoryCentre"; } else if (isEquals("VisionCentreSlot")) { if (msg->_value == "VisionCentre") addMsg._value = "VisionCentre"; } else if (isEquals("CentralCoreSlot")) { if (msg->_value == "CentralCore") addMsg._value = "CentralCore"; } if (addMsg._value != "NULL") addMsg.execute("TitaniaControl"); if (addMsg._value == "OlfactoryCentre") loadFrame(2); else if (addMsg._value == "AuditoryCentre") loadFrame(1); else if (addMsg._value == "SpeechCentre") loadFrame(3); else if (addMsg._value == "VisionCentre") loadFrame(4); else if (addMsg._value == "CentralCore") { CActMsg actMsg("Insert Central Core"); actMsg.execute("CentralCoreSlot"); } _target = msg->_value; _value1 = 1; return true; }
/** * @brief Constructs and initialize the \ref MainWindow. * @param QWidget parent - the parent of the \ref MainWindow (0 by default). */ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); /* Init Threads */ _listener = NULL; /* Opponent player */ strcpy(_opponent_player.name , ""); /* player */ strcpy(_player.name, ""); _player.color = 0; // Connect Connection Widget with the window connect(ui->connectionWidget, SIGNAL(askConnection(QString, int, QString)), this, SLOT(serverConnection(QString, int, QString))); // Configure disconnection of the user connect(ui->rightMenuWidget, SIGNAL(askDisconnection()), this, SLOT(serverDisconnection())); connect(ui->rightMenuWidget, SIGNAL(askSendMessage(QString)), this, SLOT(sendChatMessage(QString))); //Chatroom connect(this, SIGNAL(askAddMsg(QString)), ui->rightMenuWidget, SIGNAL(addMsg(QString))); //Online players connect(this, SIGNAL(askAddPlayer(player)), ui->rightMenuWidget, SIGNAL(addPlayerToView(player))); connect(this, SIGNAL(askRmPlayer(player)), ui->rightMenuWidget, SIGNAL(rmPlayerFromView(player))); connect(ui->rightMenuWidget, SIGNAL(askNewGameWith(player)), this, SLOT(createGame(player))); connect(this, SIGNAL(askSetBusy(player)), ui->rightMenuWidget, SIGNAL(askSetBusy(player))); connect(this, SIGNAL(askSetFree(player)), ui->rightMenuWidget, SIGNAL(askSetFree(player))); //Checkerboard connect(this, SIGNAL(initGame(player, player)), ui->checkerboardwidget, SLOT(init(player, player))); connect(ui->checkerboardwidget, SIGNAL(sendCheckerboard(checkerboard)), this, SLOT(sendCheckerboard(checkerboard))); connect(ui->checkerboardwidget, SIGNAL(sendWinner(player)), this, SLOT(adviseWinner(player))); //connect(this, SIGNAL(changePlayerTurn(int)), ui->checkerboardwidget, SLOT(changePlayer(int))); }
//----------------------------------------------------------------------------- int KMFolder::moveMsg(KMMessage* aMsg, int* aIndex_ret) { KMFolder* msgParent; int rc; assert(aMsg != NULL); msgParent = aMsg->parent(); if (msgParent) { msgParent->open(); aMsg = msgParent->take(msgParent->find(aMsg)); msgParent->close(); } open(); rc = addMsg(aMsg, aIndex_ret); close(); // debug("KMFolder::moveMsg() rc=%i",rc); return rc; }
int getColor() { int color; char msg[20]; if (game_state.player == HUMAN) { change_color = 1; color = strToColor(getInput()); } else color = chooseColor(CARDS[game_state.player]); strcpy(msg, "颜色变为: "); int length = strlen(msg); strcpy(msg + length, colorToStr(color)); length = strlen(msg); strcpy(msg + length, "\0"); addMsg(msg); return color; }
void CampaignManager::removeCurrency(int quantity) { menu->inv->removeCurrency(quantity); addMsg(msg->get("%d %s removed.", quantity, CURRENCY)); items->playSound(CURRENCY_ID); }
void runCmdSlice(void) { // get command from SD card if building from SD if (sdCardIsPlaying) /*{{{*/ { //printf("sdCardHasNextByte %d \r\n",sdCardHasNextByte); while (circleBufGetRemainCap(&cmdBuf) > 0 && sdCardHasNextByte) { sdByteCnt++; //printf("sdByteCnt %d \r\n",sdByteCnt); sdByte=sdCardPlaybackNext(); //printf("sdByte %d \r\n",sdByte); circleBufPush(&cmdBuf,sdByte); } if( !sdCardHasNextByte && circleBufIsEmpty(&cmdBuf)) { sdCardFinishPlayback(); //printf("执行sdCardFinishPlayback\r\n"); } }/*}}}*/ // get command from onboard script if building from onboard if(utilityIsPlaying())/*{{{*/ { while (circleBufGetRemainCap(&cmdBuf) > 0 && utilityPlaybackHasNext()) { circleBufPush(&cmdBuf,utilityPlaybackNext()); } if(!utilityPlaybackHasNext() && circleBufIsEmpty(&cmdBuf)) { utilityFinishPlayback(); } }/*}}}*/ // don't execute commands if paused or shutdown because of heater failure // 如果命令暂停或者 加热失败,则直接返回 if (cmdPaused || cmdHeatShutdown) { return; } if (cmdMode == HOMING) { if (!(motorIsRunning || motorIsHoming)) cmdMode = READY; else if (timeoutHasElapsed(&cmdHomingTimeout)) { motorAbort(); cmdMode = READY; } } if (cmdMode == MOVING) { if (!(motorIsRunning || motorIsHoming)) cmdMode = READY; } if (cmdMode == DELAY) { // check timers if (timeoutHasElapsed(&cmdDelayTimeout)) { cmdMode = READY; } } if (cmdMode == WAIT_ON_TOOL) /*{{{*/ { int i; if(timeoutHasElapsed(&cmdToolWaitTimeout)) { //Motherboard::getBoard().errorResponse("Extruder Timeout when attempting to heat"); printf("Extruder Timeout when attempting to heat"); showErrMsg("Extruder Timeout when attempting to heat"); cmdMode = READY; } else if(extruderHasReachedTargetTemp()) { cmdMode = READY; for(i=0;i<STEPPER_COUNT;i++) //呃,放在这里不好 axisSetEnablePin(i,true); } // if platform is done heating up, unpause the extruder heaters else if(platformHasReachedTargetTemp()) { extruderSetHeatPause(false); //平台温度达到,开始加热喷头 } }/*}}}*/ if (cmdMode == WAIT_ON_PLATFORM) /*{{{*/ { if(timeoutHasElapsed(&cmdToolWaitTimeout)) { // Motherboard::getBoard().errorResponse("Platform Timeout when attempting to heat"); printf("Platform Timeout when attempting to heat"); cmdMode = READY; } else if(platformHasReachedTargetTemp()) { extruderSetHeatPause(false); cmdMode = READY; } }/*}}}*/ if (cmdMode == WAIT_ON_BUTTON) /*{{{*/ { if (timeoutHasElapsed(&cmdBtnWaitTimeout)) { cmdMode = READY; } else { //cmdMode = READY; 由msgMenu去处理button } }/*}}}*/ if (cmdMode == READY) { int pt[STEPPER_COUNT];//toFix int32_t a ; int32_t b ; int32_t dda; uint8_t axes ; uint8_t i; // process next command on the queue. if (cmdBuf.length>0) { uint8_t command = *circleBufGetData(&cmdBuf,0);//command_buffer[0]; timeoutStart(&usrInputTimeout,usrInputTime); cmdCnt++; printf("c %6d ",cmdCnt); if (command == HOST_CMD_QUEUE_POINT_ABS) { // check for completion if (cmdBuf.length >= 17) { circleBufPop(&cmdBuf); // remove the command code cmdMode = MOVING; pt[0] = pop32(); pt[1] = pop32(); pt[2] = pop32(); dda = pop32(); motorSetTarget(pt,dda);//steppers::setTarget(Point(x,y,z),dda); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_QUEUE_POINT_ABS\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_QUEUE_POINT_ABS "); printf("%d %d %d %d\r\n",pt[0],pt[1],pt[2],dda); #endif } } else if (command == HOST_CMD_QUEUE_POINT_EXT) { // check for completion if (cmdBuf.length >= 25) { circleBufPop(&cmdBuf); // remove the command code cmdMode = MOVING; pt[0] = pop32(); pt[1]= pop32(); pt[2]= pop32(); pt[3]= pop32(); b= pop32(); dda = pop32(); motorSetTarget(pt,dda);//toFix //steppers::setTarget(Point(x,y,z,a,b),dda); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_QUEUE_POINT_EXT\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_QUEUE_POINT_EXT "); printf("%d %d %d %d %d\r\n",pt[0],pt[1],pt[2],pt[3],dda); #endif } } else if (command == HOST_CMD_QUEUE_POINT_NEW) { // check for completion if (cmdBuf.length >= 26) { uint8_t relative ; int32_t us; circleBufPop(&cmdBuf); // remove the command code cmdMode = MOVING; pt[0] = pop32(); pt[1]= pop32(); pt[2]= pop32(); // if(pt[0]>5000) // pt[0]=5000; // if(pt[0]<-5000) // pt[0]=-5000; // if(pt[1]>2000) // pt[1]=2000; // if(pt[1]<-2000) // pt[1]=-2000; #define PT2_THRESHOLD 5000 if(pt[2]>PT2_THRESHOLD) pt[2]=PT2_THRESHOLD; if(pt[2]<-PT2_THRESHOLD) pt[2]=-PT2_THRESHOLD; pt[3]= pop32(); b= pop32(); us = pop32(); relative = pop8(); motorSetTargetNew(pt,us,relative); //steppers::setTargetNew(Point(x,y,z,a,b),us,relative); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_QUEUE_POINT_NEW "); printf("%d %d %d %d %d %d\r\n",pt[0],pt[1],pt[2],pt[3],us,relative); #endif #ifdef Debug_Data_Cmd if(endStopFlagTmpDebug) printf("x\r\n"); LED_BLINK(1); printf("HOST_CMD_QUEUE_POINT_NEW "); printf("%d %d %d %d %d %d %d\r\n",pt[0],pt[1],pt[2],pt[3],us,relative,b); #endif } } else if (command == HOST_CMD_CHANGE_TOOL) { if (cmdBuf.length >= 2) { circleBufPop(&cmdBuf); // remove the command code currentToolIndex = circleBufPop(&cmdBuf); //toFix //steppers::changeToolIndex(currentToolIndex); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_CHANGE_TOOL\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_CHANGE_TOOL\r\n"); #endif } } else if (command == HOST_CMD_ENABLE_AXES) /*{{{*/ { if (cmdBuf.length >= 2) { bool enable; circleBufPop(&cmdBuf); // remove the command code axes = circleBufPop(&cmdBuf); enable = (axes & 0x80) != 0; for (i = 0; i < STEPPER_COUNT; i++) { if ((axes & (1<<i)) != 0) //steppers::enableAxis(i, enable); axisSetEnablePin(i,enable); } #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_ENABLE_AXES\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_ENABLE_AXES "); printf("%d\r\n",axes); #endif }/*}}}*/ } else if (command == HOST_CMD_SET_POSITION) { // check for completion if (cmdBuf.length >= 13) { circleBufPop(&cmdBuf); // remove the command code pt[0] = pop32(); pt[1]= pop32(); pt[2] = pop32();//toFix,motorDefinePosition 怎么知道pt有没有第四个参数,会怎么对pt[3]处理? //steppers::definePosition(Point(x,y,z)); motorDefinePosition(pt); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_SET_POSITION\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_SET_POSITION "); printf("%d %d %d\r\n",pt[0],pt[1],pt[2]); #endif } } else if (command == HOST_CMD_SET_POSITION_EXT) { // check for completion if (cmdBuf.length >= 21) { circleBufPop(&cmdBuf); // remove the command code pt[0] = pop32(); pt[1] = pop32(); pt[2] = pop32(); pt[3] = pop32(); //a = pop32(); b = pop32(); motorDefinePosition(pt);//toFix //steppers::definePosition(Point(x,y,z,a,b)); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_SET_POSITION_EXT\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_SET_POSITION_EXT "); printf("%d %d %d %d\r\n",pt[0],pt[1],pt[2],pt[3]); #endif } } else if (command == HOST_CMD_DELAY) { if (cmdBuf.length >= 5) { uint32_t microseconds ; cmdMode = DELAY; circleBufPop(&cmdBuf); // remove the command code // parameter is in milliseconds; timeouts need microseconds microseconds = pop32() * 1000; timeoutStart(&cmdDelayTimeout,microseconds);//delay_timeout.start(microseconds); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_DELAY\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_DELAY\r\n"); #endif } } else if (command == HOST_CMD_PAUSE_FOR_BUTTON) { if (cmdBuf.length >= 5) { uint16_t timeout_seconds; uint8_t button_mask; uint8_t button_timeout_behavior; circleBufPop(&cmdBuf); // remove the command code button_mask = circleBufPop(&cmdBuf); timeout_seconds = pop16(); button_timeout_behavior = circleBufPop(&cmdBuf); // cmdMode = WAIT_ON_BUTTON;//toFix #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_PAUSE_FOR_BUTTON\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_PAUSE_FOR_BUTTON\r\n"); #endif } } else if (command == HOST_CMD_DISPLAY_MESSAGE) { // MessageScreen* scr = Motherboard::getBoard().getMessageScreen(); if (cmdBuf.length >= 6) { uint8_t options ; uint8_t xpos ; uint8_t ypos ; uint8_t timeout_seconds; uint8_t idx=0; char msg[50]; circleBufPop(&cmdBuf); // remove the command code options = circleBufPop(&cmdBuf); xpos = circleBufPop(&cmdBuf); ypos = circleBufPop(&cmdBuf); timeout_seconds = circleBufPop(&cmdBuf); do { msg[idx++]=circleBufPop(&cmdBuf); }while(msg[idx-1]!='\0'); addMsg(msg,options,xpos,ypos); //timeoutStart(&cmdBtnWaitTimeout,300*1000000); timeoutInit(&cmdBtnWaitTimeout); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_DISPLAY_MESSAGE\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_DISPLAY_MESSAGE %d %d %d %s\r\n",options,xpos,ypos,msg); #endif } } else if (command == HOST_CMD_FIND_AXES_MINIMUM || command == HOST_CMD_FIND_AXES_MAXIMUM) { if (cmdBuf.length >= 8) { uint8_t flags ; uint32_t feedrate ; uint16_t timeout_s ; bool direction ; circleBufPop(&cmdBuf); // remove the command flags = pop8(); feedrate = pop32(); // feedrate in us per step timeout_s = pop16(); direction = command == HOST_CMD_FIND_AXES_MAXIMUM; cmdMode = HOMING; timeoutStart(&cmdHomingTimeout,timeout_s*1000L*1000L);//homing_timeout.start(timeout_s * 1000L * 1000L); // //timeoutStart(&cmdHomingTimeout,2*1000L*1000L);//homing_timeout.start(timeout_s * 1000L * 1000L); // //steppers::startHoming(command==HOST_CMD_FIND_AXES_MAXIMUM,flags,feedrate); motorStartHoming(command==HOST_CMD_FIND_AXES_MAXIMUM,flags,feedrate); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_FIND_AXES_MINIMUM \r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); if(command == HOST_CMD_FIND_AXES_MINIMUM) printf("HOST_CMD_FIND_AXES_MINIMUM %d %d %d\r\n",command,flags,feedrate); else printf("HOST_CMD_FIND_AXES_MAXIMUM %d %d %d\r\n",command,flags,feedrate); #endif } } else if (command == HOST_CMD_WAIT_FOR_TOOL) { if (cmdBuf.length >= 6) { uint16_t toolPingDelay ; uint16_t toolTimeout ; cmdMode = WAIT_ON_TOOL; circleBufPop(&cmdBuf); currentToolIndex = circleBufPop(&cmdBuf); toolPingDelay = (uint16_t)pop16(); toolTimeout = (uint16_t)pop16(); //tool_wait_timeout.start(toolTimeout*1000000L);//toFix #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_WAIT_FOR_TOOL\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_WAIT_FOR_TOOL\r\n"); #endif } } else if (command == HOST_CMD_WAIT_FOR_PLATFORM) { // FIXME: Almost equivalent to WAIT_FOR_TOOL if (cmdBuf.length >= 6) { uint8_t currentToolIndex ; uint16_t toolPingDelay ; uint16_t toolTimeout ; cmdMode = WAIT_ON_PLATFORM; circleBufPop(&cmdBuf); currentToolIndex = circleBufPop(&cmdBuf); toolPingDelay = (uint16_t)pop16(); toolTimeout = (uint16_t)pop16(); //tool_wait_timeout.start(toolTimeout*1000000L);//toFix #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_WAIT_FOR_PLATFORM\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_WAIT_FOR_PLATFORM\r\n"); #endif } } else if (command == HOST_CMD_STORE_HOME_POSITION) { // check for completion if (cmdBuf.length >= 2) { // uint16_t offset ; // uint32_t position ; circleBufPop(&cmdBuf); axes = pop8(); // Go through each axis, and if that axis is specified, read it's value, // then record it to the eeprom. // for (i = 0; i < STEPPER_COUNT; i++) // { // if ( axes & (1 << i) ) // { // offset = eeprom_offsets::AXIS_HOME_POSITIONS + 4*i; // position = steppers::getPosition()[i]; // cli(); // eeprom_write_block(&position, (void*) offset, 4); // sei(); // } // } #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_STORE_HOME_POSITION\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_STORE_HOME_POSITION\r\n"); #endif } } else if (command == HOST_CMD_RECALL_HOME_POSITION) { // check for completion if (cmdBuf.length >= 2) { //uint16_t offset ; circleBufPop(&cmdBuf); axes = pop8(); //pt[0]=0; //pt[1]=3000; //pt[2]=0; //pt[3]=0; // pt[0]=12000; // pt[1]=9000; pt[0]=9000; pt[1]=6000; pt[2]=0; pt[3]=0; motorDefinePosition(pt); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_RECALL_HOME_POSITION\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_RECALL_HOME_POSITION\r\n"); #endif } }else if (command == HOST_CMD_SET_POT_VALUE) { if (cmdBuf.length >= 2) { uint8_t axis ; uint8_t value ; circleBufPop(&cmdBuf); // remove the command code axis = pop8(); value = pop8(); // steppers::setAxisPotValue(axis, value); // steppers::setAxisPotValue(axis, value); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_SET_POT_VALUE\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_SET_POT_VALUE\r\n"); #endif } }else if (command == HOST_CMD_SET_RGB_LED) { if (cmdBuf.length >= 2) { uint8_t red ; uint8_t green ; uint8_t blue ; uint8_t blink_rate ; uint8_t effect; circleBufPop(&cmdBuf); // remove the command code red = pop8(); green = pop8(); blue = pop8(); blink_rate = pop8(); effect = pop8(); //RGB_LED::setLEDBlink(blink_rate); //RGB_LED::setCustomColor(red, green, blue); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_SET_RGB_LED\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_SET_RGB_LED\r\n"); #endif } }else if (command == HOST_CMD_SET_BEEP) { if (cmdBuf.length >= 2) { uint8_t frequency; uint8_t beep_length ; uint8_t effect ; circleBufPop(&cmdBuf); // remove the command code frequency= pop16(); beep_length = pop16(); effect = pop8(); //Piezo::setTone(frequency, beep_length); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_SET_BEEP\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_SET_BEEP\r\n"); #endif } }else if (command == HOST_CMD_TOOL_COMMAND) { if (cmdBuf.length >= 4) { // needs a payload uint8_t payload_length =*circleBufGetData(&cmdBuf,3);// command_buffer[3]; if (cmdBuf.length >= 4+payload_length) { circleBufPop(&cmdBuf); // remove the command code processExtruderCommandPacket(); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_TOOL_COMMAND\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_TOOL_COMMAND\r\n"); #endif } } } else if (command == HOST_CMD_SET_BUILD_PERCENT) { if (cmdBuf.length >= 2) { uint8_t percent ; uint8_t ignore ; circleBufPop(&cmdBuf); // remove the command code percent = pop8(); ignore = pop8(); // remove the reserved byte //interface::setBuildPercentage(percent); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_SET_BUILD_PERCENT\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_SET_BUILD_PERCENT\r\n"); #endif } } else if (command == HOST_CMD_QUEUE_SONG ) //queue a song for playing { /// Error tone is 0, /// End tone is 1, /// all other tones user-defined (defaults to end-tone) if (cmdBuf.length >= 2) { uint8_t songId; circleBufPop(&cmdBuf); // remove the command code songId = pop8(); // if(songId == 0) // Piezo::errorTone(4); // else if (songId == 1 ) // Piezo::doneTone(); // else // Piezo::errorTone(2); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_QUEUE_SONG \r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_QUEUE_SONG \r\n"); #endif } } else if ( command == HOST_CMD_RESET_TO_FACTORY) { /// reset EEPROM settings to the factory value. Reboot bot. if (cmdBuf.length >= 1) { uint8_t options ; circleBufPop(&cmdBuf); // remove the command code options = pop8(); //eeprom::factoryResetEEPROM(); //Motherboard::getBoard().reset(false); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_RESET_TO_FACTORY\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_RESET_TO_FACTORY\r\n"); #endif } } else if ( command == HOST_CMD_BUILD_START_NOTIFICATION) { if (cmdBuf.length >= 1) { int buildSteps ; circleBufPop(&cmdBuf); // remove the command code buildSteps = pop32(); hostHandleBuildStartNotification(&cmdBuf); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_BUILD_START_NOTIFICATION\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_BUILD_START_NOTIFICATION\r\n"); #endif } } else if ( command == HOST_CMD_BUILD_END_NOTIFICATION) { if (cmdBuf.length >= 1) { uint8_t flags ; circleBufPop(&cmdBuf); // remove the command code flags = circleBufPop(&cmdBuf); hostHandleBuildStopNotification(flags); #ifdef Debug_Cmd LED_BLINK(1); printf("HOST_CMD_BUILD_END_NOTIFICATION\r\n"); #endif #ifdef Debug_Data_Cmd LED_BLINK(1); printf("HOST_CMD_BUILD_END_NOTIFICATION\r\n"); #endif } } else { //错误指令,或者指令 已经乱了,或未知指令,直接pop? printf("error instruct; %d\r\n",command); circleBufPop(&cmdBuf); // remove the command code LED_BLINK(1); } } else cmdPaused=true; //printf("current cmd count: %d\r\n",cmdCnt); //printf("%d %d %d %d\r\n",LastCntIntr2OnceStepTmp[0],LastCntIntr2OnceStepTmp[1],LastCntIntr2OnceStepTmp[2],LastCntIntr2OnceStepTmp[3]); } }
iARenderer::iARenderer(QObject *par) : QObject( par ), interactor(0), renderObserver(0), m_SlicePlaneOpacity(0.8) { renWin = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New(); // TODO: move out of here? renWin->AlphaBitPlanesOn(); renWin->LineSmoothingOn(); renWin->PointSmoothingOn(); cam = vtkSmartPointer<vtkCamera>::New(); cSource = vtkSmartPointer<vtkCubeSource>::New(); cMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); cActor = vtkSmartPointer<vtkActor>::New(); logoRep = vtkSmartPointer<vtkLogoRepresentation>::New(); logoWidget = vtkSmartPointer<vtkLogoWidget>::New(); logoImage = vtkSmartPointer<vtkQImageToImageSource>::New(); labelRen = vtkSmartPointer<vtkOpenGLRenderer>::New(); ren = vtkSmartPointer<vtkOpenGLRenderer>::New(); polyMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); polyActor = vtkSmartPointer<vtkActor>::New(); annotatedCubeActor = vtkSmartPointer<vtkAnnotatedCubeActor>::New(); axesActor = vtkSmartPointer<vtkAxesActor>::New(); moveableAxesActor = vtkSmartPointer<vtkAxesActor>::New(); orientationMarkerWidget = vtkSmartPointer<vtkOrientationMarkerWidget>::New(); plane1 = vtkSmartPointer<vtkPlane>::New(); plane2 = vtkSmartPointer<vtkPlane>::New(); plane3 = vtkSmartPointer<vtkPlane>::New(); m_slicingCube = vtkSmartPointer<vtkCubeSource>::New(); m_sliceCubeMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); m_sliceCubeActor = vtkSmartPointer<vtkActor>::New(); txtActor = vtkSmartPointer<vtkTextActor>::New(); txtActor->SetInput("Selection mode"); txtActor->GetTextProperty()->SetFontSize(24); txtActor->GetTextProperty()->SetColor(1.0, 0.0, 0.0); txtActor->GetTextProperty()->SetJustificationToLeft(); txtActor->GetTextProperty()->SetVerticalJustificationToBottom(); txtActor->VisibilityOff(); cellLocator = vtkSmartPointer<vtkCellLocator>::New(); m_profileLineSource = vtkSmartPointer<vtkLineSource>::New(); m_profileLineMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); m_profileLineActor = vtkSmartPointer<vtkActor>::New(); m_profileLineStartPointSource = vtkSmartPointer<vtkSphereSource>::New(); m_profileLineStartPointMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); m_profileLineStartPointActor = vtkSmartPointer<vtkActor>::New(); m_profileLineEndPointSource = vtkSmartPointer<vtkSphereSource>::New(); m_profileLineEndPointMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); m_profileLineEndPointActor = vtkSmartPointer<vtkActor>::New(); for (int s = 0; s < 3; ++s) { m_slicePlaneSource[s] = vtkSmartPointer<vtkPlaneSource>::New(); m_slicePlaneMapper[s] = vtkSmartPointer<vtkPolyDataMapper>::New(); m_slicePlaneActor[s] = vtkSmartPointer<vtkActor>::New(); m_slicePlaneActor[s]->GetProperty()->LightingOff(); } MdiChild * mdi_parent = dynamic_cast<MdiChild*>(this->parent()); if (mdi_parent) { connect(this, SIGNAL(msg(QString)), mdi_parent, SLOT(addMsg(QString))); connect(this, SIGNAL(progress(int)), mdi_parent, SLOT(updateProgressBar(int))); } }
void Control :: connectMsg() { addMsg(MSG_FINISH, this, "clear"); addMsg(MSG_ADD_UNIT, this, "add"); addMsg(MSG_ADD_SCRIPT, this, "addScript"); }
void IntrospectionOnlineReader::introspectionCB(const IntrospectionMsgConstPtr &msg) { addMsg(msg); read_messages_.push_back(*msg.get()); }
Project * App::CreateNewProject(const BMessage &settings) { Project *proj = NULL; BString projectName, targetName, projectPath, templateName, pldName; int32 projectType, scmType; bool createFolder, populateProject = true; settings.FindString("name",&projectName); settings.FindString("target",&targetName); settings.FindInt32("type",&projectType); settings.FindString("path",&projectPath); settings.FindInt32("scmtype", &scmType); settings.FindBool("createfolder",&createFolder); settings.FindString("template", &templateName); settings.FindString("pldfile", &pldName); if (templateName.CountChars() > 0) { // Templates are now a directory with a TEMPLATEINFO file. All files in the // directory are copies, allowing for much greater flexibility than before. BString projectFileName(projectName); projectFileName << ".pld"; DPath templatePath(gAppPath.GetFolder()); templatePath << "Templates" << templateName; // Copy the contents of the chosen template folder to the project path DPath sourcePath(templatePath); DPath destPath(gProjectPath); if (createFolder) { destPath << projectName; create_directory(destPath.GetFullPath(), 0700); } BString wildcard("'"); wildcard << sourcePath.GetFullPath() << "'/*"; ShellHelper shell("cp -a "); shell << wildcard; shell.AddQuotedArg(destPath.GetFullPath()); shell.Run(); // The copy command copies *everything*, so we have to delete the // TEMPLATEINFO file. DPath templateInfo(destPath); templateInfo << "TEMPLATEINFO"; BEntry infoEntry(templateInfo.GetFullPath()); infoEntry.Remove(); infoEntry.Unset(); DPath finalPath; // Load project and set info or create one, if needed. // If the settings contain the name of a .pld project file, we'll search // for that first. Assuming that it exists, we'll rename that file to the // project name specified. If it doesn't exist or the .pld name is empty, // we'll create a new project with the appropriate name. // The pldname field comes from the TEMPLATEINFO file, which can designate // the main project file in a template. This allows a template to have // multiple project files, such as for the Tracker Add-on development framework // which has both a project file for generating the actual addon and another // one which is the testing framework. bool createProjFile = true; if (pldName.CountChars() > 0) { // If a .pld project file was specified in TEMPLATEINFO, check to see if // the file exists and rename it. If it doesn't exist, we'll create a new // file, and if a .pld file already exists with the intended name, we won't // do anything except tell the user what's happened. DPath oldPldNamePath(destPath); oldPldNamePath << pldName; BEntry oldPldNameEntry(oldPldNamePath.GetFullPath()); DPath newPldNamePath(destPath); newPldNamePath << projectFileName; BEntry newPldNameEntry(newPldNamePath.GetFullPath()); if (newPldNameEntry.Exists()) { // createProjFile is false here only if there is a .pld file with the // user's chosen project name. If that is the case, we keep both files and // let the user sort it out. BString errMsg = B_TRANSLATE( "Project file '%projectname%.pld' already exists. The " "original file for this template is '%pldname%'. You'll need " "to open the project folder and figure out which one you wish to keep."); errMsg.ReplaceFirst("%projectname%", projectName); errMsg.ReplaceFirst("%pldname%", pldName); ShowAlert(errMsg); populateProject = createProjFile = false; finalPath = newPldNamePath; } else if (oldPldNameEntry.Exists()) { oldPldNameEntry.Rename(projectFileName.String()); populateProject = createProjFile = false; finalPath = newPldNamePath; } } if (createProjFile) { proj = Project::CreateProject(projectName.String(), targetName.String(), projectType, projectPath.String(), createFolder); if (proj) finalPath = proj->GetPath(); } else { proj = new Project(); if (proj->Load(finalPath.GetFullPath()) != B_OK) { delete proj; return NULL; } } } else { // This case is for stuff like the Quick Import feature proj = Project::CreateProject(projectName.String(), targetName.String(), projectType, projectPath.String(), createFolder); } if (!proj) return NULL; scm_t detectedSCM = DetectSCM(projectPath); proj->SetSourceControl(detectedSCM == SCM_NONE ? (scm_t)scmType : detectedSCM); gCurrentProject = proj; gProjectList->Lock(); gProjectList->AddItem(proj); gProjectList->Unlock(); BRect r(0,0,200,300); /* r.OffsetTo(gProjectWindowPoint); gProjectWindowPoint.x += 25; gProjectWindowPoint.y += 25; if (gProjectWindowPoint.x < 0) gProjectWindowPoint.x = 0; if (gProjectWindowPoint.y < 0) gProjectWindowPoint.y - 0; */ ProjectWindow *projwin = new ProjectWindow(r,gCurrentProject); projwin->Show(); BEntry entry(gCurrentProject->GetPath().GetFullPath()); if (entry.InitCheck() == B_OK) { entry_ref newprojref; entry.GetRef(&newprojref); UpdateRecentItems(newprojref); } if (populateProject) { entry_ref addRef; int32 i = 0; while (settings.FindRef("libs",i++,&addRef) == B_OK) { if (BEntry(&addRef).Exists()) proj->AddLibrary(DPath(addRef).GetFullPath()); } i = 0; BMessage addMsg(M_IMPORT_REFS); while (settings.FindRef("refs",i++,&addRef) == B_OK) addMsg.AddRef("refs",&addRef); PostToProjectWindow(&addMsg,NULL); } return proj; }
void CampaignManager::rewardCurrency(int amount) { *currency += amount; addMsg(msg->get("reward_currency", amount)); items->playCoinsSound(); }
void CampaignManager::rewardXP(int amount) { *xp += amount; addMsg(msg->get("reward_xp", amount)); }
int main(int argc, char *argv[]) { int sockfd, numbytes; char buf[MAXDATASIZE]; struct addrinfo hints, *servinfo, *p; int rv; char s[INET6_ADDRSTRLEN]; PACKET tempPacket; if (argc != 3) { fprintf(stderr,"usage: client [hostname] [mnemonic name]\n"); exit(1); } memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; if ((rv = getaddrinfo(argv[1], PORT, &hints, &servinfo)) != 0) { fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv)); return 1; } // loop through all the results and connect to the first we can for(p = servinfo; p != NULL; p = p->ai_next) { if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) { perror("client: socket"); continue; } if (connect(sockfd, p->ai_addr, p->ai_addrlen) == -1) { close(sockfd); perror("client: connect"); continue; } break; } if (p == NULL) { fprintf(stderr, "client: failed to connect\n"); return 2; } inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), s, sizeof s); printf("client: connecting to %s\n", s); freeaddrinfo(servinfo); // all done with this structure //send reg generatePacket(&tempPacket, MSG_HEAD_REG, getpid(), argv[2]); if (send(sockfd, (void*)&tempPacket, sizeof(tempPacket), 0) == -1) perror("send"); //recv reg_ack if ((numbytes = recv(sockfd, (void*)&tempPacket, sizeof(tempPacket), 0)) == -1) { perror("recv"); exit(1); } if (tempPacket.packet_head.type==MSG_HEAD_REG_ACK) { printf("client(%d): received ACK for reg from server(%d)\n",getpid(),tempPacket.packet_head.sender_pid); } printf("Press any key to send msg: 'Hello Server!'"); getchar(); //Send msg generatePacket(&tempPacket, MSG_HEAD_NORMAL, getpid(), argv[2]); addMsg(&tempPacket,"Hello Server!"); if (send(sockfd, (void*)&tempPacket, sizeof(tempPacket), 0) == -1) perror("send"); //recv msg_ack if ((numbytes = recv(sockfd, (void*)&tempPacket, sizeof(tempPacket), 0)) == -1) { perror("recv"); exit(1); } if (tempPacket.packet_head.type==MSG_HEAD_NORMAL_ACK) { printf("client(%d): received ACK for msg from server(%d)\n",getpid(),tempPacket.packet_head.sender_pid); } printf("Press any key to deregister."); getchar(); //send dereg generatePacket(&tempPacket, MSG_HEAD_DEREG, getpid(), argv[2]); if (send(sockfd, (void*)&tempPacket, sizeof(tempPacket), 0) == -1) perror("send"); //recv dereg_ack if ((numbytes = recv(sockfd, (void*)&tempPacket, sizeof(tempPacket), 0)) == -1) { perror("recv"); exit(1); } if (tempPacket.packet_head.type==MSG_HEAD_DEREG_ACK) { printf("client(%d): received ACK for dereg from server(%d)\n",getpid(),tempPacket.packet_head.sender_pid); } close(sockfd); return 0; }
void Physics :: connectMsg() { addMsg(MSG_FINISH, this, "clear"); addMsg(MSG_ADD_UNIT, this, "add"); }