multiple sparce implementations for main window

This commit is contained in:
Geoffray Levasseur committed 2026-11-03 18:13:55 +01:00
1 parent 8e7d483471
commit e59988ab1d
9 files changed
+1091 -25

No files matched your search

+13 -13
View File
@@ -85,13 +85,13 @@ EnhanceDlg::EnhanceDlg(QWidget *parent) : FramedDlg(parent), ui(new Ui::EnhanceD
popup = new QMenu(this);
for (int terrType = fGrass; terrType <= fMountains; ++terrType) {
if (terrType == fJungle)
if (terrType == Term::fJungle)
continue;
QString caption;
if (terrType == fGrass)
caption = phrase(QStringLiteral("TWOTERRAINS")).arg(terrainName(fGrass)).arg(terrainName(fGrass + 12));
else if (terrType == fForest)
caption = phrase(QStringLiteral("TWOTERRAINS")).arg(terrainName(fForest)).arg(terrainName(fJungle));
caption = phrase(QStringLiteral("TWOTERRAINS")).arg(terrainName(fForest)).arg(terrainName(Term::fJungle));
else
caption = terrainName(terrType);
QAction *action = popup->addAction(caption);
@@ -146,7 +146,7 @@ void EnhanceDlg::showNewContent(WindowMode newMode, int terrType)
void EnhanceDlg::offscreenPaint()
{
FramedDlg::offscreenPaint();
if (!Term::myData || !HGrSystem || !HGrTerrain)
if (!Term::myData || !HGrSystem || !noMap->hGrTerrain)
return;
Dpi::Canvas &canvas = offscreen.canvas();
@@ -209,31 +209,31 @@ void EnhanceDlg::offscreenPaint()
const int xxt = noMap->xxt;
const int yyt = noMap->yyt;
if (terrType < fForest) {
sprite(canvas, *HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + terrType * (xxt * 2 + 1), 1 + yyt);
sprite(canvas, *noMap->hGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + terrType * (xxt * 2 + 1), 1 + yyt);
} else {
sprite(canvas, *HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + 2 * (xxt * 2 + 1),
sprite(canvas, *noMap->hGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + 2 * (xxt * 2 + 1),
1 + yyt + 2 * (yyt * 3 + 1));
sprite(canvas, *HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + 7 * (xxt * 2 + 1),
sprite(canvas, *noMap->hGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + 7 * (xxt * 2 + 1),
1 + yyt + 2 * (2 + terrType - fForest) * (yyt * 3 + 1));
}
if ((tileImp & fTerImp) == tiFarm)
sprite(canvas, *HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + (xxt * 2 + 1),
sprite(canvas, *noMap->hGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + (xxt * 2 + 1),
1 + yyt + 12 * (yyt * 3 + 1));
else if ((tileImp & fTerImp) == tiIrrigation)
sprite(canvas, *HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1, 1 + yyt + 12 * (yyt * 3 + 1));
sprite(canvas, *noMap->hGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1, 1 + yyt + 12 * (yyt * 3 + 1));
if (tileImp & fRR) {
sprite(canvas, *HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + 6 * (xxt * 2 + 1),
sprite(canvas, *noMap->hGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + 6 * (xxt * 2 + 1),
1 + yyt + 10 * (yyt * 3 + 1));
sprite(canvas, *HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + 2 * (xxt * 2 + 1),
sprite(canvas, *noMap->hGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + 2 * (xxt * 2 + 1),
1 + yyt + 10 * (yyt * 3 + 1));
} else if (tileImp & fRoad) {
sprite(canvas, *HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + 6 * (xxt * 2 + 1),
sprite(canvas, *noMap->hGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + 6 * (xxt * 2 + 1),
1 + yyt + 9 * (yyt * 3 + 1));
sprite(canvas, *HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + 2 * (xxt * 2 + 1),
sprite(canvas, *noMap->hGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + 2 * (xxt * 2 + 1),
1 + yyt + 9 * (yyt * 3 + 1));
}
if ((tileImp & fTerImp) == tiMine)
sprite(canvas, *HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + 2 * (xxt * 2 + 1),
sprite(canvas, *noMap->hGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1 + 2 * (xxt * 2 + 1),
1 + yyt + 12 * (yyt * 3 + 1));
x += xxt * 2 + 6;
}