removed old temporary phrase and formatPrase implementations

This commit is contained in:
Geoffray Levasseur committed 2026-11-17 11:42:28 +01:00
1 parent 6e634e13d2
commit e96b871779
14 files changed
+231 -598

No files matched your search

+5 -16
View File
@@ -32,6 +32,7 @@
#include "Cevo/CevoScreenTools.h"
#include "Cevo/CevoTexture.h"
#include "ClientTools.h"
#include "Global.h"
#include "Term.h"
#include <QCloseEvent>
@@ -51,26 +52,14 @@ constexpr QRgb DamageColor = 0x0000E0;
constexpr QRgb FanaticColor = 0x800080;
constexpr QRgb FirstStrikeColor = 0xA0A0A0;
// TODO: needs Phrases[] (StringTables.pas not ported) - plain English literals.
QString phrase(const QString &key)
{
static const QHash<QString, QString> table = {
{QStringLiteral("BTN_YES"), QStringLiteral("Yes")},
{QStringLiteral("BTN_NO"), QStringLiteral("No")},
{QStringLiteral("TITLE_SUICIDE"), QStringLiteral("Hopeless attack")},
{QStringLiteral("SUICIDE"), QStringLiteral("This attack has no chance of success.\\Attack anyway?")},
};
const auto it = table.constFind(key);
return it != table.constEnd() ? *it : key;
}
} // namespace
BattleDlg::BattleDlg(QWidget *parent) : DrawDlg(parent), ui(new Ui::BattleDlg)
{
ui->setupUi(this);
isoMap = std::make_unique<IsoEngine::IsoMap>();
ui->okBtn->setCaption(phrase(QStringLiteral("BTN_YES")));
ui->cancelBtn->setCaption(phrase(QStringLiteral("BTN_NO")));
ui->okBtn->setCaption(phrases.lookup(QStringLiteral("BTN_YES")));
ui->cancelBtn->setCaption(phrases.lookup(QStringLiteral("BTN_NO")));
initButtons();
ui->okBtn->onClick = [this] {
@@ -226,10 +215,10 @@ void BattleDlg::paintEvent(QPaintEvent *)
int ym;
if (isSuicideQuery) {
canvas.font().assign(UniFont[static_cast<std::size_t>(FontType::Caption)]);
QString s = phrase(QStringLiteral("TITLE_SUICIDE"));
QString s = phrases.lookup(QStringLiteral("TITLE_SUICIDE"));
risedTextOut(canvas, (width() - biColorTextWidth(canvas, s)) / 2, 7 + Border, s);
canvas.font().assign(UniFont[static_cast<std::size_t>(FontType::Normal)]);
s = phrase(QStringLiteral("SUICIDE"));
s = phrases.lookup(QStringLiteral("SUICIDE"));
const int p = s.indexOf(QLatin1Char('\\'));
if (p < 0) {
risedTextOut(canvas, (width() - biColorTextWidth(canvas, s)) / 2, 205, s);