Use more clear control paths

This commit is contained in:
David Markowitz
2023-06-12 04:27:14 -07:00
parent d224a86e93
commit 326c495776
3 changed files with 42 additions and 30 deletions

View File

@@ -47,10 +47,10 @@ void ScriptComponent::SetScript(const std::string& scriptName) {
}
const std::string ScriptComponent::GetScriptName(Entity* parentEntity, const uint32_t componentId) {
if (!parentEntity) return "";
if (!parentEntity || componentId == 0) return "";
// LDF key script overrides script component Id
const auto customScriptServer = parentEntity->GetVarAsString(u"custom_script_server");
if (!customScriptServer.empty() || componentId == 0) return customScriptServer;
if (!customScriptServer.empty()) return customScriptServer;
auto* scriptCompTable = CDClientManager::Instance().GetTable<CDScriptComponentTable>();
CDScriptComponent scriptCompData = scriptCompTable->GetByID(componentId);