mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-17 12:58:09 +00:00
Changed how the TryParse function works (and also did some general cleanup along the way)
This commit is contained in:
@@ -468,14 +468,14 @@ void Item::DisassembleModel(uint32_t numToDismantle) {
|
||||
// First iteration gets the count
|
||||
std::map<int32_t, int32_t> parts;
|
||||
while (currentBrick) {
|
||||
auto* designID = currentBrick->Attribute("designID");
|
||||
const char* const designID = currentBrick->Attribute("designID");
|
||||
if (designID) {
|
||||
uint32_t designId;
|
||||
if (!GeneralUtils::TryParse(designID, designId)) {
|
||||
const auto designId = GeneralUtils::TryParse<uint32_t>(designID);
|
||||
if (!designId) {
|
||||
LOG("Failed to parse designID %s", designID);
|
||||
continue;
|
||||
}
|
||||
parts[designId]++;
|
||||
parts[designId.value()]++;
|
||||
}
|
||||
|
||||
currentBrick = currentBrick->NextSiblingElement(searchTerm.c_str());
|
||||
|
@@ -87,10 +87,8 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent) {
|
||||
m_Items = {};
|
||||
|
||||
while (std::getline(stream, token, ',')) {
|
||||
int32_t value;
|
||||
if (GeneralUtils::TryParse(token, value)) {
|
||||
m_Items.push_back(value);
|
||||
}
|
||||
const auto validToken = GeneralUtils::TryParse<int32_t>(token);
|
||||
if (validToken) m_Items.push_back(validToken.value());
|
||||
}
|
||||
|
||||
m_Equipped = {};
|
||||
|
Reference in New Issue
Block a user