mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 05:36:59 -04:00
Implement unique IDs and card linking
This commit is contained in:
@@ -196,7 +196,7 @@ bool Package::existsIn(const String& file) {
|
||||
if (filename.find(_(".mse-")) != String::npos) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unique_ptr<wxInputStream> stream;
|
||||
if (it != files.end() && it->second.wasWritten()) {
|
||||
@@ -216,7 +216,7 @@ bool Package::existsIn(const String& file) {
|
||||
return false;
|
||||
}
|
||||
return stream && stream->IsOk();
|
||||
}
|
||||
}
|
||||
|
||||
unique_ptr<wxInputStream> Package::openIn(const String& file) {
|
||||
if (!file.empty() && file.GetChar(0) == _('/')) {
|
||||
|
||||
@@ -107,7 +107,7 @@ bool PackageManager::existsInPackage(const String& name) {
|
||||
}
|
||||
}
|
||||
throw FileNotFoundError(name, _("No package name specified, use '/package/filename'"));
|
||||
}
|
||||
}
|
||||
|
||||
pair<unique_ptr<wxInputStream>,Packaged*> PackageManager::openFileFromPackage(Packaged* package, const String& name) {
|
||||
if (!name.empty() && name.GetChar(0) == _('/')) {
|
||||
|
||||
@@ -357,10 +357,10 @@ template <> void Reader::handle(Vector2D& vec) {
|
||||
template <> void Reader::handle(LocalFileName& f) {
|
||||
f = LocalFileName::fromReadString(this->getValue());
|
||||
}
|
||||
|
||||
String Reader::addLocale(String filename) {
|
||||
return filename + _("_") + settings.locale;
|
||||
}
|
||||
|
||||
String Reader::addLocale(String filename) {
|
||||
return filename + _("_") + settings.locale;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : EnumReader
|
||||
|
||||
|
||||
@@ -116,9 +116,9 @@ public:
|
||||
|
||||
/// The package being read from
|
||||
inline Packaged* getPackage() const { return package; }
|
||||
|
||||
String addLocale(String);
|
||||
|
||||
|
||||
String addLocale(String);
|
||||
|
||||
/// Set the value that will be returned by the next getValue() call (may mess up the state of the reader)
|
||||
inline void setValue(const String& value) { state = UNHANDLED; previous_value = value; };
|
||||
|
||||
@@ -180,7 +180,7 @@ private:
|
||||
/** Maybe the key is "include file" */
|
||||
template <typename T>
|
||||
void unknownKey(T& v) {
|
||||
if (key == _("include_file") || key == _("include_localized_file")) {
|
||||
if (key == _("include_file") || key == _("include_localized_file")) {
|
||||
value = key == _("include_localized_file") ? addLocale(value) : value;
|
||||
auto [stream, include_package] = openFileFromPackage(package, value);
|
||||
Reader sub_reader(*stream, include_package, value, ignore_invalid);
|
||||
|
||||
Reference in New Issue
Block a user