added cityscreen with deps

This commit is contained in:
Geoffray Levasseur committed 2026-11-03 16:36:46 +01:00
1 parent 29f47be49b
commit 6773e620cf
6 files changed
+1931

No files matched your search

+63
View File
@@ -29,6 +29,8 @@
#include "Term.h"
#include "Global.h"
#include "Help.h"
#include "IsoEngine.h"
#include "Tribes.h"
namespace Cevo {
@@ -102,9 +104,70 @@ void initMyModel(int mix, bool final)
}
int gameMode = 0;
int age = 0;
std::array<int, nPl * nMmax> lostArmy{};
int nLostArmy = 0;
std::function<void()> initAllEnemyModels = [] {};
const std::array<int, nCityEventPriority> CityEventPriority = {
chDisorder, chImprovementLost, chUnitLost, chAllImpsMade,
chProduction, chOldWonder, chNoSettlerProd, chPopDecrease,
chProductionSabotaged, chNoGrowthWarning, chPollution, chTypeDel,
chFounded, chSiege, chAfterCapture, chPopIncrease,
};
const std::array<QString, 16> CityEventSoundItem = {
QStringLiteral("CITY_DISORDER"), QStringLiteral(""),
QStringLiteral("CITY_POPPLUS"), QStringLiteral("CITY_POPMINUS"),
QStringLiteral("CITY_UNITLOST"), QStringLiteral("CITY_IMPLOST"),
QStringLiteral("CITY_SABOTAGE"), QStringLiteral("CITY_GROWTHNEEDSIMP"),
QStringLiteral("CITY_POLLUTION"), QStringLiteral("CITY_SIEGE"),
QStringLiteral("CITY_WONDEREX"), QStringLiteral("CITY_EMDELAY"),
QStringLiteral("CITY_FOUNDED"), QStringLiteral("CITY_FOUNDED"),
QStringLiteral(""), QStringLiteral("CITY_INVALIDTYPE"),
};
QString cityEventName(int i)
{
// TODO: needs Phrases/Phrases2 (StringTables.pas not ported) - plain
// English fallback descriptions per event index.
static const std::array<QString, 16> fallback = {
QStringLiteral("Civil disorder"), QStringLiteral("Population grows"),
QStringLiteral("Population declines"), QStringLiteral("Unit lost"),
QStringLiteral("Improvement lost"), QStringLiteral("Production sabotaged"),
QStringLiteral("No growth without aqueduct/sewer"), QStringLiteral("Pollution"),
QStringLiteral("City under siege"), QStringLiteral("Wonder obsolete"),
QStringLiteral("Settler production delayed"), QStringLiteral("City founded"),
QStringLiteral("City founded"), QStringLiteral(""),
QStringLiteral("All improvements built"), QStringLiteral(""),
};
if (i == 14) // chAllImpsMade
return fallback[14];
if (i >= 0 && i < static_cast<int>(fallback.size()))
return fallback[static_cast<std::size_t>(i)];
return QString();
}
void helpOnTerrain(int loc, WindowMode newMode)
{
if (ClientTools::myMap[loc] & fDeadLands) {
Help::showNewContent(newMode, Help::LinkCategory::Ter, 3 * 12);
} else if ((ClientTools::myMap[loc] & fTerrain) == fForest &&
IsoEngine::isJungle(loc / ClientTools::g.lx)) {
Help::showNewContent(newMode, Help::LinkCategory::Ter, fJungle + (ClientTools::myMap[loc] >> 5 & 3) * 12);
} else {
Help::showNewContent(newMode, Help::LinkCategory::Ter,
(ClientTools::myMap[loc] & fTerrain) + (ClientTools::myMap[loc] >> 5 & 3) * 12);
}
}
std::function<bool(int, bool, int)> mainScreenZoomToCity = [](int, bool, int) { return false; };
std::function<void(int, bool, bool)> mainScreenCityClosed = [](int, bool, bool) {};
std::function<void(bool)> mainScreenUpdateViews = [](bool) {};
std::function<void()> mainScreenRepaintAll = [] {};
std::function<int(int)> modalSelectDlgShowCityProject = [](int) { return -1; };
std::function<bool(int)> listDlgRenameCity = [](int) { return false; };
std::function<MessgEx::MessgExDlg *()> mainScreenMessgExDlg = [] { return static_cast<MessgEx::MessgExDlg *>(nullptr); };
} // namespace Term
} // namespace Cevo