fix tech name
This commit is contained in:
1 parent
bb5080aad9
commit
99638e195f
1 file changed
+7
-24
@@ -32,7 +32,6 @@
|
|||||||
#include "Cevo/CevoScreenTools.h"
|
#include "Cevo/CevoScreenTools.h"
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
|
|
||||||
#include <QHash>
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@@ -58,22 +57,6 @@ constexpr int xLegend = 44;
|
|||||||
constexpr int yLegend = 79;
|
constexpr int yLegend = 79;
|
||||||
constexpr int yLegendPitch = 32;
|
constexpr int yLegendPitch = 32;
|
||||||
|
|
||||||
// Phrases/Phrases2 (StringTables.pas) aren't ported; disclosed
|
|
||||||
// plain-English placeholders for this dialog's own text.
|
|
||||||
QString phrase(const QString &key)
|
|
||||||
{
|
|
||||||
static const QHash<QString, QString> table = {
|
|
||||||
{QStringLiteral("MENU_ADVTREE"), QStringLiteral("Advances")},
|
|
||||||
{QStringLiteral("ADVTREE_UP0"), QStringLiteral("Age I advance")},
|
|
||||||
{QStringLiteral("ADVTREE_UP1"), QStringLiteral("Age II advance")},
|
|
||||||
{QStringLiteral("ADVTREE_UP2"), QStringLiteral("Age III/IV advance")},
|
|
||||||
{QStringLiteral("ADVTREE_GOV"), QStringLiteral("Government advance")},
|
|
||||||
{QStringLiteral("ADVTREE_OTHER"), QStringLiteral("Other advance")},
|
|
||||||
};
|
|
||||||
const auto it = table.constFind(key);
|
|
||||||
return it != table.constEnd() ? it.value() : key;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TechTreeDlg::TechTreeDlg(QWidget *parent) : DrawDlg(parent), ui(new Ui::TechTreeDlg)
|
TechTreeDlg::TechTreeDlg(QWidget *parent) : DrawDlg(parent), ui(new Ui::TechTreeDlg)
|
||||||
@@ -152,7 +135,7 @@ void TechTreeDlg::paintEvent(QPaintEvent *)
|
|||||||
void TechTreeDlg::showEvent(QShowEvent *event)
|
void TechTreeDlg::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
DrawDlg::showEvent(event);
|
DrawDlg::showEvent(event);
|
||||||
setWindowTitle(phrase(QStringLiteral("MENU_ADVTREE")));
|
setWindowTitle(phrases2.lookup(QStringLiteral("MENU_ADVTREE")));
|
||||||
|
|
||||||
if (!image) {
|
if (!image) {
|
||||||
image = std::make_unique<Dpi::Bitmap>();
|
image = std::make_unique<Dpi::Bitmap>();
|
||||||
@@ -171,7 +154,7 @@ void TechTreeDlg::showEvent(QShowEvent *event)
|
|||||||
const QRgb marker = image->image().pixel(xStart + x * xPitch + 10, yStart + y * yPitch - 1);
|
const QRgb marker = image->image().pixel(xStart + x * xPitch + 10, yStart + y * yPitch - 1);
|
||||||
if (qGreen(marker) == 0 && qBlue(marker) == 0) {
|
if (qGreen(marker) == 0 && qBlue(marker) == 0) {
|
||||||
const int ad = qRed(marker);
|
const int ad = qRed(marker);
|
||||||
QString s = QStringLiteral("Advance %1").arg(ad);
|
QString s = phrases.lookup(QStringLiteral("ADVANCES"), ad);
|
||||||
while (canvas.textWidth(s) > 112)
|
while (canvas.textWidth(s) > 112)
|
||||||
s.chop(1);
|
s.chop(1);
|
||||||
canvas.textOut(xStart + x * xPitch + 2, yStart + y * yPitch, s);
|
canvas.textOut(xStart + x * xPitch + 2, yStart + y * yPitch, s);
|
||||||
@@ -181,11 +164,11 @@ void TechTreeDlg::showEvent(QShowEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.textOut(xLegend, yLegend, phrase(QStringLiteral("ADVTREE_UP0")));
|
canvas.textOut(xLegend, yLegend, phrases2.lookup(QStringLiteral("ADVTREE_UP0")));
|
||||||
canvas.textOut(xLegend, yLegend + yLegendPitch, phrase(QStringLiteral("ADVTREE_UP1")));
|
canvas.textOut(xLegend, yLegend + yLegendPitch, phrases2.lookup(QStringLiteral("ADVTREE_UP1")));
|
||||||
canvas.textOut(xLegend, yLegend + 2 * yLegendPitch, phrase(QStringLiteral("ADVTREE_UP2")));
|
canvas.textOut(xLegend, yLegend + 2 * yLegendPitch, phrases2.lookup(QStringLiteral("ADVTREE_UP2")));
|
||||||
canvas.textOut(xLegend, yLegend + 3 * yLegendPitch, phrase(QStringLiteral("ADVTREE_GOV")));
|
canvas.textOut(xLegend, yLegend + 3 * yLegendPitch, phrases2.lookup(QStringLiteral("ADVTREE_GOV")));
|
||||||
canvas.textOut(xLegend, yLegend + 4 * yLegendPitch, phrase(QStringLiteral("ADVTREE_OTHER")));
|
canvas.textOut(xLegend, yLegend + 4 * yLegendPitch, phrases2.lookup(QStringLiteral("ADVTREE_OTHER")));
|
||||||
canvas.end();
|
canvas.end();
|
||||||
|
|
||||||
texturize(*image, paper, QColor::fromRgb(TransparentColor2));
|
texturize(*image, paper, QColor::fromRgb(TransparentColor2));
|
||||||
|
|||||||
Reference in new issue
Block a user