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:
@@ -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<CardP>* c = dynamic_cast<ScriptObject<CardP>*>(input.get());
|
||||
ScriptObject<Set*>* s = dynamic_cast<ScriptObject<Set*>*>(set.get());
|
||||
if (s && c) {
|
||||
if (s && c) {
|
||||
return to_script(s->getValue()->stylesheetForP(c->getValue()));
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
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
|
||||
IndexMap<FieldP, ValueP>::const_iterator it = map.find(key_name);
|
||||
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()) {
|
||||
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<FieldP, ValueP>& 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<Set>(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<Set>(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<FieldP, ValueP>& 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<PackItemP>* i = dynamic_cast<ScriptObject<PackItemP>*>(sv.get())) return mse_to_json(i->getValue());
|
||||
|
||||
+12
-12
@@ -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<ScriptParseError>& 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<Token> buffer; ///< buffer of unread tokens, front() = current
|
||||
stack<OpenBrace> 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);
|
||||
|
||||
Reference in New Issue
Block a user