fixed: version number propagates to included files

magic pack template now uses 'pack type' instead of 'pack item'

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1331 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2009-01-10 02:43:15 +00:00
parent 30d3343a2c
commit c7c028b026
3 changed files with 32 additions and 28 deletions
+6 -2
View File
@@ -30,14 +30,18 @@ Reader::Reader(const InputStreamP& input, Packaged* package, const String& filen
handleAppVersion();
}
Reader::Reader(Packaged* pkg, const String& filename, bool ignore_invalid)
Reader::Reader(Reader* parent, Packaged* pkg, const String& filename, bool ignore_invalid)
: indent(0), expected_indent(0), state(OUTSIDE)
, ignore_invalid(ignore_invalid)
, filename(filename), package(pkg), line_number(0), previous_line_number(0)
, input(package_manager.openFileFromPackage(package, filename))
{
moveNext();
// in an included file, use the app version of the parent if we have none
handleAppVersion();
if (file_app_version == 0) {
file_app_version = parent->file_app_version;
}
}
void Reader::addAlias(Version end_version, const Char* a, const Char* b) {
@@ -53,7 +57,7 @@ void Reader::handleIgnore(int end_version, const Char* a) {
}
void Reader::handleAppVersion() {
if (enterBlock(_("mse_version"))) {
if (enterBlock(_("mse_version"))) {
handle(file_app_version);
if (app_version < file_app_version) {
handle_warning(_ERROR_2_("newer version", filename, file_app_version.toString()), false);
+7 -7
View File
@@ -32,18 +32,18 @@ typedef shared_ptr<wxInputStream> InputStreamP;
* object that was just read.
*/
class Reader {
private:
/// Construct a reader that reads a file in a package
/** Used for "include file" keys.
* package can be nullptr
*/
Reader(Reader* parent, Packaged* package, const String& filename, bool ignore_invalid = false);
public:
/// Construct a reader that reads from the given input stream
/** filename is used only for error messages
*/
Reader(const InputStreamP& input, Packaged* package = nullptr, const String& filename = wxEmptyString, bool ignore_invalid = false);
/// Construct a reader that reads a file in a package
/** Used for "include file" keys.
* package can be nullptr
*/
Reader(Packaged* package, const String& filename, bool ignore_invalid = false);
~Reader() { showWarnings(); }
/// Tell the reflection code we are reading
@@ -182,7 +182,7 @@ class Reader {
template <typename T>
void unknownKey(T& v) {
if (key == _("include file")) {
Reader reader(package, value, ignore_invalid);
Reader reader(this, package, value, ignore_invalid);
reader.handle_greedy(v);
moveNext();
} else {