Explorar o código

oops forgot something

stan hai 3 semanas
pai
achega
2ce592c4ca

+ 5 - 5
Sunrise/src/state/build_data/abilities/ability_bucket_catalog.cpp

@@ -11,7 +11,7 @@ Table<Definition, kDefinitionCapacity> g_definitions;
 /** @return True when both rows name the same subclass selection. */
 [[nodiscard]] bool same_key(const Definition& left, const Definition& right) noexcept {
     return left.socketEntryListIndex == right.socketEntryListIndex
-           && left.movementEntry == right.movementEntry;
+           && left.selection == right.selection;
 }
 
 } // namespace
@@ -22,7 +22,7 @@ void clear() noexcept {
     g_definitions.clear();
 }
 
-/** Checks that no two rows share a subclass and movement selection. */
+/** Checks that no two rows share a subclass and ability selection. */
 bool valid(std::span<const Definition> definitions) noexcept {
     if (definitions.size() > kDefinitionCapacity) {
         return false;
@@ -46,12 +46,12 @@ bool replace(std::span<const Definition> definitions) noexcept {
     return g_definitions.replace(definitions);
 }
 
-/** Finds the buckets one subclass publishes under one movement selection. */
+/** Finds the buckets one subclass publishes under one ability selection. */
 bool find(std::uint16_t socketEntryListIndex,
-          std::uint8_t movementEntry,
+          const Selection& selection,
           Definition& definition) noexcept {
     definition = {};
-    const Definition wanted{socketEntryListIndex, movementEntry};
+    const Definition wanted{socketEntryListIndex, selection};
     const Lock::Shared guard(g_lock);
     for (const Definition& row : g_definitions.rows()) {
         if (same_key(row, wanted)) {

+ 4 - 3
Sunrise/src/state/build_data/abilities/ability_bucket_catalog.h

@@ -11,7 +11,7 @@ namespace sunrise::state::build_data::abilities {
 void clear() noexcept;
 
 /**
- * Checks that no two rows share a subclass and movement selection.
+ * Checks that no two rows share a subclass and ability selection.
  * @param definitions Candidate rows.
  * @return True when the rows fit storage and every key is unique.
  */
@@ -25,13 +25,14 @@ void clear() noexcept;
 [[nodiscard]] bool replace(std::span<const Definition> definitions) noexcept;
 
 /**
- * Finds the buckets one subclass publishes under one movement selection.
+ * Finds the buckets one subclass publishes under one ability selection.
  * @param socketEntryListIndex Native socket-entry-list index of the subclass.
+ * @param selection The character's 5 selected socket entries.
  * @param definition Receives the matching row.
  * @return True when a row carries that exact key.
  */
 [[nodiscard]] bool find(std::uint16_t socketEntryListIndex,
-                        std::uint8_t movementEntry,
+                        const Selection& selection,
                         Definition& definition) noexcept;
 
 /**

+ 18 - 4
Sunrise/src/state/build_data/abilities/definition.h

@@ -12,7 +12,7 @@ inline constexpr std::size_t kBucketCapacity = 12;
 inline constexpr std::size_t kBucketHashCapacity = 16;
 /** The flat overflow bank holds 32 hashes no bucket category claims. */
 inline constexpr std::size_t kOverflowCapacity = 32;
-/** One row per distinct subclass and movement selection the configured characters use. */
+/** One row per distinct subclass and ability selection the configured characters use. */
 inline constexpr std::size_t kDefinitionCapacity = 8;
 /** All bits set marks a bucket no entry claimed. */
 inline constexpr std::uint8_t kEmptyBucketKind = 0xFF;
@@ -25,13 +25,27 @@ struct Bucket {
 };
 
 /**
- * The ability buckets one subclass publishes under one movement selection.
+ * The 5 socket entries one character has selected on its subclass.
+ * Sprint is the sixth selected entry but is not selectable, so it is fixed and not a key field.
+ */
+struct Selection {
+    std::uint8_t movementEntry{};
+    std::uint8_t grenadeEntry{};
+    std::uint8_t superEntry{};
+    std::uint8_t meleeEntry{};
+    std::uint8_t classEntry{};
+
+    friend bool operator==(const Selection&, const Selection&) = default;
+};
+
+/**
+ * The ability buckets one subclass publishes under one ability selection.
  * Both key fields are needed. The socket entry list is the subclass's ability layout, and the
- * movement entry picks among the choices that layout offers.
+ * selection picks among the choices that layout offers.
  */
 struct Definition {
     std::uint16_t socketEntryListIndex{};
-    std::uint8_t movementEntry{};
+    Selection selection{};
     std::uint8_t overflowCount{};
     std::array<Bucket, kBucketCapacity> buckets{};
     std::array<std::uint32_t, kOverflowCapacity> overflow{};

+ 11 - 2
Sunrise/src/state/build_data/cache/records/cache_domain_validation.cpp

@@ -1,4 +1,6 @@
 #include <algorithm>
+#include <array>
+#include <cstdint>
 #include <span>
 #include <string_view>
 
@@ -80,13 +82,20 @@ namespace {
     return left.definitionIndex < right.definitionIndex;
 }
 
-/** @return Subclass order, then movement-selection order. */
+/** @return Subclass order, then selected-entry order, movement first. */
 [[nodiscard]] bool ability_less(const abilities::Definition& left,
                                 const abilities::Definition& right) noexcept {
     if (left.socketEntryListIndex != right.socketEntryListIndex) {
         return left.socketEntryListIndex < right.socketEntryListIndex;
     }
-    return left.movementEntry < right.movementEntry;
+    const auto key = [](const abilities::Selection& selection) noexcept {
+        return std::array<std::uint8_t, 5>{selection.movementEntry,
+                                           selection.grenadeEntry,
+                                           selection.superEntry,
+                                           selection.meleeEntry,
+                                           selection.classEntry};
+    };
+    return key(left.selection) < key(right.selection);
 }
 
 /** @return True when every row sorts strictly before the next, so no two are equal. */

+ 10 - 2
Sunrise/src/state/build_data/cache/records/cache_investment_records.cpp

@@ -12,7 +12,11 @@ constexpr unsigned int kReservedFieldValue = 0;
 bool encode(const abilities::Definition& value, AbilityBucketRecord& record) noexcept {
     record = {};
     record.socketEntryListIndex = value.socketEntryListIndex;
-    record.movementEntry = value.movementEntry;
+    record.movementEntry = value.selection.movementEntry;
+    record.grenadeEntry = value.selection.grenadeEntry;
+    record.superEntry = value.selection.superEntry;
+    record.meleeEntry = value.selection.meleeEntry;
+    record.classEntry = value.selection.classEntry;
     record.overflowCount = value.overflowCount;
     record.overflow = value.overflow;
     for (std::size_t bucket = 0; bucket < abilities::kBucketCapacity; ++bucket) {
@@ -33,7 +37,11 @@ bool decode(const AbilityBucketRecord& record, abilities::Definition& value) noe
         return false;
     }
     value.socketEntryListIndex = record.socketEntryListIndex;
-    value.movementEntry = record.movementEntry;
+    value.selection.movementEntry = record.movementEntry;
+    value.selection.grenadeEntry = record.grenadeEntry;
+    value.selection.superEntry = record.superEntry;
+    value.selection.meleeEntry = record.meleeEntry;
+    value.selection.classEntry = record.classEntry;
     value.overflowCount = record.overflowCount;
     value.overflow = record.overflow;
     for (std::size_t bucket = 0; bucket < abilities::kBucketCapacity; ++bucket) {

+ 7 - 3
Sunrise/src/state/build_data/cache/records/format.h

@@ -24,7 +24,7 @@ inline constexpr std::array<char, 8> kCacheMagic{'S', 'U', 'N', 'R', 'I', 'S', '
  * Current build-data cache format. An older cache is rebuilt rather than read, so a bump needs
  * no other edit. Bump it whenever a domain's stored shape changes.
  */
-inline constexpr std::uint32_t kCacheFormatVersion = 22;
+inline constexpr std::uint32_t kCacheFormatVersion = 23;
 /** Signed -1 on disk means there is no equipment slot. */
 inline constexpr std::int8_t kAbsentEquipmentSlot = -1;
 /** The standard 64-bit FNV-1a offset basis starts the payload checksum. */
@@ -133,10 +133,14 @@ struct InventoryBucketRecord {
     std::uint16_t slotCount{};
 };
 
-/** Disk form of the buckets one subclass publishes under one movement selection. */
+/** Disk form of the buckets one subclass publishes under one ability selection. */
 struct AbilityBucketRecord {
     std::uint16_t socketEntryListIndex{};
     std::uint8_t movementEntry{};
+    std::uint8_t grenadeEntry{};
+    std::uint8_t superEntry{};
+    std::uint8_t meleeEntry{};
+    std::uint8_t classEntry{};
     std::uint8_t overflowCount{};
     std::array<std::uint8_t, abilities::kBucketCapacity> bucketKinds{};
     std::array<std::uint8_t, abilities::kBucketCapacity> bucketHashCounts{};
@@ -284,7 +288,7 @@ static_assert(sizeof(RosterGroupRecord)
                      + 2 * scenarios::kRosterSlotCapacity * sizeof(std::uint8_t));
 static_assert(sizeof(ProgressionRecord) == sizeof(std::uint16_t) + 2 * sizeof(std::uint8_t));
 static_assert(sizeof(AbilityBucketRecord)
-              == sizeof(std::uint16_t) + 2 * sizeof(std::uint8_t)
+              == sizeof(std::uint16_t) + 6 * sizeof(std::uint8_t)
                      + 2 * abilities::kBucketCapacity * sizeof(std::uint8_t)
                      + (abilities::kBucketCapacity * abilities::kBucketHashCapacity
                         + abilities::kOverflowCapacity)

+ 4 - 3
Sunrise/src/state/build_data/runtime.h

@@ -127,7 +127,7 @@ publish_progression_definitions(std::span<const progressions::Definition> defini
 [[nodiscard]] bool ability_buckets_ready() noexcept;
 
 /**
- * Publishes the ability buckets every configured subclass and movement selection publishes.
+ * Publishes the ability buckets every configured subclass and ability selection publishes.
  * @param definitions Complete rows, or an empty complete domain.
  * @return True when the rows pass the checks and any needed cache write succeeds.
  */
@@ -135,13 +135,14 @@ publish_progression_definitions(std::span<const progressions::Definition> defini
 publish_ability_buckets(std::span<const abilities::Definition> definitions) noexcept;
 
 /**
- * Finds the buckets one subclass publishes under one movement selection.
+ * Finds the buckets one subclass publishes under one ability selection.
  * @param socketEntryListIndex Native socket-entry-list index of the subclass.
+ * @param selection The character's 5 selected socket entries.
  * @param definition Receives the matching row.
  * @return True when the domain is ready and holds that exact key.
  */
 [[nodiscard]] bool find_ability_buckets(std::uint16_t socketEntryListIndex,
-                                        std::uint8_t movementEntry,
+                                        const abilities::Selection& selection,
                                         abilities::Definition& definition) noexcept;
 
 /** @return True when the installed investment constants are in State. */

+ 4 - 5
Sunrise/src/state/build_data/runtime/build_data_catalog_runtime.cpp

@@ -224,7 +224,7 @@ bool ability_buckets_ready() noexcept {
     return runtime::ability_buckets::ready();
 }
 
-/** Publishes the ability buckets every configured subclass and movement selection publishes. */
+/** Publishes the ability buckets every configured subclass and ability selection publishes. */
 bool publish_ability_buckets(std::span<const abilities::Definition> definitions) noexcept {
     runtime::persistence::Transaction transaction;
     if (!transaction.active() || !abilities::replace(definitions)) {
@@ -235,13 +235,12 @@ bool publish_ability_buckets(std::span<const abilities::Definition> definitions)
     return transaction.finish(true, rollback_ability_publication);
 }
 
-/** Finds the buckets one subclass publishes under one movement selection. */
+/** Finds the buckets one subclass publishes under one ability selection. */
 bool find_ability_buckets(std::uint16_t socketEntryListIndex,
-                          std::uint8_t movementEntry,
+                          const abilities::Selection& selection,
                           abilities::Definition& definition) noexcept {
     definition = {};
-    return ability_buckets_ready()
-           && abilities::find(socketEntryListIndex, movementEntry, definition);
+    return ability_buckets_ready() && abilities::find(socketEntryListIndex, selection, definition);
 }
 
 /** @return True when the installed investment constants are in State. */