Skip to content

Commit

Permalink
Add UTF-16 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mdimura committed Feb 25, 2021
1 parent e7c9efe commit a4022d0
Show file tree
Hide file tree
Showing 5 changed files with 696 additions and 607 deletions.
20 changes: 18 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,29 @@ build-win32:
paths:
- build-win32/release/SRHDDumpReader.exe

pack-ubuntu:
stage: package
image: burningdaylight/ubuntu-latest-devel
script:
- mkdir -p ./SRHDDumpReader
- cp build-ubuntu/SRHDDumpReader ./SRHDDumpReader/
- cp -r presets ./SRHDDumpReader/
- cp ./*.json ./SRHDDumpReader/
- cp ./Click1.wav ./SRHDDumpReader/
artifacts:
name: "SRHDDumpReader_linux_${CI_BUILD_REF_NAME}-${CI_BUILD_REF:0:8}"
paths:
- SRHDDumpReader

pack-win64:
stage: package
image: burningdaylight/mingw-arch:qt
script:
- mkdir -p ./SRHDDumpReader/platforms/
- mkdir -p ./SRHDDumpReader/imageformats/
- cp build-win64/release/SRHDDumpReader.exe ./SRHDDumpReader/
- cp /usr/x86_64-w64-mingw32/bin/{libssp-0,libbz2-1,libiconv-2,libpcre-1,libwinpthread-1,Qt5Multimedia,zlib1,libfreetype-6,libglib-2.0-0,libintl-8,libpng16-16,Qt5Core,Qt5Network,libgcc_s_seh-1,libharfbuzz-0,libpcre16-0,libpcre2-16-0,libgraphite2,libstdc++-6,Qt5Gui,Qt5Widgets,Qt5Svg}.dll ./SRHDDumpReader/
- cp /usr/x86_64-w64-mingw32/bin/lib{gcc_s_seh-1,ssp-0,bz2-1,iconv-2,pcre-1,pcre2-16-0,winpthread-1,freetype-6,glib-2.0-0,intl-8,png16-16,harfbuzz-0,graphite2,stdc++-6}.dll ./SRHDDumpReader/
- cp /usr/x86_64-w64-mingw32/bin/{zlib1,Qt5Core,Qt5Network,Qt5Multimedia,Qt5Gui,Qt5Widgets,Qt5Svg}.dll ./SRHDDumpReader/
- cp /usr/x86_64-w64-mingw32/lib/qt/plugins/platforms/qwindows.dll ./SRHDDumpReader/platforms/
- cp /usr/x86_64-w64-mingw32/lib/qt/plugins/imageformats/{qsvg,qico,qtiff,qjpeg}.dll ./SRHDDumpReader/imageformats/
- cp -r presets ./SRHDDumpReader/
Expand All @@ -57,7 +72,8 @@ pack-win32:
- mkdir -p ./SRHDDumpReader/platforms/
- mkdir -p ./SRHDDumpReader/imageformats/
- cp build-win32/release/SRHDDumpReader.exe ./SRHDDumpReader/
- cp /usr/i686-w64-mingw32/bin/{libssp-0,libbz2-1,libiconv-2,libpcre-1,libwinpthread-1,Qt5Multimedia,zlib1,libfreetype-6,libglib-2.0-0,libintl-8,libpng16-16,Qt5Core,Qt5Network,libgcc_s_sjlj-1,libharfbuzz-0,libpcre16-0,libpcre2-16-0,libgraphite2,libstdc++-6,Qt5Gui,Qt5Widgets,Qt5Svg}.dll ./SRHDDumpReader/
- cp /usr/i686-w64-mingw32/bin/lib{gcc_s_dw2-1,ssp-0,bz2-1,iconv-2,pcre-1,pcre2-16-0,winpthread-1,freetype-6,glib-2.0-0,intl-8,png16-16,harfbuzz-0,graphite2,stdc++-6}.dll ./SRHDDumpReader/ || true
- cp /usr/i686-w64-mingw32/bin/{zlib1,Qt5Core,Qt5Network,Qt5Multimedia,Qt5Gui,Qt5Widgets,Qt5Svg}.dll ./SRHDDumpReader/
- cp /usr/i686-w64-mingw32/lib/qt/plugins/platforms/qwindows.dll ./SRHDDumpReader/platforms/
- cp /usr/i686-w64-mingw32/lib/qt/plugins/imageformats/{qsvg,qico,qtiff,qjpeg}.dll ./SRHDDumpReader/imageformats/
- cp -r presets ./SRHDDumpReader/
Expand Down
20 changes: 11 additions & 9 deletions Galaxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ void Galaxy::parseDump(QTextStream &stream)
const static QMap<QString, int> globalOptions = {
{"Player ^{", 0}, {"StarList ^{", 1}, {"HoleList ^{", 2}};

QString line = stream.readLine();
while (!line.isNull()) {
QString line;
do {
line = stream.readLine();
switch (globalOptions.value(line, -1)) {
case 0: // Player
{
Expand All @@ -86,9 +87,7 @@ void Galaxy::parseDump(QTextStream &stream)
// skip record
break;
}

line = stream.readLine();
}
} while (!line.isNull());
}

void Galaxy::clear()
Expand Down Expand Up @@ -149,6 +148,9 @@ unsigned Galaxy::galaxyTechLevel() const
auto maxPtlIt = std::find_if(ptlCount.rbegin(), ptlCount.rend(),
[](const int &c) { return c > 0; });
unsigned maxPtl = std::distance(maxPtlIt, ptlCount.rend());
if (maxPtl < 1) {
return 0;
}
if (ptlCount[maxPtl] >= 5) {
return maxPtl;
} else if (ptlCount[maxPtl] >= 2 || ptlCount[maxPtl - 1] >= 4) {
Expand Down Expand Up @@ -533,15 +535,15 @@ QString Galaxy::blackHoleNextLootChange(unsigned row) const
QDate today = QDate(3300, 1, 1).addDays(currentDay - 301);
QString changes;
int ttclose = blackHoleTurnsToClose(row);
int lastChange = std::min(ttclose,77*5);
lastChange = ttclose<1?77*5:lastChange;
int lastChange = std::min(ttclose, 77 * 5);
lastChange = ttclose < 1 ? 77 * 5 : lastChange;
for (unsigned daysToChange = 77 - (currentDay % 77);
daysToChange < lastChange; daysToChange += 77) {
changes += today.addDays(daysToChange).toString("dd MMMM yyyy")
+ "; ";
}
if (lastChange<ttclose) {
changes+= " ...";
if (lastChange < ttclose) {
changes += " ...";
}
return changes;
}
Expand Down
Loading

0 comments on commit a4022d0

Please sign in to comment.