definition.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #pragma once
  2. #include <cstddef>
  3. #include <cstdint>
  4. namespace sunrise::state::build_data::records {
  5. /** The shipped build declares 2242 records and lore entries. The domain leaves room above that. */
  6. inline constexpr std::size_t kDefinitionCapacity = 4096;
  7. /**
  8. * Account value bank row that holds Triumph Score.
  9. *
  10. * Found by authoring every account value slot to `100000 + its own row` and reading the score back
  11. * as 102115. It is a plain replicated value, not a progression and not derived by the client, so a
  12. * server that wants a score has to total one itself.
  13. */
  14. inline constexpr std::uint16_t kTriumphScoreValueIndex = 2115U;
  15. /** A record whose completion flag no mapping table addresses carries this instead of an index. */
  16. inline constexpr std::uint16_t kUnavailableFlagIndex = 0xFFFFU;
  17. /** A record naming no category value slot carries this instead of an index. */
  18. inline constexpr std::uint16_t kUnavailableValueIndex = 0xFFFFU;
  19. /**
  20. * One record reduced to what a claim needs.
  21. *
  22. * A record row carries the unlock slot of its completion flag. A slot is not an array index: the
  23. * byte that feeds it lives at the row number of the mapping table whose destination is that slot.
  24. * The index is resolved once here, at extraction, so a claim never has to walk the mapping tables.
  25. */
  26. struct Definition {
  27. /** Native record row, which is what an opcode-1801 claim names. */
  28. std::uint16_t definitionIndex{};
  29. /** Account flag bank mapping row, or kUnavailableFlagIndex when the slot is unaddressable. */
  30. std::uint16_t completionFlagIndex{kUnavailableFlagIndex};
  31. /** Points this record is worth, which the shipped table keeps at 500 or below. */
  32. std::uint16_t scoreValue{};
  33. /**
  34. * Account value index of the category this record names, or kUnavailableValueIndex.
  35. *
  36. * Only a category's parent record names its category's own slot, so this is what distinguishes
  37. * the parent from the chapters beneath it. The parent is excluded from its own progress bar.
  38. */
  39. std::uint16_t categoryValueIndex{kUnavailableValueIndex};
  40. };
  41. } // namespace sunrise::state::build_data::records