fix(ugc): give old cars and rockets a build id when a character loads

Cars and rockets built before builds were recorded have no subkey and no
ugc_modular_build row, so the client has no blueprint id to ask for their
icon with. When a character loads, such an item (a ModularBuildComponent
createdLOT with assemblyPartLOTs but no subkey) gets what a new build
gets: a persistent id as its subkey and a ugc_modular_build row with its
modules and owner. The next save keeps the subkey; nothing is dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-27 18:24:59 -05:00
parent 1d72766330
commit b040058cc8
3 changed files with 33 additions and 0 deletions

View File

@@ -1,5 +1,7 @@
#include "CDModularBuildComponentTable.h"
#include <algorithm>
#include <regex>
#include <string>
@@ -55,3 +57,8 @@ std::optional<CDModularBuildComponent> CDModularBuildComponentTable::FindByNumbe
std::optional<CDModularBuildComponent> CDModularBuildComponentTable::GetByNumberOfParts(const uint32_t numberOfParts) const {
return FindByNumberOfParts(GetEntries(), numberOfParts);
}
bool CDModularBuildComponentTable::IsCreatedLot(LOT lot) const {
const auto& entries = GetEntries();
return std::any_of(entries.begin(), entries.end(), [lot](const CDModularBuildComponent& build) { return build.createdLOT == lot; });
}

View File

@@ -21,6 +21,9 @@ public:
// The first build made of this many parts
std::optional<CDModularBuildComponent> GetByNumberOfParts(uint32_t numberOfParts) const;
// Whether a LOT is the item some build becomes (a car or rocket)
bool IsCreatedLot(LOT lot) const;
// Fills numberOfParts and rootPartExampleLOT from a ModularBuildComponent.xml
static void ParseXml(std::string_view xml, CDModularBuildComponent& build);
static std::optional<CDModularBuildComponent> FindByNumberOfParts(const std::vector<CDModularBuildComponent>& builds, uint32_t numberOfParts);