// 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 // TMainScreen equivalent - PARTIAL PORT (session 1 of what will be a many- // session effort, see /memories/repo/cevo-evo-game.md for the full 183- // method inventory + proposed 10-file split). This slice only covers: the // 17 lazy dialog accessors, arrangeDialog()/arrangeDialogs(), and the // handful of small cross-dialog methods (dipCall/offerCall/ // contactRefused/updateViews/setAIName/rememberPeaceViolation) that every // other LocalPlayer dialog already has a `Term::mainScreenXxx` // std::function injection point standing in for - this class's // constructor wires all of those through to real methods below. The full // map/panel/menu system (MainOffscreenPaint/PanelPaint/Client() etc.) is // NOT part of this slice and remains future work - this header is kept // SEPARATE from the widely-included Term.h specifically so consumers that // only need the `Term::mainScreen` pointer don't have to transitively // include all 17 dialog headers below. #include "Battle.h" #include "CityScreen.h" #include "CityType.h" #include "Diagram.h" #include "Draft.h" #include "Enhance.h" #include "Help.h" #include "Log.h" #include "MessgEx.h" #include "NatStat.h" #include "Nego.h" #include "Rates.h" #include "Select.h" #include "TechTree.h" #include "Term.h" #include "UnitStat.h" #include "Wonders.h" #include namespace Cevo { namespace Term { class MainScreen : public DrawDlg { Q_OBJECT public: explicit MainScreen(QWidget *parent = nullptr); ~MainScreen() override; Wonders::WondersDlg &wondersDlg(); TechTree::TechTreeDlg &techTreeDlg(); Enhance::EnhanceDlg &enhanceDlg(); Nego::NegoDlg &negoDlg(); CityType::CityTypeDlg &cityTypeDlg(); Diagram::DiaDlg &diaDlg(); CityScreen::CityDlg &cityDlg(); Rates::RatesDlg &ratesDlg(); Battle::BattleDlg &battleDlg(); NatStat::NatStatDlg &natStatDlg(); UnitStat::UnitStatDlg &unitStatDlg(); Draft::DraftDlg &draftDlg(); Select::ModalSelectDlg &modalSelectDlg(); Select::ListDlg &listDlg(); MessgEx::MessgExDlg &messgExDlg(); Help::HelpDlg &helpDlg(); Cevo::LogDlg &logDlg(); // Positions a just-created persistent dialog relative to the (not yet // ported) main screen's primary monitor - self-contained, doesn't // need the real map/panel to exist. void arrangeDialog(BufferedDrawDlg *form); void arrangeDialogs(); int dipCall(int command); int offerCall(TOffer &offer); // TODO: needs PanelPaint/the real main map (not ported yet) - only // the already-portable side (ListDlg::ecoChange()/NatStatDlg:: // ecoChange()/CityDlg::smartUpdateContent()) runs for now. void updateViews(bool updateCityScreen = false); bool contactRefused(int p, const QString &item); // TODO: needs the real main map/panel (not ported yet) - no-op until // then (matches the original's RepaintAll()'s sole purpose). void repaintAll() {} void setAIName(int p, const QString &name); void rememberPeaceViolation(); // Term.pas's GetTribeList(): fills unusedTribeFiles from the Tribes directory. void getTribeList(); // Picks (at random among the best) the unused tribe whose colour differs most from the tribes in play. int chooseUnusedTribe(); void showEnemyShipChange(const TShowShipChange &showShipChange); // Term.pas's InitModule()/DoneModule(): one-time asset/table setup // (advance icons, StdUnits graphics, smallImp). void initModule(); void doneModule(); // Term.pas's TMainScreen.Client(): the in-process client entry point the // server calls for the human player. See Term.MainScreen.Client.cpp for // which commands are served so far. void client(int command, int newPlayer, void *data); // Term.pas's EndNego(): leaves the negotiation screen. void endNego(); private: // Term.pas's implementation-level state (Jump/pLogo/GameOK/Idle/...). std::array m_jump{}; int m_pLogo = -1; bool m_gameOK = true; bool m_idle = false; bool m_startRunning = false; bool m_firstMovieTurn = true; bool m_closable = false; int m_movieSpeed = 1; std::unique_ptr m_wondersDlg; std::unique_ptr m_techTreeDlg; std::unique_ptr m_enhanceDlg; std::unique_ptr m_negoDlg; std::unique_ptr m_cityTypeDlg; std::unique_ptr m_diaDlg; std::unique_ptr m_cityDlg; std::unique_ptr m_ratesDlg; std::unique_ptr m_battleDlg; std::unique_ptr m_natStatDlg; std::unique_ptr m_unitStatDlg; std::unique_ptr m_draftDlg; std::unique_ptr m_modalSelectDlg; std::unique_ptr m_listDlg; std::unique_ptr m_messgExDlg; std::unique_ptr m_helpDlg; std::unique_ptr m_logDlg; }; enum class FormAction { Close, Enable, Disable, Update, SmartUpdateContent }; // Term.pas's ApplyToVisibleForms(): applies the action to every visible // BufferedDrawDlg window. void applyToVisibleForms(FormAction formAction); // Term.pas's ChooseResearch(): lets the player pick the next research // (including the draft of a new military unit class / far advance). Returns // false if the player cancelled. bool chooseResearch(); } // namespace Term } // namespace Cevo