Incremented version number to 0.3.7

When saving files an older version number is used if that version of MSE would be able to open the set

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1011 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-06-28 16:31:40 +00:00
parent c0669fb658
commit 64b7912835
26 changed files with 60 additions and 28 deletions
-2
View File
@@ -30,7 +30,6 @@ class GetDefaultMember {
inline bool isComplex() const { return false; }
inline void addAlias(int, const Char*, const Char*) {}
inline void handleIgnore(int, const Char*) {}
inline void handleAppVersion() {} // no effect
/// The result, or script_nil if the member was not found
inline ScriptValueP result() { return value; }
@@ -78,7 +77,6 @@ class GetMember : private GetDefaultMember {
inline bool isComplex() const { return false; }
inline void addAlias(int, const Char*, const Char*) {}
inline void handleIgnore(int, const Char*) {}
inline void handleAppVersion() {} // no effect
/// The result, or script_nil if the member was not found
inline ScriptValueP result() { return gdm.result(); }
+3 -2
View File
@@ -530,13 +530,13 @@ void Packaged::loadFully() {
void Packaged::save() {
WITH_DYNAMIC_ARG(writing_package, this);
writeFile(typeName(), *this);
writeFile(typeName(), *this, fileVersion());
referenceFile(typeName());
Package::save();
}
void Packaged::saveAs(const String& package, bool remove_unused) {
WITH_DYNAMIC_ARG(writing_package, this);
writeFile(typeName(), *this);
writeFile(typeName(), *this, fileVersion());
referenceFile(typeName());
Package::saveAs(package, remove_unused);
}
@@ -574,6 +574,7 @@ void Packaged::requireDependency(Packaged* package) {
// ----------------------------------------------------------------------------- : IncludePackage
String IncludePackage::typeName() const { return _("include"); }
Version IncludePackage::fileVersion() const { return file_version_script; }
IMPLEMENT_REFLECTION(IncludePackage) {
REFLECT_BASE(Packaged);
+5 -2
View File
@@ -133,8 +133,8 @@ class Package : public IntrusivePtrVirtualBase {
}
template <typename T>
void writeFile(const String& file, const T& obj) {
Writer writer(openOut(file));
void writeFile(const String& file, const T& obj, Version file_version) {
Writer writer(openOut(file), file_version);
writer.handle(obj);
}
@@ -229,6 +229,8 @@ class Packaged : public Package {
virtual String typeName() const = 0;
/// Can be overloaded to do validation after loading
virtual void validate(Version file_app_version);
/// What file version should be used for writing files?
virtual Version fileVersion() const = 0;
DECLARE_REFLECTION_VIRTUAL();
@@ -244,6 +246,7 @@ class Packaged : public Package {
class IncludePackage : public Packaged {
protected:
String typeName() const;
Version fileVersion() const;
DECLARE_REFLECTION();
};
+1 -1
View File
@@ -310,7 +310,7 @@ void PackageDirectory::loadDatabase() {
}
void PackageDirectory::saveDatabase() {
Writer writer(new_shared1<wxFileOutputStream>(databaseFile()));
Writer writer(new_shared1<wxFileOutputStream>(databaseFile()), app_version);
writer.handle(*this);
}
String PackageDirectory::databaseFile() {
+2 -5
View File
@@ -15,18 +15,15 @@
// ----------------------------------------------------------------------------- : Writer
Writer::Writer(const OutputStreamP& output)
Writer::Writer(const OutputStreamP& output, Version file_app_version)
: indentation(0), just_opened(false)
, output(output), stream(*output)
{
stream.WriteString(BYTE_ORDER_MARK);
handleAppVersion();
handle(_("mse_version"), file_app_version);
}
void Writer::handleAppVersion() {
handle(_("mse_version"), app_version);
}
void Writer::enterBlock(const Char* name) {
// indenting into a sub-block?
+1 -4
View File
@@ -26,7 +26,7 @@ typedef shared_ptr<wxOutputStream> OutputStreamP;
class Writer {
public:
/// Construct a writer that writes to the given output stream
Writer(const OutputStreamP& output);
Writer(const OutputStreamP& output, Version file_app_version);
/// Tell the reflection code we are not reading
inline bool reading() const { return false; }
@@ -35,9 +35,6 @@ class Writer {
inline void addAlias(int, const Char*, const Char*) {}
inline void handleIgnore(int, const Char*) {}
/// Write the application version
void handleAppVersion();
// --------------------------------------------------- : Handling objects
/// Handle an object: write it under the given name
template <typename T>
+16 -3
View File
@@ -50,14 +50,18 @@ template <> void GetDefaultMember::handle(const Version& v) {
// ----------------------------------------------------------------------------- : Versions
// NOTE: Don't use leading zeroes, they mean octal
const Version app_version = 306; // 0.3.6
const Version app_version = 307; // 0.3.7
#ifdef UNICODE
const Char* version_suffix = _(" (beta)");
#else
const Char* version_suffix = _(" (beta, ascii build)");
#endif
/* Changes:
/// Which version of MSE are the files we write out compatible with?
/* The saved files will have these version numbers attached.
* They should be updated whenever a change breaks backwards compatability.
*
* Changes:
* 0.2.0 : start of version numbering practice
* 0.2.2 : _("include file")
* 0.2.6 : fix in settings loading
@@ -70,4 +74,13 @@ const Char* version_suffix = _(" (beta, ascii build)");
* 0.3.5 : word lists, symbol font 'as text'
* 0.3.6 : free rotation, rotation behaviour changed.
*/
const Version file_version = 306; // 0.3.6
const Version file_version_locale = 307; // 0.3.7
const Version file_version_set = 306; // 0.3.6
const Version file_version_game = 307; // 0.3.7
const Version file_version_stylesheet = 307; // 0.3.7
const Version file_version_symbol_font = 306; // 0.3.6
const Version file_version_export_template = 307; // 0.3.7
const Version file_version_installer = 307; // 0.3.7
const Version file_version_symbol = 305; // 0.3.5
const Version file_version_clipboard = 306; // 0.3.6
const Version file_version_script = 307; // 0.3.7
+11 -2
View File
@@ -50,10 +50,19 @@ struct Version {
extern const Version app_version;
extern const Char* version_suffix;
/// File version, usually the same as program version,
/// Which version of MSE are the files we write out compatible with?
/** When no files are changed the file version is not incremented
*/
extern const Version file_version;
extern const Version file_version_locale;
extern const Version file_version_set;
extern const Version file_version_game;
extern const Version file_version_stylesheet;
extern const Version file_version_symbol_font;
extern const Version file_version_export_template;
extern const Version file_version_installer;
extern const Version file_version_symbol;
extern const Version file_version_clipboard;
extern const Version file_version_script;
// ----------------------------------------------------------------------------- : EOF
#endif