Просмотр исходного кода

[10] fix(settings): carry the version-4 members through the upgrade

Review: config is raised to version 4 but is not properly upgraded.
Resolution: the member whose form version 4 changed now takes the
bundled default, the way the version-3 member already did.

Raising kSettingsVersion to 4 without touching the upgrade left it doing
only the version-3 work. An older file was stamped as version 4 and
otherwise copied through, so it reached the parser without the character
inventories that version added, and the account it produced had no
items.

Adds characters to the members replaced from the bundled defaults. A
version-3 character cannot be carried forward: the inventory rows
version 4 introduced hold instance identities that must be unique across
the account and agree with the equipment beside them, and none of that
can be derived from a file written before they existed.

The account's dismantle rewards are a new member rather than a changed
one, so they are left to their default. That follows the version-3 step,
which replaced only the key bindings whose form had changed and left the
spawn hold and bap port it added to take theirs.

Thomas Shields 3 недель назад
Родитель
Сommit
1787a06d28
1 измененных файлов с 9 добавлено и 2 удалено
  1. 9 2
      Sunrise/src/core/settings/settings_upgrade.cpp

+ 9 - 2
Sunrise/src/core/settings/settings_upgrade.cpp

@@ -17,8 +17,15 @@ namespace {
 
 /** The layout version member, quoted so a value string cannot match it. */
 constexpr std::string_view kVersionMember = "\"version\"";
-/** Members replaced with the bundled default because their value form changed. */
-constexpr std::array<std::string_view, 1> kReplacedMembers{"\"key_bindings\""};
+/**
+ * Members replaced with the bundled default because their value form changed.
+ *
+ * Version 3 changed how a key binding names its key. Version 4 gave every character an authored
+ * inventory, whose rows carry instance identities that have to be unique across the account and
+ * agree with the equipment beside them, so a version-3 character cannot be carried forward and
+ * takes the bundled one instead.
+ */
+constexpr std::array<std::string_view, 2> kReplacedMembers{"\"key_bindings\"", "\"characters\""};
 /** One splice per replaced member, plus the version member itself. */
 constexpr std::size_t kSpliceCapacity = kReplacedMembers.size() + 1;
 /** Room for the version member and its digits when the file predates versioning. */