--- a/src/demo.cpp Sat Jun 06 22:18:30 2015 +0300 +++ b/src/demo.cpp Sat Jun 06 22:20:21 2015 +0300 @@ -34,21 +34,21 @@ // TODO: Handle long-form colors like \c[Red] QString out; int skip = 0; - + for (QChar c : in) { if (skip-- > 0) continue; - + if (c == QChar ('\034')) { skip = 1; continue; } - + out += c; } - + return out; } @@ -117,11 +117,11 @@ { QString fullpath = QString ("%1/%2").arg (wadpaths[i]).arg (name); QFile f (fullpath); - + if (f.exists()) return fullpath; } - + return ""; } @@ -172,16 +172,16 @@ int launchDemo (QString path) { QFile f (path); - + if (not f.open (QIODevice::ReadOnly)) { error (tr ("Couldn't open '%1' for reading: %2").arg (path).arg (strerror (errno))); return 1; } - + QDataStream stream (&f); stream.setByteOrder (QDataStream::LittleEndian); - + DemoHeaders headers; uint32 length; uint16 zanversionID, numWads; @@ -217,13 +217,13 @@ headers.userInfo = headers.length + 3, headers.bodyStart = headers.length + 4; headers.wads = headers.length + 10; - + // Read the demo header and get data for (;;) { uint8 header; stream >> header; - + if (header == headers.bodyStart) { ready = true; @@ -266,13 +266,13 @@ { QString sink; stream >> numWads; - + for (uint8 i = 0; i < numWads; ++i) { QString wad = readString (stream); wads << wad; } - + // The demo has two checksum strings. We're not interested in them, though. (sink = readString (stream)) = readString (stream); } @@ -298,10 +298,10 @@ if (not prompt->exec()) return 1; } - + QString iwadpath; QStringList pwadpaths; - + // Find the WADs for (const QString& wad : wads) { @@ -311,7 +311,7 @@ // so we need to test that too. if (path.isEmpty()) path = findWAD (wad.toUpper()); - + if (path.isEmpty()) { error (tr ("Couldn't find %1!").arg (wad)); @@ -323,22 +323,22 @@ else pwadpaths << path; } - + if (not Config::get ("noprompt").toBool()) { QString pwadtext; - + for (const QString& wad : wads) { if (&wad == &wads.first()) continue; // skip the IWAD - + if (not pwadtext.isEmpty()) pwadtext += "<br />"; - + pwadtext += wad; } - + QDialog* dlg = new QDialog; Ui_DemoPrompt ui; ui.setupUi (dlg); @@ -348,7 +348,7 @@ ui.iwadLabel->setText (wads[0]); ui.pwadsLabel->setText (pwadtext); dlg->setWindowTitle (versionSignature()); - + if (not dlg->exec()) return 0; }