void detectKeys() { unsigned int *playerBottom[3] = {&g_worldGrid[charLocation.X][charLocation.Y],&g_worldGrid[charLocation.X - 1][charLocation.Y],&g_worldGrid[charLocation.X + 1][charLocation.Y]}; for( unsigned int w =0 ; w<3 ; ++w) { if(*playerBottom[w]== '4') { if (inventoryManagement("Red Key", 1)) { *playerBottom[w] = ' '; printMessages("You have picked up a Red Key!"); } playMusic(2); } else if(*playerBottom[w] == '5') { if (inventoryManagement("Blue Key", 1)) { *playerBottom[w] = ' '; printMessages("You have picked up a Blue Key!"); } playMusic(2); } else if(*playerBottom[w] == '6') { if (inventoryManagement("Green Key", 1)) { *playerBottom[w] = ' '; printMessages("You have picked up a Green Key!"); } playMusic(2); } } }
//displays either the wall page or the home page for the specified user void Page::displayPage(User& user, string pageType) { string welcome, prompt = "\r\n\n\t\tView all messages? (y/n): ", error = "Invalid option. Please choose 'y' or 'n'.", choice; bool valid = false; //set welcome message text welcome = "\r\n\n====================================================="; welcome += "\r\n " + user.getName() + "'s " + pageType + " Page"; welcome += "\r\n====================================================="; //print welcome message cout << welcome; //Initialize message display counter to zero messageCount = 0; //Initialize index pointer to beginning of first username. currentIndex = 1; //print up to DEFAULT_LIM messages printMessages(user, pageType, DEFAULT_LIM); //if more messages exist, print prompt for //printing remaining messages if (messageCount == DEFAULT_LIM && currentIndex < messageBuffer.size()) { //prompt until user enters valid response while (!valid) { cout << prompt; cin >> choice; switch (choice.at(0)) { //accept capital or lowercase case 'Y': case 'y': valid = true; choice = "y"; break; case 'N': case 'n': valid = true; break; default: cout << error; break; } } //if yes, print remaining messages if (choice.compare("y") == 0) { //pass 0 as new limit, so that the counter will //not stop the printing by hitting the limit printMessages(user, pageType, 0); } } }
CannonState::CannonState() { zoomState zoom; BOOL ok; idle=true; panningLeft=false; panningRight=false; checkedAngle=false; toMoveToExactLocation=false; move=false; ratio=1.2; tilt=0x8070; nextLocation=-1; ok=V4Open(a, 1L, 9600L,8L, 0L,0L); ok=ok && V4SetCmdMode(0L,0L); ok=ok && V4SetNotify(0,1); commandWait(2); ok=ok && V4SetCameraPower(0L,1L); commandWait(4); ok=ok && V4SetMotorSpeed(0L,0L,150L); commandWait(5); ok=ok && V4PedestalInitialize(0,0); commandWait(7); commandNumber=7; printMessages(); }
int main() { ServerMsgLexer lexer; char buffer[4096]; int readValue; try { do { readValue = read(STDIN_FILENO, &buffer, sizeof(buffer)); if (READ_ERROR(readValue)) { perror("read"); break; } else if (READ_EOF(readValue)) { printf("[EOF]\n"); break; } else { lexer.putNewData(buffer, readValue); printMessages(lexer); } } while (1); } catch(Exception& ex) { printf("Exception: %s\n", ex.toString()); } return 0; }
int main() { Smr::initSmr(false); logger.setLogLevel(TRACE_LOG_LEVEL); cout << "*** calling printMessages() with TRACE set: ***" << endl; printMessages(); logger.setLogLevel(DEBUG_LOG_LEVEL); cout << "\n*** calling printMessages() with DEBUG set: ***" << endl; printMessages(); logger.setLogLevel(INFO_LOG_LEVEL); cout << "\n*** calling printMessages() with INFO set: ***" << endl; printMessages(); logger.setLogLevel(WARN_LOG_LEVEL); cout << "\n*** calling printMessages() with WARN set: ***" << endl; printMessages(); logger.setLogLevel(ERROR_LOG_LEVEL); cout << "\n*** calling printMessages() with ERROR set: ***" << endl; printMessages(); logger.setLogLevel(FATAL_LOG_LEVEL); cout << "\n*** calling printMessages() with FATAL set: ***" << endl; printMessages(); return 0; }