multiple sparce implementations for main window
This commit is contained in:
1 parent
8e7d483471
commit
e59988ab1d
9 files changed
+1091
-25
No files matched your search
+93
-6
@@ -35,9 +35,13 @@
|
||||
#include "MessgEx.h"
|
||||
#include "NatStat.h"
|
||||
#include "Select.h"
|
||||
#include "Tribes.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
#include <cstdint>
|
||||
@@ -68,6 +72,22 @@ constexpr int SystemIconLines = 2;
|
||||
constexpr int msObsolete = 0x1;
|
||||
constexpr int msAllowConscripts = 0x2;
|
||||
|
||||
// Client exclusive commands (relayed by the server to the other clients).
|
||||
constexpr int cSetTribe = 0x9000;
|
||||
constexpr int cSetNewModelPicture = 0x9100;
|
||||
constexpr int cSetModelName = 0x9110;
|
||||
constexpr int cSetModelPicture = 0x9120;
|
||||
constexpr int cSetSlaveIndex = 0x9131;
|
||||
constexpr int cSetCityName = 0x9200;
|
||||
|
||||
// TUn.Status bit flags not already in IsoEngine.h.
|
||||
constexpr int usWaiting = 0x02;
|
||||
constexpr int usToldNoReturn = 0x100;
|
||||
|
||||
// Index of the slaves/no-slaves pictures in StdUnits.
|
||||
constexpr int pixSlaves = 0;
|
||||
constexpr int pixNoSlaves = 1;
|
||||
|
||||
// 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;
|
||||
@@ -180,10 +200,13 @@ extern std::uint32_t cityRepMask;
|
||||
// as lostArmy[]/nLostArmy).
|
||||
extern std::array<int, nAdv> advIcon;
|
||||
|
||||
// Term.pas's layout constant (MidPanelHeight - TopBarHeight) div 2; the
|
||||
// two panel-size constants it derives from belong to Term's not-yet-ported
|
||||
// main window layout, so only the resulting fixed value is pre-seeded here.
|
||||
constexpr int MapCenterUp = 39;
|
||||
// Term.pas's layout constants (main window layout, now that TMainScreen
|
||||
// itself is being ported for real).
|
||||
constexpr int TopBarHeight = 41;
|
||||
constexpr int PanelHeight = 168;
|
||||
constexpr int MidPanelHeight = 120;
|
||||
// (MidPanelHeight - TopBarHeight) div 2 = (120 - 41) div 2 = 39.
|
||||
constexpr int MapCenterUp = (MidPanelHeight - TopBarHeight) / 2;
|
||||
|
||||
// Term.pas's `LostArmy`/`nLostArmy` (model-indexed lost-unit counts shown
|
||||
// by MessgEx.pas's "army destroyed" report) - stay all-zero until Term.pas
|
||||
@@ -193,8 +216,9 @@ extern int nLostArmy;
|
||||
|
||||
// Term.pas's InitAllEnemyModels()/InitEnemyModel(): resolves a picture for
|
||||
// every known enemy unit model so MessgEx.pas's "enemy army" report can
|
||||
// draw them. Injection point (default no-op) until Term.pas is ported.
|
||||
extern std::function<void()> initAllEnemyModels;
|
||||
// draw them.
|
||||
bool initEnemyModel(int emix);
|
||||
void initAllEnemyModels();
|
||||
|
||||
// Term.pas's own "city status flags"/additional "city happened flags"
|
||||
// constants (distinct from Protocol.pas's chXxx flags in ai/Protocol.h).
|
||||
@@ -249,5 +273,68 @@ extern std::function<NatStat::NatStatDlg *()> mainScreenNatStatDlg;
|
||||
// eInvalid by default.
|
||||
extern std::function<int(const TOffer &offer)> mainScreenOfferCall;
|
||||
|
||||
// Term.pas's TTribeInfo/TCityNameInfo/TModelNameInfo: payloads of the
|
||||
// client exclusive commands. pack() yields the wire layout (int32 + Pascal
|
||||
// ShortString: length byte then bytes), commandDataSize() is the size to
|
||||
// pass to commandWithData().
|
||||
struct TribeInfo {
|
||||
int trix = 0;
|
||||
QString fileName;
|
||||
QByteArray pack() const;
|
||||
std::uint8_t commandDataSize() const;
|
||||
};
|
||||
struct CityNameInfo {
|
||||
int id = 0;
|
||||
QString newName;
|
||||
QByteArray pack() const;
|
||||
std::uint8_t commandDataSize() const;
|
||||
};
|
||||
struct ModelNameInfo {
|
||||
int mix = 0;
|
||||
QString newName;
|
||||
QByteArray pack() const;
|
||||
std::uint8_t commandDataSize() const;
|
||||
};
|
||||
// Wire layout of Tribes::ModelPictureInfo (4 int32 + ShortString).
|
||||
QByteArray packModelPictureInfo(const Tribes::ModelPictureInfo &info);
|
||||
Tribes::ModelPictureInfo unpackModelPictureInfo(const void *data);
|
||||
|
||||
// Term.pas's `TribeOriginal`: whether tribe p comes from the original
|
||||
// (non-network-relayed) game rather than being created for a movie/viewer.
|
||||
extern std::array<bool, nPl> tribeOriginal;
|
||||
// Term.pas's `ToldSlavery` (1 once slavery has been announced).
|
||||
extern int toldSlavery;
|
||||
|
||||
QString attackSound(int code);
|
||||
int alignUp(int value, int alignment);
|
||||
// Term.pas's InitSmallImp(): builds smallImp by scaling down bigImp.
|
||||
void initSmallImp();
|
||||
// Clears the "low fuel warning" flag of an aircraft that made it back.
|
||||
void checkToldNoReturn(int uix);
|
||||
// Loads the tribe file and registers the tribe's standard model pictures.
|
||||
bool createTribe(int p, QString fileName, bool original);
|
||||
void tellNewContacts();
|
||||
void tellNewModels();
|
||||
|
||||
// Term.pas's `UnusedTribeFiles` (name + colour of every tribe file not yet in play).
|
||||
struct UnusedTribe {
|
||||
QString fileName;
|
||||
QColor color;
|
||||
};
|
||||
extern std::vector<UnusedTribe> unusedTribeFiles;
|
||||
|
||||
// Term.pas's `TaxSum`/`ScienceSum: Integer;` (aggregate tax/science totals
|
||||
// across all owned cities, refreshed by MainScreen::updateViews()).
|
||||
extern int taxSum;
|
||||
extern int scienceSum;
|
||||
|
||||
// Term.pas's `TMainScreen` - the main game window; see
|
||||
// Term.MainScreen.h/.cpp for the real class (kept out of this
|
||||
// widely-included pre-seed header to avoid pulling in every dialog
|
||||
// header transitively - consumers that only need the global instance
|
||||
// pointer can use this forward declaration).
|
||||
class MainScreen;
|
||||
extern MainScreen *mainScreen;
|
||||
|
||||
} // namespace Term
|
||||
} // namespace Cevo
|
||||
Reference in new issue
Block a user