mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
fix compilation errors
This commit is contained in:
@@ -108,7 +108,7 @@ public:
|
|||||||
RealSize defaultSymbolSize(double font_size);
|
RealSize defaultSymbolSize(double font_size);
|
||||||
|
|
||||||
/// The spacing between symbols, accounting for font size
|
/// The spacing between symbols, accounting for font size
|
||||||
RealSize SymbolFont::spacingSize(double font_size);
|
RealSize spacingSize(double font_size);
|
||||||
|
|
||||||
DECLARE_REFLECTION();
|
DECLARE_REFLECTION();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ void AddCSVWindow::onOk(wxCommandEvent&) {
|
|||||||
/// Perform the import
|
/// Perform the import
|
||||||
wxBusyCursor wait;
|
wxBusyCursor wait;
|
||||||
// Read the file
|
// Read the file
|
||||||
auto& file = std::ifstream(file_path->GetValue().ToStdString());
|
auto file = std::ifstream(file_path->GetValue().ToStdString());
|
||||||
if (file.fail()) {
|
if (file.fail()) {
|
||||||
queue_message(MESSAGE_ERROR, _ERROR_("add card csv file not found"));
|
queue_message(MESSAGE_ERROR, _ERROR_("add card csv file not found"));
|
||||||
EndModal(wxID_ABORT);
|
EndModal(wxID_ABORT);
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ void AddJSONWindow::onOk(wxCommandEvent&) {
|
|||||||
/// Perform the import
|
/// Perform the import
|
||||||
wxBusyCursor wait;
|
wxBusyCursor wait;
|
||||||
// Read the file
|
// Read the file
|
||||||
auto& file = std::ifstream(file_path->GetValue().ToStdString());
|
auto file = std::ifstream(file_path->GetValue().ToStdString());
|
||||||
if (file.fail()) {
|
if (file.fail()) {
|
||||||
queue_message(MESSAGE_ERROR, _ERROR_("add card json file not found"));
|
queue_message(MESSAGE_ERROR, _ERROR_("add card json file not found"));
|
||||||
EndModal(wxID_ABORT);
|
EndModal(wxID_ABORT);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ SCRIPT_FUNCTION(get_mse_locale) {
|
|||||||
|
|
||||||
SCRIPT_FUNCTION(get_mse_dark_mode) {
|
SCRIPT_FUNCTION(get_mse_dark_mode) {
|
||||||
SCRIPT_RETURN(settings.darkMode());
|
SCRIPT_RETURN(settings.darkMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
SCRIPT_FUNCTION(trace) {
|
SCRIPT_FUNCTION(trace) {
|
||||||
SCRIPT_PARAM_C(String, input);
|
SCRIPT_PARAM_C(String, input);
|
||||||
@@ -753,7 +753,7 @@ SCRIPT_FUNCTION(get_card_stylesheet) {
|
|||||||
SCRIPT_PARAM_C(ScriptValueP, set);
|
SCRIPT_PARAM_C(ScriptValueP, set);
|
||||||
ScriptObject<CardP>* c = dynamic_cast<ScriptObject<CardP>*>(input.get());
|
ScriptObject<CardP>* c = dynamic_cast<ScriptObject<CardP>*>(input.get());
|
||||||
ScriptObject<Set*>* s = dynamic_cast<ScriptObject<Set*>*>(set.get());
|
ScriptObject<Set*>* s = dynamic_cast<ScriptObject<Set*>*>(set.get());
|
||||||
if (s && c) {
|
if (s && c) {
|
||||||
return to_script(s->getValue()->stylesheetForP(c->getValue()));
|
return to_script(s->getValue()->stylesheetForP(c->getValue()));
|
||||||
}
|
}
|
||||||
throw ScriptError(_("invalid set or card argument"));
|
throw ScriptError(_("invalid set or card argument"));
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ inline static Value* get_card_field_container(Game& game, IndexMap<FieldP, Value
|
|||||||
return it->get();
|
return it->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static Value* get_container(IndexMap<FieldP, ValueP>& map, String& type, String& key_name, bool ignore_field_not_found) {
|
inline static Value* get_container(IndexMap<FieldP, ValueP>& map, const String& type, const String& key_name, bool ignore_field_not_found) {
|
||||||
// find value container to update
|
// find value container to update
|
||||||
IndexMap<FieldP, ValueP>::const_iterator it = map.find(key_name);
|
IndexMap<FieldP, ValueP>::const_iterator it = map.find(key_name);
|
||||||
if (it == map.end()) {
|
if (it == map.end()) {
|
||||||
|
|||||||
@@ -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()) {
|
if (jv.contains("extra_data") && jv["extra_data"].is_object()) {
|
||||||
boost::json::object datav = jv["extra_data"].as_object();
|
boost::json::object datav = jv["extra_data"].as_object();
|
||||||
for (auto it = datav.begin(); it != datav.end(); ++it) {
|
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;
|
if (!stylesheet) continue;
|
||||||
IndexMap<FieldP, ValueP>& stylesheet_data = card->extraDataFor(*stylesheet);
|
IndexMap<FieldP, ValueP>& stylesheet_data = card->extraDataFor(*stylesheet);
|
||||||
boost::json::object stylesheet_datav = it->value().as_object();
|
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")) {
|
if (!jv.contains("stylesheet")) {
|
||||||
throw ScriptError(_ERROR_("json set without stylesheet"));
|
throw ScriptError(_ERROR_("json set without stylesheet"));
|
||||||
}
|
}
|
||||||
GameP& game = Game::byName(wxString(jv["game"].as_string().c_str()));
|
GameP game = Game::byName(wxString(jv["game"].as_string().c_str()));
|
||||||
StyleSheetP& stylesheet = StyleSheet::byGameAndName(*game, wxString(jv["stylesheet"].as_string().c_str()));
|
StyleSheetP stylesheet = StyleSheet::byGameAndName(*game, wxString(jv["stylesheet"].as_string().c_str()));
|
||||||
SetP& set = make_intrusive<Set>(stylesheet);
|
SetP set = make_intrusive<Set>(stylesheet);
|
||||||
// set fields
|
// set fields
|
||||||
if (jv.contains("set_info") && jv["set_info"].is_object()) {
|
if (jv.contains("set_info") && jv["set_info"].is_object()) {
|
||||||
boost::json::object datav = jv["set_info"].as_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()) {
|
if (jv.contains("styling") && jv["styling"].is_object()) {
|
||||||
boost::json::object datav = jv["styling"].as_object();
|
boost::json::object datav = jv["styling"].as_object();
|
||||||
for (auto it = datav.begin(); it != datav.end(); ++it) {
|
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;
|
if (!stylesheet) continue;
|
||||||
IndexMap<FieldP, ValueP>& stylesheet_data = set->stylingDataFor(*stylesheet);
|
IndexMap<FieldP, ValueP>& stylesheet_data = set->stylingDataFor(*stylesheet);
|
||||||
boost::json::object stylesheet_datav = it->value().as_object();
|
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;
|
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();
|
ScriptType type = sv->type();
|
||||||
// special types
|
// special types
|
||||||
if (ScriptObject<PackItemP>* i = dynamic_cast<ScriptObject<PackItemP>*>(sv.get())) return mse_to_json(i->getValue());
|
if (ScriptObject<PackItemP>* i = dynamic_cast<ScriptObject<PackItemP>*>(sv.get())) return mse_to_json(i->getValue());
|
||||||
|
|||||||
+12
-12
@@ -44,7 +44,7 @@ struct Token {
|
|||||||
String value;
|
String value;
|
||||||
bool newline; ///< Is there a newline between this token and the previous one?
|
bool newline; ///< Is there a newline between this token and the previous one?
|
||||||
String::const_iterator pos; ///< Start position of the token
|
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 != (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; }
|
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; }
|
inline bool operator != (const Char* s) const { return type == TOK_STRING || value != s; }
|
||||||
};
|
};
|
||||||
|
|
||||||
enum OpenBrace
|
enum OpenBrace
|
||||||
{ BRACE_STRING // "
|
{ BRACE_STRING // "
|
||||||
, BRACE_STRING_MODE // fake brace for string mode
|
, BRACE_STRING_MODE // fake brace for string mode
|
||||||
, BRACE_PAREN // (, [, {
|
, BRACE_PAREN // (, [, {
|
||||||
@@ -64,7 +64,7 @@ enum OpenBrace
|
|||||||
class TokenIterator {
|
class TokenIterator {
|
||||||
public:
|
public:
|
||||||
TokenIterator(const String& str, Packaged* package, bool string_mode, String const& filename, vector<ScriptParseError>& errors);
|
TokenIterator(const String& str, Packaged* package, bool string_mode, String const& filename, vector<ScriptParseError>& errors);
|
||||||
|
|
||||||
/// Peek at the next token, doesn't move to the one after that
|
/// Peek at the next token, doesn't move to the one after that
|
||||||
/** Can peek further forward by using higher values of offset.
|
/** 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.
|
* 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.
|
/** Only one token can be correctly put back, the put back token will read as a newline.
|
||||||
*/
|
*/
|
||||||
void putBack();
|
void putBack();
|
||||||
|
|
||||||
/// Get the current line number
|
/// Get the current line number
|
||||||
int getLineNumber();
|
int getLineNumber();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
String::const_iterator pos;
|
String::const_iterator pos;
|
||||||
const String::const_iterator begin, end;
|
const String::const_iterator begin, end;
|
||||||
@@ -87,14 +87,14 @@ private:
|
|||||||
vector<Token> buffer; ///< buffer of unread tokens, front() = current
|
vector<Token> buffer; ///< buffer of unread tokens, front() = current
|
||||||
stack<OpenBrace> open_braces; ///< braces/quotes we entered from script mode
|
stack<OpenBrace> open_braces; ///< braces/quotes we entered from script mode
|
||||||
bool newline; ///< Did we just pass a newline?
|
bool newline; ///< Did we just pass a newline?
|
||||||
|
|
||||||
/// Add a token to the buffer, with the current newline value, resets 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);
|
void addToken(TokenType type, const String& value, String::const_iterator start);
|
||||||
/// Read the next token, and add it to the buffer
|
/// Read the next token, and add it to the buffer
|
||||||
void readToken();
|
void readToken();
|
||||||
/// Read the next token, which is a string
|
/// Read the next token, which is a string
|
||||||
void readStringToken(bool string_mode = false);
|
void readStringToken(bool string_mode = false);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Packaged* package; ///< Package the input is from
|
Packaged* package; ///< Package the input is from
|
||||||
/// All errors found
|
/// All errors found
|
||||||
@@ -186,7 +186,7 @@ void TokenIterator::readToken() {
|
|||||||
pos += 23; // "include localized file:"
|
pos += 23; // "include localized file:"
|
||||||
const char* newlines = "\r\n";
|
const char* newlines = "\r\n";
|
||||||
auto eol = find_first_of(pos, end, newlines, newlines + 2);
|
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")
|
// include_file("filename_en")
|
||||||
addToken(TOK_NAME, "include_file", pos - 23);
|
addToken(TOK_NAME, "include_file", pos - 23);
|
||||||
addToken(TOK_LPAREN, "(", pos);
|
addToken(TOK_LPAREN, "(", pos);
|
||||||
@@ -197,7 +197,7 @@ void TokenIterator::readToken() {
|
|||||||
pos += 18; // "include dark file:"
|
pos += 18; // "include dark file:"
|
||||||
const char* newlines = "\r\n";
|
const char* newlines = "\r\n";
|
||||||
auto eol = find_first_of(pos, end, newlines, newlines + 2);
|
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")
|
// include_file("filename_dark")
|
||||||
addToken(TOK_NAME, "include_file", pos - 18);
|
addToken(TOK_NAME, "include_file", pos - 18);
|
||||||
addToken(TOK_LPAREN, "(", pos);
|
addToken(TOK_LPAREN, "(", pos);
|
||||||
@@ -398,9 +398,9 @@ enum ExprType
|
|||||||
/** @param input Read tokens from the input
|
/** @param input Read tokens from the input
|
||||||
* @param scrip Add resulting instructions to the script
|
* @param scrip Add resulting instructions to the script
|
||||||
* @param min_prec Minimum precedence level for operators
|
* @param min_prec Minimum precedence level for operators
|
||||||
*
|
*
|
||||||
* @returns the type of expression
|
* @returns the type of expression
|
||||||
*
|
*
|
||||||
* NOTE: The net stack effect of an expression should be +1
|
* NOTE: The net stack effect of an expression should be +1
|
||||||
*/
|
*/
|
||||||
ExprType parseExpr(TokenIterator& input, Script& script, Precedence min_prec);
|
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;
|
return EXPR_FAILED;
|
||||||
}
|
}
|
||||||
script.getInstructions().pop_back();
|
script.getInstructions().pop_back();
|
||||||
if(token==_("->")) {
|
if(token==_("->")) {
|
||||||
type = parseOper(input, script, PREC_SET, I_SET_GLB, instr.data);
|
type = parseOper(input, script, PREC_SET, I_SET_GLB, instr.data);
|
||||||
} else {
|
} else {
|
||||||
type = parseOper(input, script, PREC_SET, I_SET_VAR, instr.data);
|
type = parseOper(input, script, PREC_SET, I_SET_VAR, instr.data);
|
||||||
|
|||||||
Reference in New Issue
Block a user