unitstat implementation with its requirements
This commit is contained in:
1 parent
a4eb5689a6
commit
e4c7102b85
7 files changed
+819
No files matched your search
@@ -93,6 +93,11 @@ void init(InitEnemyModelEvent initEnemyModelHandler)
|
|||||||
onInitEnemyModel = std::move(initEnemyModelHandler);
|
onInitEnemyModel = std::move(initEnemyModelHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool invokeInitEnemyModel(int emix)
|
||||||
|
{
|
||||||
|
return !onInitEnemyModel || onInitEnemyModel(emix);
|
||||||
|
}
|
||||||
|
|
||||||
void CitiesPictures::prepare(GraphicSet *hGrCities, int xxt, int yyt)
|
void CitiesPictures::prepare(GraphicSet *hGrCities, int xxt, int yyt)
|
||||||
{
|
{
|
||||||
for (int age = 2; age <= 3; ++age) {
|
for (int age = 2; age <= 3; ++age) {
|
||||||
|
|||||||
@@ -234,6 +234,10 @@ private:
|
|||||||
|
|
||||||
bool isJungle(int y);
|
bool isJungle(int y);
|
||||||
void init(InitEnemyModelEvent initEnemyModelHandler);
|
void init(InitEnemyModelEvent initEnemyModelHandler);
|
||||||
|
// Calls the handler registered via init() (true if none registered, i.e.
|
||||||
|
// "nothing to do, proceed"), for other LocalPlayer files that need
|
||||||
|
// Term.pas's `InitEnemyModel` without re-registering their own handler.
|
||||||
|
bool invokeInitEnemyModel(int emix);
|
||||||
|
|
||||||
} // namespace IsoEngine
|
} // namespace IsoEngine
|
||||||
} // namespace Cevo
|
} // namespace Cevo
|
||||||
@@ -36,6 +36,8 @@ namespace Term {
|
|||||||
|
|
||||||
PersistentData *myData = nullptr;
|
PersistentData *myData = nullptr;
|
||||||
Dpi::Bitmap *smallImp = nullptr;
|
Dpi::Bitmap *smallImp = nullptr;
|
||||||
|
bool mainScreenNamesChecked = true;
|
||||||
|
Dpi::Bitmap buffer;
|
||||||
ClientTools::SaveOptions optionChecked = 0;
|
ClientTools::SaveOptions optionChecked = 0;
|
||||||
bool supervising = false;
|
bool supervising = false;
|
||||||
std::array<DipMemEntry, nPl> dipMem{};
|
std::array<DipMemEntry, nPl> dipMem{};
|
||||||
|
|||||||
@@ -53,6 +53,18 @@ constexpr int xSizeSmall = 36;
|
|||||||
constexpr int ySizeSmall = 20;
|
constexpr int ySizeSmall = 20;
|
||||||
constexpr int SystemIconLines = 2;
|
constexpr int SystemIconLines = 2;
|
||||||
|
|
||||||
|
// TModel.Status bit flags.
|
||||||
|
constexpr int msObsolete = 0x1;
|
||||||
|
constexpr int msAllowConscripts = 0x2;
|
||||||
|
|
||||||
|
// Term.pas's `MainScreen.mNames.Checked` (menu checkbox: show real model
|
||||||
|
// names vs. generic "Model #n" names) - defaults to the more useful true.
|
||||||
|
extern bool mainScreenNamesChecked;
|
||||||
|
// Term.pas's `Buffer: TBitmap` - a shared general-purpose scratch bitmap;
|
||||||
|
// callers must setSize() it themselves before use (no central owner
|
||||||
|
// resizes it yet since Term.pas's own usage isn't ported).
|
||||||
|
extern Dpi::Bitmap buffer;
|
||||||
|
|
||||||
// Term.pas's `TPersistentData` (per-player persisted client-side settings,
|
// Term.pas's `TPersistentData` (per-player persisted client-side settings,
|
||||||
// e.g. city build-order preferences) - only the fields some leaf dialog
|
// e.g. city build-order preferences) - only the fields some leaf dialog
|
||||||
// needs are ported so far; add more as needed.
|
// needs are ported so far; add more as needed.
|
||||||
|
|||||||
@@ -0,0 +1,615 @@
|
|||||||
|
// This file is part of c-evo-evo.
|
||||||
|
//
|
||||||
|
// This software is governed by the CeCILL license under French law and
|
||||||
|
// abiding by the rules of distribution of free software. You can use,
|
||||||
|
// modify and/or redistribute the software under the terms of the CeCILL
|
||||||
|
// license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
// "http://www.cecill.info".
|
||||||
|
//
|
||||||
|
// As a counterpart to the access to the source code and rights to copy,
|
||||||
|
// modify and redistribute granted by the license, users are provided only
|
||||||
|
// with a limited warranty and the software's author, the holder of the
|
||||||
|
// economic rights, and the successive licensors have only limited
|
||||||
|
// liability.
|
||||||
|
//
|
||||||
|
// In this respect, the user's attention is drawn to the risks associated
|
||||||
|
// with loading, using, modifying and/or developing or reproducing the
|
||||||
|
// software by the user in light of its specific status of free software,
|
||||||
|
// that may mean that it is complicated to manipulate, and that also
|
||||||
|
// therefore means that it is reserved for developers and experienced
|
||||||
|
// professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
// encouraged to load and test the software's suitability as regards their
|
||||||
|
// requirements in conditions enabling the security of their systems and/or
|
||||||
|
// data to be ensured and, more generally, to use and operate it in the
|
||||||
|
// same conditions as regards security.
|
||||||
|
//
|
||||||
|
// The fact that you are presently reading this means that you have had
|
||||||
|
// knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
#include "UnitStat.h"
|
||||||
|
#include "ui_UnitStat.h"
|
||||||
|
|
||||||
|
#include "Cevo/CevoTexture.h"
|
||||||
|
#include "ClientTools.h"
|
||||||
|
#include "Global.h"
|
||||||
|
#include "Help.h"
|
||||||
|
#include "Term.h"
|
||||||
|
#include "Tribes.h"
|
||||||
|
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
|
namespace Cevo {
|
||||||
|
namespace UnitStat {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
constexpr int xView = 71;
|
||||||
|
constexpr int xTotal = 20;
|
||||||
|
constexpr int StatDown = 112;
|
||||||
|
constexpr int yImp = 133;
|
||||||
|
|
||||||
|
constexpr int wCommon = 208;
|
||||||
|
constexpr int hOwnModel = 293;
|
||||||
|
constexpr int hEnemyModel = 236;
|
||||||
|
constexpr int hEnemyUnit = 212;
|
||||||
|
constexpr int hEnemyCityDefense = 320;
|
||||||
|
constexpr int hEnemyCity = 166;
|
||||||
|
constexpr int hMax = 320;
|
||||||
|
|
||||||
|
// 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("UNITSPECIAL"), QStringLiteral("Special unit")},
|
||||||
|
{QStringLiteral("CONTROLS6"), QStringLiteral("Special unit controls")},
|
||||||
|
{QStringLiteral("UNITSTRENGTH"), QStringLiteral("Attack/Defense")},
|
||||||
|
{QStringLiteral("UNITSPEED"), QStringLiteral("Speed")},
|
||||||
|
{QStringLiteral("UNITCOST"), QStringLiteral("Cost")},
|
||||||
|
{QStringLiteral("UNITADOPT"), QStringLiteral("Adopted")},
|
||||||
|
{QStringLiteral("UNITINTRO"), QStringLiteral("Introduced")},
|
||||||
|
{QStringLiteral("UNITBUILT"), QStringLiteral("Built")},
|
||||||
|
{QStringLiteral("UNITLOST"), QStringLiteral("Lost")},
|
||||||
|
{QStringLiteral("UNITINPROD"), QStringLiteral("In production")},
|
||||||
|
{QStringLiteral("UNITAVAILABLE"), QStringLiteral("Available")},
|
||||||
|
{QStringLiteral("UNITDESTROYED"), QStringLiteral("Destroyed")},
|
||||||
|
{QStringLiteral("UNITKNOWN"), QStringLiteral("Known")},
|
||||||
|
{QStringLiteral("BTN_OBSOLETE"), QStringLiteral("Mark as obsolete")},
|
||||||
|
{QStringLiteral("BTN_NONOBSOLETE"), QStringLiteral("Mark as not obsolete")},
|
||||||
|
{QStringLiteral("BTN_NOCONSCRIPTS"), QStringLiteral("Allow conscripts")},
|
||||||
|
{QStringLiteral("BTN_ALLOWCONSCRIPTS"), QStringLiteral("Disallow conscripts")},
|
||||||
|
};
|
||||||
|
const auto it = table.constFind(key);
|
||||||
|
return it != table.constEnd() ? it.value() : key;
|
||||||
|
}
|
||||||
|
|
||||||
|
void featureBar(Dpi::Canvas &canvas, int x, int y, const TModelInfo &mi, const Texture &)
|
||||||
|
{
|
||||||
|
darkGradient(canvas, x - 6, y + 1, 180, 1);
|
||||||
|
if (mi.Kind >= 0x10) {
|
||||||
|
const QString s = phrase(QStringLiteral("UNITSPECIAL"));
|
||||||
|
canvas.font().setColor(Qt::black);
|
||||||
|
canvas.textOut(x - 1, y + 1, s);
|
||||||
|
canvas.font().setColor(QColor(0xB0, 0xB0, 0xB0));
|
||||||
|
canvas.textOut(x - 2, y, s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas.font().setColor(Qt::black);
|
||||||
|
int dx = 2;
|
||||||
|
for (int i = 3; i < nFeature; ++i) {
|
||||||
|
int num = 0;
|
||||||
|
switch (i) {
|
||||||
|
case mcSeaTrans: if (mi.Domain == dSea) num = mi.TTrans; break;
|
||||||
|
case mcCarrier: if (mi.Domain == dSea) num = mi.ATrans_Fuel; break;
|
||||||
|
case mcBombs: num = mi.Bombs; break;
|
||||||
|
case mcFuel: if (mi.Domain == dAir) num = mi.ATrans_Fuel; break;
|
||||||
|
case mcAirTrans: if (mi.Domain == dAir) num = mi.TTrans; break;
|
||||||
|
default:
|
||||||
|
if (i >= mcFirstNonCap && (mi.Cap & (1u << (i - mcFirstNonCap))))
|
||||||
|
num = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (num > 0 && (i != mcSE || (mi.Cap & (1u << (mcNP - mcFirstNonCap))) == 0)) {
|
||||||
|
if (num > 1) {
|
||||||
|
const QString s = QString::number(num);
|
||||||
|
const int w = canvas.textWidth(s);
|
||||||
|
canvas.brush().setColor(Qt::white);
|
||||||
|
canvas.fillRect(QRect(x - 3 + dx, y + 2, w + 2, 14));
|
||||||
|
canvas.brush().setStyle(Qt::NoBrush);
|
||||||
|
canvas.textOut(x - 3 + dx + 1, y, s);
|
||||||
|
dx += w + 1;
|
||||||
|
}
|
||||||
|
canvas.brush().setColor(QColor(0xC0, 0xC0, 0xC0));
|
||||||
|
canvas.frameRect(QRect(x - 3 + dx, y + 2, 15, 14));
|
||||||
|
canvas.brush().setStyle(Qt::NoBrush);
|
||||||
|
sprite(canvas, *HGrSystem, x - 1 + dx, y + 4, 10, 10, 66 + i % 11 * 11, 137 + i / 11 * 11);
|
||||||
|
dx += 15;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void numberBarS(Dpi::Canvas &canvas, int x, int y, const QString &cap, const QString &s, const Texture &texture)
|
||||||
|
{
|
||||||
|
dLine(canvas, x - 2, x + 170, y + 16, texture.colorBevelShade, texture.colorBevelLight);
|
||||||
|
loweredTextOut(canvas, -1, texture, x - 2, y, cap);
|
||||||
|
risedTextOut(canvas, x + 170 - biColorTextWidth(canvas, s), y, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
UnitStatDlg::UnitStatDlg(QWidget *parent) : BufferedDrawDlg(parent), ui(new Ui::UnitStatDlg)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
noMap = std::make_unique<IsoEngine::IsoMap>();
|
||||||
|
titleHeight = Dpi::Screen::primaryMonitor().height();
|
||||||
|
initButtons();
|
||||||
|
|
||||||
|
back.setSize(5 * wCommon, hMax);
|
||||||
|
back.canvas().begin();
|
||||||
|
back.canvas().fillRect(QRect(0, 0, back.width(), back.height()));
|
||||||
|
back.canvas().end();
|
||||||
|
tmpl.loadFromFile(getGraphicsDir() + QStringLiteral("/Unit") + PngExt);
|
||||||
|
|
||||||
|
ui->closeBtn->onClick = [this] { close(); };
|
||||||
|
ui->switchBtn->onClick = [this] {
|
||||||
|
ClientTools::myModel[mixShow].Status ^= Term::msObsolete;
|
||||||
|
if (ClientTools::myModel[mixShow].Status & Term::msObsolete) {
|
||||||
|
ui->switchBtn->setButtonIndex(12);
|
||||||
|
ui->switchBtn->setToolTip(phrase(QStringLiteral("BTN_OBSOLETE")));
|
||||||
|
} else {
|
||||||
|
ui->switchBtn->setButtonIndex(11);
|
||||||
|
ui->switchBtn->setToolTip(phrase(QStringLiteral("BTN_NONOBSOLETE")));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ui->conscriptsBtn->onClick = [this] {
|
||||||
|
ClientTools::myModel[mixShow].Status ^= Term::msAllowConscripts;
|
||||||
|
if ((ClientTools::myModel[mixShow].Status & Term::msAllowConscripts) == 0) {
|
||||||
|
ui->conscriptsBtn->setButtonIndex(30);
|
||||||
|
ui->conscriptsBtn->setToolTip(phrase(QStringLiteral("BTN_NOCONSCRIPTS")));
|
||||||
|
} else {
|
||||||
|
ui->conscriptsBtn->setButtonIndex(29);
|
||||||
|
ui->conscriptsBtn->setToolTip(phrase(QStringLiteral("BTN_ALLOWCONSCRIPTS")));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ui->helpBtn->onClick = [this] { Help::showNewContent(WindowMode::Persistent, Help::LinkCategory::Model, 0); };
|
||||||
|
|
||||||
|
onShow = [this] {
|
||||||
|
if (kind == UnitStatDialogKind::EnemyUnit || kind == UnitStatDialogKind::EnemyCityDefense ||
|
||||||
|
kind == UnitStatDialogKind::EnemyCity) {
|
||||||
|
if (ClientTools::myMap[unitLoc] & fUnit) {
|
||||||
|
if (euixShow < 0) {
|
||||||
|
euixShow = ClientTools::myRO->nEnemyUn - 1;
|
||||||
|
while (euixShow >= 0 && (*ClientTools::myRO->EnemyUn)[euixShow].Loc != unitLoc)
|
||||||
|
--euixShow;
|
||||||
|
Q_ASSERT(euixShow >= 0);
|
||||||
|
}
|
||||||
|
const TUnitInfo &eu = (*ClientTools::myRO->EnemyUn)[euixShow];
|
||||||
|
mox = &(*ClientTools::myRO->EnemyModel)[eu.emix];
|
||||||
|
if (!Tribes::tribe[eu.Owner]->modelPictureAt(eu.mix).hGr)
|
||||||
|
IsoEngine::invokeInitEnemyModel(eu.emix);
|
||||||
|
} else {
|
||||||
|
mox = nullptr;
|
||||||
|
}
|
||||||
|
if (kind == UnitStatDialogKind::EnemyCityDefense || kind == UnitStatDialogKind::EnemyCity) {
|
||||||
|
ecixShow = ClientTools::myRO->nEnemyCity - 1;
|
||||||
|
while (ecixShow >= 0 && (*ClientTools::myRO->EnemyCity)[ecixShow].Loc != unitLoc)
|
||||||
|
--ecixShow;
|
||||||
|
Q_ASSERT(ecixShow >= 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int newHeight = hOwnModel;
|
||||||
|
switch (kind) {
|
||||||
|
case UnitStatDialogKind::OwnModel: newHeight = hOwnModel; break;
|
||||||
|
case UnitStatDialogKind::OwnUnit: newHeight = hEnemyUnit; break;
|
||||||
|
case UnitStatDialogKind::EnemyModel: newHeight = hEnemyModel; break;
|
||||||
|
case UnitStatDialogKind::EnemyUnit: newHeight = hEnemyUnit; break;
|
||||||
|
case UnitStatDialogKind::EnemyCityDefense: newHeight = hEnemyCityDefense; break;
|
||||||
|
case UnitStatDialogKind::EnemyCity: newHeight = hEnemyCity; break;
|
||||||
|
}
|
||||||
|
resize(width(), newHeight);
|
||||||
|
|
||||||
|
if (kind == UnitStatDialogKind::OwnModel || kind == UnitStatDialogKind::EnemyModel) {
|
||||||
|
move(userLeft, userTop);
|
||||||
|
} else {
|
||||||
|
const Dpi::Monitor monitor = Dpi::Screen::primaryMonitor();
|
||||||
|
move(monitor.left() + (monitor.width() - width()) / 2, monitor.top() + (monitor.height() - newHeight) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->switchBtn->setVisible(!Term::supervising && kind == UnitStatDialogKind::OwnModel);
|
||||||
|
ui->conscriptsBtn->setVisible(!Term::supervising && kind == UnitStatDialogKind::OwnModel &&
|
||||||
|
ClientTools::myRO->Tech[adConscription] >= tsApplicable &&
|
||||||
|
ClientTools::myModel[mixShow].Domain == dGround &&
|
||||||
|
ClientTools::myModel[mixShow].Kind < mkScout);
|
||||||
|
|
||||||
|
bool isSpecialUnit = false;
|
||||||
|
if (kind == UnitStatDialogKind::EnemyCity || kind == UnitStatDialogKind::EnemyCityDefense) {
|
||||||
|
setWindowTitle(Tribes::cityName((*ClientTools::myRO->EnemyCity)[ecixShow].ID));
|
||||||
|
} else {
|
||||||
|
int owner = ClientTools::me;
|
||||||
|
int mix = mixShow;
|
||||||
|
switch (kind) {
|
||||||
|
case UnitStatDialogKind::OwnModel:
|
||||||
|
owner = ClientTools::me;
|
||||||
|
mix = mixShow;
|
||||||
|
isSpecialUnit = ClientTools::myModel[mix].Kind >= 0x10;
|
||||||
|
break;
|
||||||
|
case UnitStatDialogKind::OwnUnit:
|
||||||
|
owner = ClientTools::me;
|
||||||
|
mix = ClientTools::myUn[uixShow].mix;
|
||||||
|
isSpecialUnit = ClientTools::myModel[mix].Kind >= 0x10;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
owner = mox->Owner;
|
||||||
|
mix = mox->mix;
|
||||||
|
isSpecialUnit = mox->Kind >= 0x10;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (Term::mainScreenNamesChecked)
|
||||||
|
setWindowTitle(Tribes::tribe[owner]->modelNameAt(mix));
|
||||||
|
else
|
||||||
|
setWindowTitle(Tribes::tribe[owner]->tPhrase(QStringLiteral("GENMODEL")).arg(mix));
|
||||||
|
}
|
||||||
|
if (isSpecialUnit)
|
||||||
|
ui->helpBtn->setToolTip(phrase(QStringLiteral("CONTROLS6")));
|
||||||
|
ui->helpBtn->setVisible(isSpecialUnit);
|
||||||
|
offscreenPaint();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
UnitStatDlg::~UnitStatDlg()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnitStatDlg::closeEvent(QCloseEvent *event)
|
||||||
|
{
|
||||||
|
if (kind == UnitStatDialogKind::OwnModel || kind == UnitStatDialogKind::EnemyModel) {
|
||||||
|
userLeft = x();
|
||||||
|
userTop = y();
|
||||||
|
}
|
||||||
|
BufferedDrawDlg::closeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnitStatDlg::checkAge()
|
||||||
|
{
|
||||||
|
if (!MainTexture)
|
||||||
|
return;
|
||||||
|
if (MainTexture->age() != agePrepared) {
|
||||||
|
agePrepared = MainTexture->age();
|
||||||
|
bitBltBitmap(back, 0, 0, wCommon, hOwnModel, MainTexture->image(), (MainTexture->width() - wCommon) / 2,
|
||||||
|
(MainTexture->height() - hOwnModel) / 2);
|
||||||
|
bitBltBitmap(back, wCommon, 0, wCommon, hEnemyModel, MainTexture->image(), (MainTexture->width() - wCommon) / 2,
|
||||||
|
(MainTexture->height() - hEnemyModel) / 2);
|
||||||
|
bitBltBitmap(back, 2 * wCommon, 0, wCommon, hEnemyUnit, MainTexture->image(),
|
||||||
|
(MainTexture->width() - wCommon) / 2, (MainTexture->height() - hEnemyUnit) / 2);
|
||||||
|
bitBltBitmap(back, 3 * wCommon, 0, wCommon, hEnemyCityDefense, MainTexture->image(),
|
||||||
|
(MainTexture->width() - wCommon) / 2, (MainTexture->height() - hEnemyCityDefense) / 2);
|
||||||
|
bitBltBitmap(back, 4 * wCommon, 0, wCommon, hEnemyCity, MainTexture->image(),
|
||||||
|
(MainTexture->width() - wCommon) / 2, (MainTexture->height() - hEnemyCity) / 2);
|
||||||
|
imageOpB(back, tmpl, 0, 0, 0, 0, 5 * wCommon, hMax);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnitStatDlg::showNewContentOwnModel(WindowMode newMode, int mix)
|
||||||
|
{
|
||||||
|
kind = UnitStatDialogKind::OwnModel;
|
||||||
|
mixShow = mix;
|
||||||
|
showNewContent(newMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnitStatDlg::showNewContentOwnUnit(WindowMode newMode, int uix)
|
||||||
|
{
|
||||||
|
kind = UnitStatDialogKind::OwnUnit;
|
||||||
|
uixShow = uix;
|
||||||
|
showNewContent(newMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnitStatDlg::showNewContentEnemyUnit(WindowMode newMode, int euix)
|
||||||
|
{
|
||||||
|
kind = UnitStatDialogKind::EnemyUnit;
|
||||||
|
euixShow = euix;
|
||||||
|
unitLoc = (*ClientTools::myRO->EnemyUn)[euix].Loc;
|
||||||
|
showNewContent(newMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnitStatDlg::showNewContentEnemyLoc(WindowMode newMode, int loc)
|
||||||
|
{
|
||||||
|
kind = UnitStatDialogKind::EnemyUnit;
|
||||||
|
unitLoc = loc;
|
||||||
|
euixShow = -1;
|
||||||
|
showNewContent(newMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnitStatDlg::showNewContentEnemyModel(WindowMode newMode, int emix)
|
||||||
|
{
|
||||||
|
kind = UnitStatDialogKind::EnemyModel;
|
||||||
|
mox = &(*ClientTools::myRO->EnemyModel)[emix];
|
||||||
|
showNewContent(newMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnitStatDlg::showNewContentEnemyCity(WindowMode newMode, int loc)
|
||||||
|
{
|
||||||
|
kind = (ClientTools::myMap[loc] & fUnit) ? UnitStatDialogKind::EnemyCityDefense : UnitStatDialogKind::EnemyCity;
|
||||||
|
unitLoc = loc;
|
||||||
|
euixShow = -1;
|
||||||
|
showNewContent(newMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnitStatDlg::offscreenPaint()
|
||||||
|
{
|
||||||
|
BufferedDrawDlg::offscreenPaint();
|
||||||
|
if (!MainTexture)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto isToCount = [this](int emix) {
|
||||||
|
const TModelInfo &em = (*ClientTools::myRO->EnemyModel)[emix];
|
||||||
|
if (Term::mainScreenNamesChecked) {
|
||||||
|
const Tribes::ModelPicture &testPicture = Tribes::tribe[em.Owner]->modelPictureAt(em.mix);
|
||||||
|
const Tribes::ModelPicture &picture = Tribes::tribe[mox->Owner]->modelPictureAt(mox->mix);
|
||||||
|
return picture.hGr == testPicture.hGr && picture.pix == testPicture.pix &&
|
||||||
|
ClientTools::modelHash(*mox) == ClientTools::modelHash(em);
|
||||||
|
}
|
||||||
|
return em.Owner == mox->Owner && em.mix == mox->mix;
|
||||||
|
};
|
||||||
|
|
||||||
|
Dpi::Canvas &canvas = offscreen.canvas();
|
||||||
|
canvas.begin();
|
||||||
|
|
||||||
|
int yView, yTotal;
|
||||||
|
switch (kind) {
|
||||||
|
case UnitStatDialogKind::OwnModel:
|
||||||
|
bitBltBitmap(offscreen, 0, 0, wCommon, hOwnModel, back, 0, 0);
|
||||||
|
yView = 13; yTotal = 92;
|
||||||
|
break;
|
||||||
|
case UnitStatDialogKind::EnemyModel:
|
||||||
|
bitBltBitmap(offscreen, 0, 0, wCommon, hEnemyModel, back, wCommon, 0);
|
||||||
|
yView = 13; yTotal = 92;
|
||||||
|
break;
|
||||||
|
case UnitStatDialogKind::EnemyUnit:
|
||||||
|
case UnitStatDialogKind::OwnUnit:
|
||||||
|
bitBltBitmap(offscreen, 0, 0, wCommon, hEnemyUnit, back, 2 * wCommon, 0);
|
||||||
|
yView = 13; yTotal = 123;
|
||||||
|
break;
|
||||||
|
case UnitStatDialogKind::EnemyCityDefense:
|
||||||
|
bitBltBitmap(offscreen, 0, 0, wCommon, hEnemyCityDefense, back, 3 * wCommon, 0);
|
||||||
|
yView = 171; yTotal = 231;
|
||||||
|
break;
|
||||||
|
default: // EnemyCity
|
||||||
|
bitBltBitmap(offscreen, 0, 0, wCommon, hEnemyCity, back, 4 * wCommon, 0);
|
||||||
|
yView = 171; yTotal = 231;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
markUsedOffscreen(width(), height());
|
||||||
|
ui->helpBtn->move(ui->helpBtn->x(), yTotal + 22);
|
||||||
|
|
||||||
|
if (kind == UnitStatDialogKind::EnemyCityDefense || kind == UnitStatDialogKind::EnemyCity) {
|
||||||
|
const TCityInfo &ci = (*ClientTools::myRO->EnemyCity)[ecixShow];
|
||||||
|
int cnt = 0;
|
||||||
|
for (int i = 0; i <= 3; ++i)
|
||||||
|
if (ci.Flags & (2 << i))
|
||||||
|
++cnt;
|
||||||
|
int x = (wCommon - cnt * Term::xSizeSmall) / 2 - (cnt - 1) * 2;
|
||||||
|
for (int i = 0; i <= 3; ++i) {
|
||||||
|
if (ci.Flags & (2 << i)) {
|
||||||
|
int j = imWalls;
|
||||||
|
switch (i) {
|
||||||
|
case 0: j = imWalls; break;
|
||||||
|
case 1: j = imCoastalFort; break;
|
||||||
|
case 2: j = imMissileBat; break;
|
||||||
|
case 3: j = imBunker; break;
|
||||||
|
}
|
||||||
|
frame(canvas, x - 1, yImp - 1, x + Term::xSizeSmall, yImp + Term::ySizeSmall,
|
||||||
|
MainTexture->colorBevelLight, MainTexture->colorBevelShade);
|
||||||
|
if (Term::smallImp)
|
||||||
|
bitBltBitmap(offscreen, x, yImp, Term::xSizeSmall, Term::ySizeSmall, *Term::smallImp,
|
||||||
|
j % 7 * Term::xSizeSmall, (j + Term::SystemIconLines * 7) / 7 * Term::ySizeSmall);
|
||||||
|
x += Term::xSizeSmall + 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int available = 0, inProd = 0, destroyed = 0;
|
||||||
|
if (kind == UnitStatDialogKind::EnemyModel) {
|
||||||
|
if (ClientTools::g.Difficulty[ClientTools::me] == 0) {
|
||||||
|
for (int loc = 0; loc < ClientTools::g.lx * ClientTools::g.ly; ++loc) {
|
||||||
|
if (ClientTools::myMap[loc] & fUnit) {
|
||||||
|
int cnt = 0;
|
||||||
|
ClientTools::server(sGetUnits, ClientTools::me, loc, &cnt);
|
||||||
|
for (int uix = 0; uix < cnt; ++uix)
|
||||||
|
if (isToCount((*ClientTools::myRO->EnemyUn)[ClientTools::myRO->nEnemyUn + uix].emix))
|
||||||
|
++available;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int uix = 0; uix < ClientTools::myRO->nEnemyUn; ++uix)
|
||||||
|
if ((*ClientTools::myRO->EnemyUn)[uix].Loc >= 0 &&
|
||||||
|
isToCount((*ClientTools::myRO->EnemyUn)[uix].emix))
|
||||||
|
++available;
|
||||||
|
}
|
||||||
|
for (int emix = 0; emix < ClientTools::myRO->nEnemyModel; ++emix)
|
||||||
|
if (isToCount(emix))
|
||||||
|
destroyed += (*ClientTools::myRO->EnemyModel)[emix].Lost;
|
||||||
|
} else {
|
||||||
|
for (int uix = 0; uix < ClientTools::myRO->nUn; ++uix)
|
||||||
|
if (ClientTools::myUn[uix].Loc >= 0 && ClientTools::myUn[uix].mix == mixShow)
|
||||||
|
++available;
|
||||||
|
for (int cix = 0; cix < ClientTools::myRO->nCity; ++cix)
|
||||||
|
if (ClientTools::myCity[cix].Loc >= 0 &&
|
||||||
|
(ClientTools::myCity[cix].Project & (cpImp + cpIndex)) == mixShow)
|
||||||
|
++inProd;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas.font().assign(UniFont[static_cast<std::size_t>(FontType::Small)]);
|
||||||
|
if (kind == UnitStatDialogKind::EnemyCityDefense || kind == UnitStatDialogKind::EnemyCity) {
|
||||||
|
const TCityInfo &ci = (*ClientTools::myRO->EnemyCity)[ecixShow];
|
||||||
|
noMap->setOutput(&offscreen);
|
||||||
|
noMap->paintCity(width() / 2, 53, ci, false);
|
||||||
|
const QString s = Tribes::tribe[ci.Owner]->tPhrase(QStringLiteral("UNITOWNER"));
|
||||||
|
loweredTextOut(canvas, -1, *MainTexture, (width() - biColorTextWidth(canvas, s)) / 2, 105, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kind != UnitStatDialogKind::EnemyCity) {
|
||||||
|
TUnitInfo unitInfo{};
|
||||||
|
TModelInfo mi{};
|
||||||
|
if (kind == UnitStatDialogKind::OwnModel) {
|
||||||
|
MakeModelInfo(ClientTools::me, mixShow, ClientTools::myModel[mixShow], mi);
|
||||||
|
} else if (kind == UnitStatDialogKind::OwnUnit) {
|
||||||
|
MakeUnitInfo(ClientTools::me, ClientTools::myUn[uixShow], unitInfo);
|
||||||
|
MakeModelInfo(ClientTools::me, ClientTools::myUn[uixShow].mix, ClientTools::myModel[ClientTools::myUn[uixShow].mix], mi);
|
||||||
|
} else {
|
||||||
|
mi = *mox;
|
||||||
|
if (kind == UnitStatDialogKind::EnemyUnit || kind == UnitStatDialogKind::EnemyCityDefense)
|
||||||
|
unitInfo = (*ClientTools::myRO->EnemyUn)[euixShow];
|
||||||
|
}
|
||||||
|
|
||||||
|
const Tribes::ModelPicture &mp = Tribes::tribe[mi.Owner]->modelPictureAt(mi.mix);
|
||||||
|
if (kind == UnitStatDialogKind::OwnUnit || kind == UnitStatDialogKind::EnemyUnit ||
|
||||||
|
kind == UnitStatDialogKind::EnemyCityDefense) {
|
||||||
|
canvas.brush().setColor(HGrSystem->data.image().pixelColor(98, 67));
|
||||||
|
canvas.fillRect(QRect(xView, yView, 64, 16));
|
||||||
|
canvas.brush().setStyle(Qt::NoBrush);
|
||||||
|
|
||||||
|
int tx, ty;
|
||||||
|
if ((ClientTools::myMap[unitInfo.Loc] & fTerrain) >= static_cast<std::uint32_t>(fForest)) {
|
||||||
|
tx = 1 + 2 * (noMap->xxt * 2 + 1);
|
||||||
|
ty = 1 + noMap->yyt + 2 * (noMap->yyt * 3 + 1);
|
||||||
|
} else {
|
||||||
|
tx = static_cast<int>(ClientTools::myMap[unitInfo.Loc] & fTerrain) * (noMap->xxt * 2 + 1) + 1;
|
||||||
|
ty = 1 + noMap->yyt;
|
||||||
|
}
|
||||||
|
Term::buffer.setSize(std::max(Term::buffer.width(), noMap->xxt * 2), std::max(Term::buffer.height(), noMap->yyt * 2));
|
||||||
|
Dpi::Canvas &bufCanvas = Term::buffer.canvas();
|
||||||
|
bufCanvas.begin();
|
||||||
|
for (int j = -1; j <= 1; ++j) {
|
||||||
|
for (int i = -1; i <= 1; ++i) {
|
||||||
|
if (((i + j) & 1) == 0) {
|
||||||
|
sprite(bufCanvas, *noMap->hGrTerrain, i * noMap->xxt, j * noMap->yyt, noMap->xxt * 2,
|
||||||
|
noMap->yyt * 2, tx, ty);
|
||||||
|
if ((ClientTools::myMap[unitInfo.Loc] & (fTerrain | fSpecial)) ==
|
||||||
|
static_cast<std::uint32_t>(fGrass | fSpecial1))
|
||||||
|
sprite(bufCanvas, *noMap->hGrTerrain, i * noMap->xxt, j * noMap->yyt, noMap->xxt * 2,
|
||||||
|
noMap->yyt * 2, 1 + 2 * (noMap->xxt * 2 + 1), 1 + noMap->yyt + 1 * (noMap->yyt * 3 + 1));
|
||||||
|
else if ((ClientTools::myMap[unitInfo.Loc] & fTerrain) == static_cast<std::uint32_t>(fForest) &&
|
||||||
|
IsoEngine::isJungle(unitInfo.Loc / ClientTools::g.lx))
|
||||||
|
sprite(bufCanvas, *noMap->hGrTerrain, i * noMap->xxt, j * noMap->yyt, noMap->xxt * 2,
|
||||||
|
noMap->yyt * 2, 1 + 7 * (noMap->xxt * 2 + 1), 1 + noMap->yyt + 19 * (noMap->yyt * 3 + 1));
|
||||||
|
else if ((ClientTools::myMap[unitInfo.Loc] & fTerrain) >= static_cast<std::uint32_t>(fForest))
|
||||||
|
sprite(bufCanvas, *noMap->hGrTerrain, i * noMap->xxt, j * noMap->yyt, noMap->xxt * 2,
|
||||||
|
noMap->yyt * 2, 1 + 7 * (noMap->xxt * 2 + 1),
|
||||||
|
1 + noMap->yyt +
|
||||||
|
2 * static_cast<int>(2 + (ClientTools::myMap[unitInfo.Loc] & fTerrain) - fForest) *
|
||||||
|
(noMap->yyt * 3 + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bufCanvas.end();
|
||||||
|
bitBltBitmap(offscreen, xView, yView + 16, 64, 32, Term::buffer, 1, 0);
|
||||||
|
|
||||||
|
sprite(canvas, *mp.hGr, xView, yView, 64, 48, mp.pix % 10 * 65 + 1, mp.pix / 10 * 49 + 1);
|
||||||
|
if (unitInfo.Flags & unFortified)
|
||||||
|
sprite(canvas, *Tribes::hGrStdUnits, xView, yView, IsoEngine::xxu * 2, IsoEngine::yyu * 2,
|
||||||
|
1 + 6 * (IsoEngine::xxu * 2 + 1), 1);
|
||||||
|
frameImage(canvas, HGrSystem->data, xView - 20, yView + 5, 12, 14,
|
||||||
|
121 + unitInfo.Exp / 50 * 13, 28);
|
||||||
|
if (unitInfo.Health < 100) {
|
||||||
|
const QString s = QString::number(unitInfo.Health) + QLatin1Char('%');
|
||||||
|
lightGradient(canvas, xView - 45, yView + 24, 38,
|
||||||
|
colorFromDelphi(((ClientTools::colorOfHealth(unitInfo.Health) & 0xFEFEFE) >> 2) * 3));
|
||||||
|
risedTextOut(canvas, xView - 45 + 20 - biColorTextWidth(canvas, s) / 2, yView + 23, s);
|
||||||
|
}
|
||||||
|
if (kind == UnitStatDialogKind::EnemyUnit) {
|
||||||
|
const QString s = Tribes::tribe[mox->Owner]->tPhrase(QStringLiteral("UNITOWNER"));
|
||||||
|
loweredTextOut(canvas, -1, *MainTexture, (width() - biColorTextWidth(canvas, s)) / 2, yView + 80, s);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
frameImage(canvas, *bigImp, xView + 4, yView, 56, 40, 0, 0);
|
||||||
|
sprite(canvas, *mp.hGr, xView, yView - 4, 64, 44, mp.pix % 10 * 65 + 1, mp.pix / 10 * 49 + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
darkGradient(canvas, xTotal - 6, yTotal + 1, 180, 2);
|
||||||
|
risedTextOut(canvas, xTotal - 2, yTotal, phrase(QStringLiteral("UNITSTRENGTH")));
|
||||||
|
QString s = QString::number(mi.Attack) + QLatin1Char('/') + QString::number(mi.Defense);
|
||||||
|
risedTextOut(canvas, xTotal + 170 - biColorTextWidth(canvas, s), yTotal, s);
|
||||||
|
featureBar(canvas, xTotal, yTotal + 19, mi, *MainTexture);
|
||||||
|
numberBarS(canvas, xTotal, yTotal + 38, phrase(QStringLiteral("UNITSPEED")), movementToString(mi.Speed),
|
||||||
|
*MainTexture);
|
||||||
|
loweredTextOut(canvas, -1, *MainTexture, xTotal - 2, yTotal + 57, phrase(QStringLiteral("UNITCOST")));
|
||||||
|
dLine(canvas, xTotal - 2, xTotal + 170, yTotal + 57 + 16, MainTexture->colorBevelShade,
|
||||||
|
MainTexture->colorBevelLight);
|
||||||
|
s = ClientTools::g.Difficulty[ClientTools::me] == 0
|
||||||
|
? QString::number(mi.Cost)
|
||||||
|
: QString::number(mi.Cost * BuildCostMod[ClientTools::g.Difficulty[ClientTools::me]] / 12);
|
||||||
|
risedTextOut(canvas, xTotal + 159 - biColorTextWidth(canvas, s), yTotal + 57, s);
|
||||||
|
sprite(canvas, *HGrSystem, xTotal + 160, yTotal + 57 + 5, 10, 10, 88, 115);
|
||||||
|
|
||||||
|
if (kind == UnitStatDialogKind::OwnModel) {
|
||||||
|
const TModel &m = ClientTools::myModel[mixShow];
|
||||||
|
if (m.IntroTurn > 0) {
|
||||||
|
loweredTextOut(canvas, -1, *MainTexture, xTotal - 2, yTotal + StatDown - 19,
|
||||||
|
phrase(m.Kind == mkEnemyDeveloped ? QStringLiteral("UNITADOPT")
|
||||||
|
: QStringLiteral("UNITINTRO")));
|
||||||
|
dLine(canvas, xTotal - 2, xTotal + 170, (yTotal + StatDown - 19) + 16, MainTexture->colorTextShade,
|
||||||
|
MainTexture->colorTextLight);
|
||||||
|
const QString introS = Term::turnToString(m.IntroTurn);
|
||||||
|
risedTextOut(canvas, xTotal + 170 - biColorTextWidth(canvas, introS), yTotal + StatDown - 19, introS);
|
||||||
|
}
|
||||||
|
|
||||||
|
numberBar(canvas, xTotal, yTotal + StatDown, phrase(QStringLiteral("UNITBUILT")), m.Built, *MainTexture);
|
||||||
|
if (m.Lost > 0)
|
||||||
|
numberBar(canvas, xTotal, yTotal + StatDown + 19, phrase(QStringLiteral("UNITLOST")), m.Lost,
|
||||||
|
*MainTexture);
|
||||||
|
if (inProd > 0)
|
||||||
|
numberBar(canvas, xTotal, yTotal + StatDown + 57, phrase(QStringLiteral("UNITINPROD")), inProd,
|
||||||
|
*MainTexture);
|
||||||
|
if (available > 0)
|
||||||
|
numberBar(canvas, xTotal, yTotal + StatDown + 38, phrase(QStringLiteral("UNITAVAILABLE")), available,
|
||||||
|
*MainTexture);
|
||||||
|
|
||||||
|
if (m.Status & Term::msObsolete) {
|
||||||
|
ui->switchBtn->setButtonIndex(12);
|
||||||
|
ui->switchBtn->setToolTip(phrase(QStringLiteral("BTN_OBSOLETE")));
|
||||||
|
} else {
|
||||||
|
ui->switchBtn->setButtonIndex(11);
|
||||||
|
ui->switchBtn->setToolTip(phrase(QStringLiteral("BTN_NONOBSOLETE")));
|
||||||
|
}
|
||||||
|
if ((m.Status & Term::msAllowConscripts) == 0) {
|
||||||
|
ui->conscriptsBtn->setButtonIndex(30);
|
||||||
|
ui->conscriptsBtn->setToolTip(phrase(QStringLiteral("BTN_NOCONSCRIPTS")));
|
||||||
|
} else {
|
||||||
|
ui->conscriptsBtn->setButtonIndex(29);
|
||||||
|
ui->conscriptsBtn->setToolTip(phrase(QStringLiteral("BTN_ALLOWCONSCRIPTS")));
|
||||||
|
}
|
||||||
|
} else if (kind == UnitStatDialogKind::EnemyModel) {
|
||||||
|
if (destroyed > 0)
|
||||||
|
numberBar(canvas, xTotal, yTotal + StatDown - 19, phrase(QStringLiteral("UNITDESTROYED")), destroyed,
|
||||||
|
*MainTexture);
|
||||||
|
if (available > 0)
|
||||||
|
numberBar(canvas, xTotal, yTotal + StatDown, phrase(QStringLiteral("UNITKNOWN")), available,
|
||||||
|
*MainTexture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas.font().assign(UniFont[static_cast<std::size_t>(FontType::Normal)]);
|
||||||
|
int yCaption = yView + 46;
|
||||||
|
switch (kind) {
|
||||||
|
case UnitStatDialogKind::OwnModel:
|
||||||
|
case UnitStatDialogKind::EnemyModel:
|
||||||
|
yCaption = yView + 46;
|
||||||
|
break;
|
||||||
|
case UnitStatDialogKind::EnemyUnit:
|
||||||
|
case UnitStatDialogKind::OwnUnit:
|
||||||
|
yCaption = yView + 54;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
yCaption = 79;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
risedTextOut(canvas, (width() - biColorTextWidth(canvas, windowTitle())) / 2, yCaption, windowTitle());
|
||||||
|
|
||||||
|
canvas.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace UnitStat
|
||||||
|
} // namespace Cevo
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
// This file is part of c-evo-evo.
|
||||||
|
//
|
||||||
|
// This software is governed by the CeCILL license under French law and
|
||||||
|
// abiding by the rules of distribution of free software. You can use,
|
||||||
|
// modify and/or redistribute the software under the terms of the CeCILL
|
||||||
|
// license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
// "http://www.cecill.info".
|
||||||
|
//
|
||||||
|
// As a counterpart to the access to the source code and rights to copy,
|
||||||
|
// modify and redistribute granted by the license, users are provided only
|
||||||
|
// with a limited warranty and the software's author, the holder of the
|
||||||
|
// economic rights, and the successive licensors have only limited
|
||||||
|
// liability.
|
||||||
|
//
|
||||||
|
// In this respect, the user's attention is drawn to the risks associated
|
||||||
|
// with loading, using, modifying and/or developing or reproducing the
|
||||||
|
// software by the user in light of its specific status of free software,
|
||||||
|
// that may mean that it is complicated to manipulate, and that also
|
||||||
|
// therefore means that it is reserved for developers and experienced
|
||||||
|
// professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
// encouraged to load and test the software's suitability as regards their
|
||||||
|
// requirements in conditions enabling the security of their systems and/or
|
||||||
|
// data to be ensured and, more generally, to use and operate it in the
|
||||||
|
// same conditions as regards security.
|
||||||
|
//
|
||||||
|
// The fact that you are presently reading this means that you have had
|
||||||
|
// knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Cevo/CevoBaseWin.h"
|
||||||
|
#include "Cevo/Protocol.h"
|
||||||
|
#include "IsoEngine.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
namespace Ui {
|
||||||
|
class UnitStatDlg;
|
||||||
|
}
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
namespace Cevo {
|
||||||
|
namespace UnitStat {
|
||||||
|
|
||||||
|
enum class UnitStatDialogKind { OwnModel, OwnUnit, EnemyModel, EnemyUnit, EnemyCityDefense, EnemyCity };
|
||||||
|
|
||||||
|
// TUnitStatDlg equivalent: a unit/model/city-defense stat card. UI built
|
||||||
|
// from UnitStat.ui (adapted from the original's UnitStat.lfm).
|
||||||
|
class UnitStatDlg : public BufferedDrawDlg {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit UnitStatDlg(QWidget *parent = nullptr);
|
||||||
|
~UnitStatDlg() override;
|
||||||
|
|
||||||
|
void checkAge();
|
||||||
|
void showNewContentOwnModel(WindowMode newMode, int mix);
|
||||||
|
void showNewContentOwnUnit(WindowMode newMode, int uix);
|
||||||
|
void showNewContentEnemyUnit(WindowMode newMode, int euix);
|
||||||
|
void showNewContentEnemyLoc(WindowMode newMode, int loc);
|
||||||
|
void showNewContentEnemyModel(WindowMode newMode, int emix);
|
||||||
|
void showNewContentEnemyCity(WindowMode newMode, int loc);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void offscreenPaint() override;
|
||||||
|
void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int mixShow = 0; // for OwnModel/OwnUnit
|
||||||
|
int uixShow = 0;
|
||||||
|
int euixShow = -1;
|
||||||
|
int ecixShow = -1;
|
||||||
|
int unitLoc = 0;
|
||||||
|
int agePrepared = -2;
|
||||||
|
const TModelInfo *mox = nullptr; // for EnemyModel/EnemyUnit/EnemyCityDefense
|
||||||
|
UnitStatDialogKind kind = UnitStatDialogKind::OwnModel;
|
||||||
|
Dpi::Bitmap back;
|
||||||
|
Dpi::Bitmap tmpl;
|
||||||
|
std::unique_ptr<IsoEngine::IsoMap> noMap;
|
||||||
|
|
||||||
|
Ui::UnitStatDlg *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace UnitStat
|
||||||
|
} // namespace Cevo
|
||||||
Vendored
+96
@@ -0,0 +1,96 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
This file is part of c-evo-evo.
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can use,
|
||||||
|
modify and/or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
As a counterpart to the access to the source code and rights to copy,
|
||||||
|
modify and redistribute granted by the license, users are provided only
|
||||||
|
with a limited warranty and the software's author, the holder of the
|
||||||
|
economic rights, and the successive licensors have only limited
|
||||||
|
liability.
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
-->
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>UnitStatDlg</class>
|
||||||
|
<widget class="QWidget" name="UnitStatDlg">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>208</width>
|
||||||
|
<height>326</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>C-evo</string>
|
||||||
|
</property>
|
||||||
|
<widget class="Cevo::ButtonB" name="switchBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>12</x>
|
||||||
|
<y>29</y>
|
||||||
|
<width>25</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="Cevo::ButtonB" name="closeBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>177</x>
|
||||||
|
<y>6</y>
|
||||||
|
<width>25</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="Cevo::ButtonB" name="conscriptsBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>43</x>
|
||||||
|
<y>29</y>
|
||||||
|
<width>25</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="Cevo::ButtonC" name="helpBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>178</x>
|
||||||
|
<y>145</y>
|
||||||
|
<width>12</width>
|
||||||
|
<height>12</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>Cevo::ButtonB</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>Cevo/CevoButtonB.h</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>Cevo::ButtonC</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>Cevo/CevoButtonC.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
</ui>
|
||||||
Reference in new issue
Block a user