From 5512aad587860646d475780a073ac63d5bce8c2e Mon Sep 17 00:00:00 2001 From: ebbit1q Date: Fri, 28 Nov 2025 10:48:54 +0100 Subject: [PATCH] fix compilation errors --- src/data/symbol_font.hpp | 2 +- src/gui/add_csv_window.cpp | 2 +- src/gui/add_json_window.cpp | 2 +- src/script/functions/basic.cpp | 4 ++-- src/script/functions/construction_helper.hpp | 2 +- src/script/functions/json.hpp | 12 +++++----- src/script/parser.cpp | 24 ++++++++++---------- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/data/symbol_font.hpp b/src/data/symbol_font.hpp index 536de710..daa7072e 100644 --- a/src/data/symbol_font.hpp +++ b/src/data/symbol_font.hpp @@ -108,7 +108,7 @@ public: RealSize defaultSymbolSize(double font_size); /// The spacing between symbols, accounting for font size - RealSize SymbolFont::spacingSize(double font_size); + RealSize spacingSize(double font_size); DECLARE_REFLECTION(); }; diff --git a/src/gui/add_csv_window.cpp b/src/gui/add_csv_window.cpp index 2f465a96..028698f6 100644 --- a/src/gui/add_csv_window.cpp +++ b/src/gui/add_csv_window.cpp @@ -167,7 +167,7 @@ void AddCSVWindow::onOk(wxCommandEvent&) { /// Perform the import wxBusyCursor wait; // Read the file - auto& file = std::ifstream(file_path->GetValue().ToStdString()); + auto file = std::ifstream(file_path->GetValue().ToStdString()); if (file.fail()) { queue_message(MESSAGE_ERROR, _ERROR_("add card csv file not found")); EndModal(wxID_ABORT); diff --git a/src/gui/add_json_window.cpp b/src/gui/add_json_window.cpp index b0655102..79e2a632 100644 --- a/src/gui/add_json_window.cpp +++ b/src/gui/add_json_window.cpp @@ -175,7 +175,7 @@ void AddJSONWindow::onOk(wxCommandEvent&) { /// Perform the import wxBusyCursor wait; // Read the file - auto& file = std::ifstream(file_path->GetValue().ToStdString()); + auto file = std::ifstream(file_path->GetValue().ToStdString()); if (file.fail()) { queue_message(MESSAGE_ERROR, _ERROR_("add card json file not found")); EndModal(wxID_ABORT); diff --git a/src/script/functions/basic.cpp b/src/script/functions/basic.cpp index 18b1fc7d..79162d5c 100644 --- a/src/script/functions/basic.cpp +++ b/src/script/functions/basic.cpp @@ -45,7 +45,7 @@ SCRIPT_FUNCTION(get_mse_locale) { SCRIPT_FUNCTION(get_mse_dark_mode) { SCRIPT_RETURN(settings.darkMode()); -} +} SCRIPT_FUNCTION(trace) { SCRIPT_PARAM_C(String, input); @@ -753,7 +753,7 @@ SCRIPT_FUNCTION(get_card_stylesheet) { SCRIPT_PARAM_C(ScriptValueP, set); ScriptObject* c = dynamic_cast*>(input.get()); ScriptObject* s = dynamic_cast*>(set.get()); - if (s && c) { + if (s && c) { return to_script(s->getValue()->stylesheetForP(c->getValue())); } throw ScriptError(_("invalid set or card argument")); diff --git a/src/script/functions/construction_helper.hpp b/src/script/functions/construction_helper.hpp index b5b2fe85..c719409e 100644 --- a/src/script/functions/construction_helper.hpp +++ b/src/script/functions/construction_helper.hpp @@ -40,7 +40,7 @@ inline static Value* get_card_field_container(Game& game, IndexMapget(); } -inline static Value* get_container(IndexMap& map, String& type, String& key_name, bool ignore_field_not_found) { +inline static Value* get_container(IndexMap& map, const String& type, const String& key_name, bool ignore_field_not_found) { // find value container to update IndexMap::const_iterator it = map.find(key_name); if (it == map.end()) { diff --git a/src/script/functions/json.hpp b/src/script/functions/json.hpp index d49e714d..dc850dfc 100644 --- a/src/script/functions/json.hpp +++ b/src/script/functions/json.hpp @@ -222,7 +222,7 @@ inline static CardP json_to_mse_card(boost::json::object& jv, Set* set) { if (jv.contains("extra_data") && jv["extra_data"].is_object()) { boost::json::object datav = jv["extra_data"].as_object(); for (auto it = datav.begin(); it != datav.end(); ++it) { - StyleSheetP& stylesheet = StyleSheet::byGameAndName(*set->game, it->key_c_str()); + StyleSheetP stylesheet = StyleSheet::byGameAndName(*set->game, it->key_c_str()); if (!stylesheet) continue; IndexMap& stylesheet_data = card->extraDataFor(*stylesheet); boost::json::object stylesheet_datav = it->value().as_object(); @@ -245,9 +245,9 @@ inline static SetP json_to_mse_set(boost::json::object& jv) { if (!jv.contains("stylesheet")) { throw ScriptError(_ERROR_("json set without stylesheet")); } - GameP& game = Game::byName(wxString(jv["game"].as_string().c_str())); - StyleSheetP& stylesheet = StyleSheet::byGameAndName(*game, wxString(jv["stylesheet"].as_string().c_str())); - SetP& set = make_intrusive(stylesheet); + GameP game = Game::byName(wxString(jv["game"].as_string().c_str())); + StyleSheetP stylesheet = StyleSheet::byGameAndName(*game, wxString(jv["stylesheet"].as_string().c_str())); + SetP set = make_intrusive(stylesheet); // set fields if (jv.contains("set_info") && jv["set_info"].is_object()) { boost::json::object datav = jv["set_info"].as_object(); @@ -262,7 +262,7 @@ inline static SetP json_to_mse_set(boost::json::object& jv) { if (jv.contains("styling") && jv["styling"].is_object()) { boost::json::object datav = jv["styling"].as_object(); for (auto it = datav.begin(); it != datav.end(); ++it) { - StyleSheetP& stylesheet = StyleSheet::byGameAndName(*set->game, it->key_c_str()); + StyleSheetP stylesheet = StyleSheet::byGameAndName(*set->game, it->key_c_str()); if (!stylesheet) continue; IndexMap& stylesheet_data = set->stylingDataFor(*stylesheet); boost::json::object stylesheet_datav = it->value().as_object(); @@ -528,7 +528,7 @@ inline static boost::json::object mse_to_json(const Set* set) { return setv; } -inline static boost::json::value mse_to_json(ScriptValueP& sv, Set* set) { +inline static boost::json::value mse_to_json(const ScriptValueP& sv, Set* set) { ScriptType type = sv->type(); // special types if (ScriptObject* i = dynamic_cast*>(sv.get())) return mse_to_json(i->getValue()); diff --git a/src/script/parser.cpp b/src/script/parser.cpp index c2818d0d..65de8ff8 100644 --- a/src/script/parser.cpp +++ b/src/script/parser.cpp @@ -44,7 +44,7 @@ struct Token { String value; bool newline; ///< Is there a newline between this token and the previous one? String::const_iterator pos; ///< Start position of the token - + inline bool operator == (TokenType t) const { return type == t; } inline bool operator != (TokenType t) const { return type != t; } inline bool operator == (const String& s) const { return type != TOK_STRING && value == s; } @@ -53,7 +53,7 @@ struct Token { inline bool operator != (const Char* s) const { return type == TOK_STRING || value != s; } }; -enum OpenBrace +enum OpenBrace { BRACE_STRING // " , BRACE_STRING_MODE // fake brace for string mode , BRACE_PAREN // (, [, { @@ -64,7 +64,7 @@ enum OpenBrace class TokenIterator { public: TokenIterator(const String& str, Packaged* package, bool string_mode, String const& filename, vector& errors); - + /// Peek at the next token, doesn't move to the one after that /** Can peek further forward by using higher values of offset. * offset=0 returns the last token that was read, or newline if putBack() was used. @@ -76,10 +76,10 @@ public: /** Only one token can be correctly put back, the put back token will read as a newline. */ void putBack(); - + /// Get the current line number int getLineNumber(); - + private: String::const_iterator pos; const String::const_iterator begin, end; @@ -87,14 +87,14 @@ private: vector buffer; ///< buffer of unread tokens, front() = current stack open_braces; ///< braces/quotes we entered from script mode bool newline; ///< Did we just pass a newline? - + /// Add a token to the buffer, with the current newline value, resets newline void addToken(TokenType type, const String& value, String::const_iterator start); /// Read the next token, and add it to the buffer void readToken(); /// Read the next token, which is a string void readStringToken(bool string_mode = false); - + public: Packaged* package; ///< Package the input is from /// All errors found @@ -186,7 +186,7 @@ void TokenIterator::readToken() { pos += 23; // "include localized file:" const char* newlines = "\r\n"; auto eol = find_first_of(pos, end, newlines, newlines + 2); - String include_file = trim(StringView(pos, eol)) + _("_") + settings.locale; + String include_file = String(trim(StringView(pos, eol))) + _("_") + settings.locale; // include_file("filename_en") addToken(TOK_NAME, "include_file", pos - 23); addToken(TOK_LPAREN, "(", pos); @@ -197,7 +197,7 @@ void TokenIterator::readToken() { pos += 18; // "include dark file:" const char* newlines = "\r\n"; auto eol = find_first_of(pos, end, newlines, newlines + 2); - String include_file = trim(StringView(pos, eol)) + (settings.darkMode() ? _("_dark") : _("")); + String include_file = String(trim(StringView(pos, eol))) + (settings.darkMode() ? _("_dark") : _("")); // include_file("filename_dark") addToken(TOK_NAME, "include_file", pos - 18); addToken(TOK_LPAREN, "(", pos); @@ -398,9 +398,9 @@ enum ExprType /** @param input Read tokens from the input * @param scrip Add resulting instructions to the script * @param min_prec Minimum precedence level for operators - * + * * @returns the type of expression - * + * * NOTE: The net stack effect of an expression should be +1 */ ExprType parseExpr(TokenIterator& input, Script& script, Precedence min_prec); @@ -767,7 +767,7 @@ ExprType parseOper(TokenIterator& input, Script& script, Precedence minPrec, Ins return EXPR_FAILED; } script.getInstructions().pop_back(); - if(token==_("->")) { + if(token==_("->")) { type = parseOper(input, script, PREC_SET, I_SET_GLB, instr.data); } else { type = parseOper(input, script, PREC_SET, I_SET_VAR, instr.data);