Files
DarkflameServer/dDatabase/CDClientDatabase/CDClientTables/CDModularBuildComponentTable.h
Aaron Kimbrell fec4159ea5 refactor: modular build items and root part come from ModularBuildComponent
ModularBuildFinish hardcoded the item a finished build becomes (6416 for 3
parts, 8092 for 7) and the car chassis part (8129) that the every-part-
swapped check skips. They now come from ModularBuildComponent: createdLOT,
<numberOfParts> and the <ExamplePartLOT> of the <rootPart> module (new
CDModularBuildComponentTable). Same results with the 1.10.64 cdclient;
tests cover the xml parsing and the lookup.

Refs #691

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 22:30:59 -05:00

28 lines
1.1 KiB
C++

#pragma once
#include "CDTable.h"
#include "dCommonVars.h"
#include <optional>
#include <string_view>
// A modular build (rocket, car): ModularBuildComponent with what DLU needs from its xml
struct CDModularBuildComponent {
uint32_t id{};
int32_t buildType{};
LOT createdLOT{ LOT_NULL }; // the item the finished build becomes
uint32_t numberOfParts{}; // <topology><numberOfParts value>
LOT rootPartExampleLOT{ LOT_NULL }; // <Module><ExamplePartLOT> of the module whose PartCode is <rootPart value>
};
class CDModularBuildComponentTable : public CDTable<CDModularBuildComponentTable, std::vector<CDModularBuildComponent>> {
public:
void LoadValuesFromDatabase();
// The first build made of this many parts
std::optional<CDModularBuildComponent> GetByNumberOfParts(uint32_t numberOfParts) 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);
};