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

Reset subclass ability picks to defaults every login

Millie 3 недель назад
Родитель
Сommit
085ba1829e
2 измененных файлов с 10 добавлено и 34 удалено
  1. 0 6
      Sunrise/src/core/settings/parser.h
  2. 10 28
      Sunrise/src/core/settings/state/account_rows_parser.cpp

+ 0 - 6
Sunrise/src/core/settings/parser.h

@@ -162,12 +162,6 @@ private:
      */
      */
     [[nodiscard]] bool character(state::CharacterState& output) noexcept;
     [[nodiscard]] bool character(state::CharacterState& output) noexcept;
 
 
-    /**
-     * Reads one selectable ability's socket entry.
-     * @param output Receives the entry only when it is inside the socket-entry bound.
-     * @return True when the value parses and names a possible entry.
-     */
-    [[nodiscard]] bool ability_entry(std::uint8_t& output) noexcept;
     /**
     /**
      * Parses the optional equipment object with its fixed named slots.
      * Parses the optional equipment object with its fixed named slots.
      * @param output Receives present items only after the whole object is valid.
      * @param output Receives present items only after the whole object is valid.

+ 10 - 28
Sunrise/src/core/settings/state/account_rows_parser.cpp

@@ -163,16 +163,6 @@ bool Parser::characters(state::AccountState& output) noexcept {
     }
     }
 }
 }
 
 
-/** Reads one selectable ability's socket entry. */
-bool Parser::ability_entry(std::uint8_t& output) noexcept {
-    std::uint64_t value = 0;
-    if (!unsigned_integer(value) || value > state::kMaximumMovementAbilityEntry) {
-        return false;
-    }
-    output = static_cast<std::uint8_t>(value);
-    return true;
-}
-
 /** Parses one authored character identity. */
 /** Parses one authored character identity. */
 bool Parser::character(state::CharacterState& output) noexcept {
 bool Parser::character(state::CharacterState& output) noexcept {
     output = {};
     output = {};
@@ -244,24 +234,16 @@ bool Parser::character(state::CharacterState& output) noexcept {
             if (!boolean(output.contentBypass)) {
             if (!boolean(output.contentBypass)) {
                 return false;
                 return false;
             }
             }
-        } else if (key == "movement_ability") {
-            if (!ability_entry(output.movementAbilityEntry)) {
-                return false;
-            }
-        } else if (key == "grenade_ability") {
-            if (!ability_entry(output.grenadeAbilityEntry)) {
-                return false;
-            }
-        } else if (key == "super_ability") {
-            if (!ability_entry(output.superAbilityEntry)) {
-                return false;
-            }
-        } else if (key == "melee_ability") {
-            if (!ability_entry(output.meleeAbilityEntry)) {
-                return false;
-            }
-        } else if (key == "class_ability") {
-            if (!ability_entry(output.classAbilityEntry)) {
+        } else if (key == "movement_ability" || key == "grenade_ability" || key == "super_ability"
+                   || key == "melee_ability" || key == "class_ability") {
+            // Deliberately ignored on load: the subclass screen's first paint each login reads
+            // whatever the game's own UI initializes itself to before any interaction, which is
+            // always the ability-entry struct defaults below, not whatever State last committed.
+            // Restoring a persisted non-default pick here would leave that first paint showing
+            // something different from what is actually equipped until the player made any
+            // change and forced a redraw. Resetting every login keeps the two in sync from the
+            // start; the value is still written back out (see the writer), just never read back.
+            if (!skip_value(0)) {
                 return false;
                 return false;
             }
             }
         } else if (key == "equipment") {
         } else if (key == "equipment") {