void FindRoomsDlg::findClicked() { // Release rooms for a new search if (m_admin != NULL) m_mapData->unselect(m_roomSelection); m_roomSelection = m_mapData->select(); Qt::CaseSensitivity cs = caseCheckBox->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive; QString text = lineEdit->text(); // remove latin1 text = latinToAscii(text); resultTable->clear(); roomsFoundLabel->clear(); /* for an absolute match do the below: m_mapData->lookingForRooms(this, createEvent(CID_UNKNOWN, text, nullString, nullString, 0, 0)); */ if (nameRadioButton->isChecked()) m_mapData->searchNames(this, text, cs); else if (descRadioButton->isChecked()) m_mapData->searchDescriptions(this, text, cs); else if (exitsRadioButton->isChecked()) m_mapData->searchDoorNames(this, text, cs); else if (notesRadioButton->isChecked()) m_mapData->searchNotes(this, text, cs); }
void Parser::parseNewMudInput(IncomingData& data /*TelnetIncomingDataQueue& que*/) { bool staticLine = false; bool dontSendToUser = false; /*IncomingData data; bool staticLine; while ( !que.isEmpty() ) { data = que.dequeue(); */ //dline = (quint8 *)data.line.data(); switch (data.type) { case TDT_DELAY: case TDT_MENU_PROMPT: case TDT_LOGIN: case TDT_LOGIN_PASSWORD: case TDT_TELNET: case TDT_SPLIT: case TDT_UNKNOWN: #ifdef PARSER_STREAM_DEBUG_INPUT_TO_FILE (*debugStream) << "***STYPE***"; (*debugStream) << "Other"; (*debugStream) << "***ETYPE***"; #endif emit sendToUser(data.line); break; case TDT_PROMPT: #ifdef PARSER_STREAM_DEBUG_INPUT_TO_FILE (*debugStream) << "***STYPE***"; (*debugStream) << "Prompt"; (*debugStream) << "***ETYPE***"; #endif m_stringBuffer = QString::fromAscii(data.line.constData(), data.line.size()); m_stringBuffer = m_stringBuffer.simplified(); latinToAscii(m_stringBuffer); if (m_readingRoomDesc) { m_readingRoomDesc = false; // we finished read desc mode m_descriptionReady = true; if (m_examine) m_examine = false; // stop showing bypassing brief-mode } if (m_descriptionReady) { m_descriptionReady = false; parsePrompt(m_stringBuffer); if (!queue.isEmpty()) { CommandIdType c = queue.dequeue(); if ( c != CID_SCOUT ){ //qDebug("%s",m_roomName.toAscii().data()); //qDebug("%s",m_dynamicRoomDesc.toAscii().data()); emit showPath(queue, false); characterMoved(c, m_roomName, m_dynamicRoomDesc, m_staticRoomDesc, m_exitsFlags, m_promptFlags); } //additional scout move needs to be removed when scout was successful else queue.dequeue(); } else { //qDebug("%s",m_roomName.toAscii().data()); //qDebug("%s",m_dynamicRoomDesc.toAscii().data()); emit showPath(queue, false); characterMoved(CID_NONE, m_roomName, m_dynamicRoomDesc, m_staticRoomDesc, m_exitsFlags, m_promptFlags); } } emit sendToUser(data.line); break; case TDT_CRLF: #ifdef PARSER_STREAM_DEBUG_INPUT_TO_FILE (*debugStream) << "***STYPE***"; (*debugStream) << "CRLF"; (*debugStream) << "***ETYPE***"; #endif if (data.line.contains("null)>")) break; m_stringBuffer = QString::fromAscii(data.line.constData(), data.line.size()); m_stringBuffer = m_stringBuffer.simplified(); latinToAscii(m_stringBuffer); if (m_readingRoomDesc) { if (isEndOfRoomDescription(m_stringBuffer)) // standard end of description parsed { m_readingRoomDesc = false; // we finished read desc mode m_descriptionReady = true; dontSendToUser = true; } else if (m_stringBuffer.isEmpty()) // standard end of description parsed { m_readingRoomDesc = false; // we finished read desc mode m_descriptionReady = true; if (Config().m_emulatedExits) emulateExits(); } else // reading room description line { switch(Config().m_roomDescriptionsParserType) { case Configuration::RDPT_COLOR: if ((m_readingStaticDescLines == true) && isStaticRoomDescriptionLine(m_stringBuffer)) { staticLine = true; m_staticRoomDesc += m_stringBuffer+"\n"; } else { m_readingStaticDescLines = false; m_dynamicRoomDesc += m_stringBuffer+"\n"; } m_roomDescLines++; break; case Configuration::RDPT_PARSER: if ((m_roomDescLines >= Config().m_minimumStaticLines) && ((m_readingStaticDescLines == false) || Patterns::matchDynamicDescriptionPatterns(m_stringBuffer))) { m_readingStaticDescLines = false; m_dynamicRoomDesc += m_stringBuffer+"\n"; } else { staticLine = true; m_staticRoomDesc += m_stringBuffer+"\n"; } m_roomDescLines++; break; case Configuration::RDPT_LINEBREAK: m_dynamicRoomDesc += m_stringBuffer+"\n"; m_roomDescLines++; break; } } } else if (!m_readingRoomDesc && m_descriptionReady) //read betwen Exits and Prompt (track for example) { if ( isRoomName(m_stringBuffer) ) //Room name arrived { if (m_descriptionReady) { m_descriptionReady = false; if (!queue.isEmpty()) { CommandIdType c = queue.dequeue(); if ( c != CID_SCOUT ){ emit showPath(queue, false); characterMoved(c, m_roomName, m_dynamicRoomDesc, m_staticRoomDesc, m_exitsFlags, m_promptFlags); } //additional scout move needs to be removed when scout was successful else queue.dequeue(); } else { emit showPath(queue, false); characterMoved(CID_NONE, m_roomName, m_dynamicRoomDesc, m_staticRoomDesc, m_exitsFlags, m_promptFlags); } } m_readingRoomDesc = true; //start of read desc mode m_descriptionReady = false; m_roomName=m_stringBuffer; m_dynamicRoomDesc=nullString; m_staticRoomDesc=nullString; m_roomDescLines = 0; m_readingStaticDescLines = true; m_exitsFlags = 0; } else if (!m_stringBuffer.isEmpty()) parseMudCommands(m_stringBuffer); } else if ( isRoomName(m_stringBuffer) ) //Room name arrived { if (m_descriptionReady) { m_descriptionReady = false; if (!queue.isEmpty()) { CommandIdType c = queue.dequeue(); if ( c != CID_SCOUT ){ emit showPath(queue, false); characterMoved(c, m_roomName, m_dynamicRoomDesc, m_staticRoomDesc, m_exitsFlags, m_promptFlags); } //additional scout move needs to be removed when scout was successful else queue.dequeue(); } else { emit showPath(queue, false); characterMoved(CID_NONE, m_roomName, m_dynamicRoomDesc, m_staticRoomDesc, m_exitsFlags, m_promptFlags); } } m_readingRoomDesc = true; //start of read desc mode m_descriptionReady = false; m_roomName=m_stringBuffer; m_dynamicRoomDesc=nullString; m_staticRoomDesc=nullString; m_roomDescLines = 0; m_readingStaticDescLines = true; m_exitsFlags = 0; } else if (!m_stringBuffer.isEmpty() && Patterns::matchNoDescriptionPatterns(m_stringBuffer)) // non standard end of description parsed (fog, dark or so ...) { m_readingRoomDesc = false; // we finished read desc mode m_descriptionReady = true; m_roomName=nullString; m_dynamicRoomDesc=nullString; m_staticRoomDesc=nullString; m_roomDescLines = 0; m_readingStaticDescLines = false; m_exitsFlags = 0; m_promptFlags = 0; } else // parse standard input (answers) from server { //str=removeAnsiMarks(m_stringBuffer); if (!m_stringBuffer.isEmpty()) parseMudCommands(m_stringBuffer); } if (!dontSendToUser && !(staticLine && (m_examine || Config().m_brief))) emit sendToUser(data.line); break; case TDT_LFCR: #ifdef PARSER_STREAM_DEBUG_INPUT_TO_FILE (*debugStream) << "***STYPE***"; (*debugStream) << "LFCR"; (*debugStream) << "***ETYPE***"; #endif m_stringBuffer = QString::fromAscii(data.line.constData(), data.line.size()); m_stringBuffer = m_stringBuffer.simplified(); latinToAscii(m_stringBuffer); if (m_readingRoomDesc && (Config().m_roomDescriptionsParserType == Configuration::RDPT_LINEBREAK) ) { staticLine = true; m_staticRoomDesc += m_stringBuffer+"\n"; m_roomDescLines++; } if (!(staticLine && (m_examine || Config().m_brief))) emit sendToUser(data.line); break; case TDT_LF: #ifdef PARSER_STREAM_DEBUG_INPUT_TO_FILE (*debugStream) << "***STYPE***"; (*debugStream) << "LF"; (*debugStream) << "***ETYPE***"; #endif m_stringBuffer = QString::fromAscii(data.line.constData(), data.line.size()); emit sendToUser(data.line); break; } #ifdef PARSER_STREAM_DEBUG_INPUT_TO_FILE (*debugStream) << "***S***"; (*debugStream) << data.line; (*debugStream) << "***E***"; #endif //} }
void CEngine::parseEvent() { print_debug(DEBUG_ANALYZER, "in parseEvent()"); if (event.movementBlocker) { // notify renderer to remove all the unnecessary line drawn commandQueue.dequeue(); toggle_renderer_reaction(); return; } if (event.name != "") { print_debug(DEBUG_ANALYZER, "Converting Room Name to ascii format"); latinToAscii( event.name); last_name = event.name; } if (event.desc != "") { print_debug(DEBUG_ANALYZER, "Converting Description to ascii format"); latinToAscii( event.desc ); last_desc = event.desc; } if (event.exits != "") { last_exits = event.exits; } if (event.terrain != -1) { last_terrain = event.terrain; } setMgoto( false ); /* if we get a new room data incoming, mgoto has to go away */ print_debug(DEBUG_ANALYZER, "Entering the main part of the function"); print_debug(DEBUG_ANALYZER, "ANALYZER Event. \r\nNAME %s\r\nDESC %s\r\nEXITS %s\r\nBLIND %i, MOVEMENT %i SCOUT %i", (const char *) event.name, (const char *) event.desc, (const char *) event.exits /*(const char *) event.prompt*/, event.blind, event.movement, event.scout); if (event.scout) { print_debug(DEBUG_ANALYZER, "SCOUT flag is set. Dropping event"); return; } if (event.name.indexOf("It is pitch black...") == 0) { print_debug(DEBUG_ANALYZER, "NO light BLIND set"); event.blind = true; } if (event.name == "" && event.movement == true) { print_debug(DEBUG_ANALYZER, "NAME is empty and Movement is true. Assuming BLIND"); event.blind = true; } if (event.name == "" && event.blind == false) { print_debug(DEBUG_ANALYZER, "EMPTY name and no blind set. Assuming addedroom-data update incoming."); if (addedroom) { addedroom->setTerrain(last_terrain); resetAddedRoomVar(); toggle_renderer_reaction(); } return; } if (event.movement == true) { last_movement = event.dir; if (event.dir =="") { tryAllDirs(); // command's queue is useless then, no? commandQueue.clear(); } else { tryDir(); } } else { if (event.name != "") tryLook(); } swap(); if (stacker.amount() == 0) resync(); print_debug(DEBUG_ANALYZER, "Done. Sending an event to the Renderer"); toggle_renderer_reaction(); }
void MMapperPluginParser::description(const QString &text) { m_staticRoomDesc = QString(text).remove(QChar('\r')); latinToAscii(m_staticRoomDesc); }