Skip to content
This repository was archived by the owner on Jan 21, 2023. It is now read-only.

Commit d9ab718

Browse files
committed
Improved the object getters
1 parent 2369c9d commit d9ab718

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

Code/Lib/BuildVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#pragma once
2-
#define SMBC_BUILD_VERSION 863
2+
#define SMBC_BUILD_VERSION 864

Code/ObjectDatabase/ModData.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,26 @@ namespace SMBC
180180

181181
const PartData* Mod::GetPart(const SMBC::Uuid& uuid)
182182
{
183-
const ObjectData* current_obj = GetObject(uuid);
184-
if (!current_obj || current_obj->Type() != ObjectType::Part)
183+
if (Mod::AllObjects.find(uuid) == Mod::AllObjects.end())
185184
return nullptr;
186185

187-
return static_cast<const PartData*>(current_obj);
186+
const ObjectData* p_cur_obj = Mod::AllObjects.at(uuid);
187+
if (p_cur_obj->Type() != ObjectType::Part)
188+
return nullptr;
189+
190+
return static_cast<const PartData*>(p_cur_obj);
188191
}
189192

190193
const BlockData* Mod::GetBlock(const SMBC::Uuid& uuid)
191194
{
192-
const ObjectData* current_obj = GetObject(uuid);
193-
if (!current_obj || current_obj->Type() != ObjectType::Block)
195+
if (Mod::AllObjects.find(uuid) == Mod::AllObjects.end())
196+
return nullptr;
197+
198+
const ObjectData* p_cur_obj = Mod::AllObjects.at(uuid);
199+
if (p_cur_obj->Type() != ObjectType::Block)
194200
return nullptr;
195201

196-
return static_cast<const BlockData*>(current_obj);
202+
return static_cast<const BlockData*>(p_cur_obj);
197203
}
198204

199205
Mod* Mod::CreateModFromDirectory(const std::wstring& dir)

0 commit comments

Comments
 (0)