128 lines
5.5 KiB
C++
128 lines
5.5 KiB
C++
// 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/CevoScreenTools.h"
|
|
#include "Cevo/Protocol.h"
|
|
#include "ClientTools.h"
|
|
|
|
#include <QString>
|
|
|
|
#include <array>
|
|
#include <functional>
|
|
|
|
namespace Cevo {
|
|
namespace Term {
|
|
|
|
// PORT STATUS: Term.pas itself (~7500 lines, the main game screen) is NOT
|
|
// ported - it needs ~14 other LocalPlayer dialogs that don't exist yet
|
|
// (see /memories/repo/cevo-evo-game.md for the port order). This file only
|
|
// pre-seeds the handful of Term.pas globals/constants/helpers that the
|
|
// LEAF dialogs (CityType, ...) need from it; real Term.pas content gets
|
|
// added into this same namespace/file set once its turn comes.
|
|
|
|
constexpr int nCityType = 4;
|
|
// icons.bmp properties: lines of system icons before improvements start.
|
|
constexpr int xSizeSmall = 36;
|
|
constexpr int ySizeSmall = 20;
|
|
constexpr int SystemIconLines = 2;
|
|
|
|
// Term.pas's `TPersistentData` (per-player persisted client-side settings,
|
|
// e.g. city build-order preferences) - only the fields some leaf dialog
|
|
// needs are ported so far; add more as needed.
|
|
struct PersistentData {
|
|
int farTech = 0;
|
|
int toldAge = 0;
|
|
int toldModels = 0;
|
|
int toldAlive = 0;
|
|
int toldContact = 0;
|
|
int toldOwnCredibility = 0;
|
|
int coldWarStart = 0;
|
|
int peaceEvaHappened = 0;
|
|
ClientTools::TEnhancementJobs enhancementJobs{};
|
|
std::array<ClientTools::TImpOrder, nCityType> impOrder{};
|
|
std::array<TWonderInfo, nWonder> toldWonders{};
|
|
std::array<std::int8_t, nAdv> toldTech{};
|
|
};
|
|
|
|
// Term.pas's `MyData: ^TPersistentData;` - null until a real game/turn is
|
|
// active (set by Term.pas's InitTurn(), not yet ported).
|
|
extern PersistentData *myData;
|
|
|
|
// Term.pas's `SmallImp: TBitmap;` (icons.bmp sprite sheet, small size) -
|
|
// populated by Term.pas's asset loading, not yet ported.
|
|
extern Dpi::Bitmap *smallImp;
|
|
|
|
// Equivalent of Term.pas's ImpImage(): draws an improvement/wonder icon
|
|
// from bigImp, substituting the age-specific palace graphic for imPalace.
|
|
void impImage(Dpi::Canvas &canvas, int x, int y, int iix, int government = -1, bool isControl = false);
|
|
|
|
// Term.pas's `OptionChecked: TSaveOptions;` (user-configurable UI options).
|
|
extern ClientTools::SaveOptions optionChecked;
|
|
// Term.pas's `Supervising: Boolean;` (true when controlling player 0 is
|
|
// just observing rather than playing a nation).
|
|
extern bool supervising;
|
|
|
|
// Term.pas's `TDipMem` (per-nation negotiation session memory) - only the
|
|
// one field (`pContact`) anything needs so far.
|
|
struct DipMemEntry {
|
|
int pContact = -1;
|
|
};
|
|
extern std::array<DipMemEntry, nPl> dipMem;
|
|
|
|
// Term.pas's RoughCredibility(): buckets a 0..100 credibility value into a
|
|
// 4-level rating (0..3) for display.
|
|
int roughCredibility(int credibility);
|
|
|
|
// ScreenTools.pas's TurnToString(): turnToYear() formatted as "<n> BC"/"AD
|
|
// <n>" (or the plain turn number if `generateNames` is off). Lives here
|
|
// rather than in the widget-layer CevoScreenTools.h since it needs
|
|
// Global::generateNames (a game-layer symbol widget/ mustn't depend on).
|
|
QString turnToString(int turn);
|
|
|
|
// Term.pas's `MainScreen: TMainScreen` instance isn't ported; these mirror
|
|
// its DipCall()/ContactRefused() methods as injection points other leaf
|
|
// dialogs can call into once Term.pas/Nego.pas exist. Default to safe
|
|
// no-ops (DipCall "not executed", ContactRefused "not refused") so callers
|
|
// relying on them just see "nothing happened" rather than crashing.
|
|
extern std::function<int(int command)> mainScreenDipCall;
|
|
extern std::function<bool(int p, const QString &item)> mainScreenContactRefused;
|
|
|
|
// Term.pas's ChooseModelPicture()/InitMyModel(): assigns a visual "picture"
|
|
// to a developed/enemy unit model. Simplified - always takes the
|
|
// "non-original tribe" path (dispatches straight through
|
|
// Tribe::setModelPicture()) since the network cSet*ModelPicture command
|
|
// plumbing isn't ported, and the mkSlaves (Code==74) special case isn't
|
|
// handled either (narrow edge case, not reached by anything ported so far).
|
|
void chooseModelPicture(int p, int mix, int code, int hash, int turn, bool forceNew, bool final);
|
|
void initMyModel(int mix, bool final);
|
|
|
|
} // namespace Term
|
|
} // namespace Cevo
|