// 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 #include #include 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; // 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, // 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 impOrder{}; std::array toldWonders{}; std::array 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 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 " BC"/"AD // " (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 mainScreenDipCall; extern std::function 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); // Term.pas's `GameMode: Integer;` (cNewGame/cLoadGame/cMovie/... - which // top-level mode the client is running in). NOT the same thing as // Database::GameMode (a different, server-side enum of the same name in a // different Pascal unit) - don't conflate the two. extern int gameMode; // 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 `LostArmy`/`nLostArmy` (model-indexed lost-unit counts shown // by MessgEx.pas's "army destroyed" report) - stay all-zero until Term.pas // itself is ported and populates them for real. extern std::array lostArmy; 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 initAllEnemyModels; } // namespace Term } // namespace Cevo