Przeglądaj źródła

[-] fix(content): name the ornament bucket for what it holds

Review: not a review point. Found while answering the plug ownership
one.
Resolution: the constant names the bucket it actually selects, and
records where mods really are.

kModBucketId named bucket 13 the mod bucket, and the socket action
source model was documented as covering mods and ornaments. Bucket 13 is
ornaments. Mods are bucket 37 and are not in this model at all, so a
reader following the constant would believe mods were covered when
nothing here has ever seen one.

Renames the constant to what the bucket holds and records where mods
actually are, along with why they stay outside: they are permanent
unlocks rather than stacks, and the account carries no record of which
are unlocked, so no answer here could say whether it holds one.

Names only. Every bucket this decides on is unchanged.

Thomas Shields 3 tygodni temu
rodzic
commit
d39b4167ac

+ 11 - 4
Sunrise/src/state/build_data/items/socket_plugs/socket_plug_build_data_runtime.cpp

@@ -8,8 +8,8 @@
 namespace sunrise::state::build_data {
 namespace {
 
-/** Profile bucket holding mods and ornaments, which stay owned after they are applied. */
-constexpr std::uint8_t kModBucketId = 13;
+/** Profile bucket holding ornaments, which stay owned after they are applied. */
+constexpr std::uint8_t kOrnamentBucketId = 13;
 /** Profile bucket holding shaders, which are spent by the application. */
 constexpr std::uint8_t kShaderBucketId = 14;
 
@@ -77,11 +77,18 @@ bool is_consumed_on_apply(std::uint16_t itemDefinitionIndex, std::uint8_t bucket
     return bucketId == kShaderBucketId && collectibles::grants_item(itemDefinitionIndex);
 }
 
-/** Answers whether one installed profile row is a materializable socket action source. */
+/**
+ * Answers whether one installed profile row is a materializable socket action source.
+ *
+ * Only ornaments and shaders qualify. Mods are bucket 37 and sit outside this model on purpose:
+ * they are permanent unlocks rather than stacks, and nothing in the account records which are
+ * unlocked, so no answer here could say whether it holds one.
+ */
 bool is_profile_action_source(std::uint16_t itemDefinitionIndex, std::uint8_t bucketId) noexcept {
     items::details::Definition detail{};
     inventory::buckets::Descriptor bucket{};
-    if ((bucketId != kModBucketId && bucketId != kShaderBucketId) || !socket_plug_rules_ready()
+    if ((bucketId != kOrnamentBucketId && bucketId != kShaderBucketId)
+        || !socket_plug_rules_ready()
         || !find_configured_item_detail(itemDefinitionIndex, detail)
         || detail.definitionIndex != itemDefinitionIndex || detail.bucketId != bucketId
         || !find_inventory_bucket_descriptor(bucketId, bucket)