Skip to content

Commit

Permalink
20178: Fixes seeds being random on load entity via C API (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
howsohazard authored May 6, 2024
1 parent 286e662 commit 17a634e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Amalgam/AssetManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ Entity *AssetManager::LoadEntityFromResourcePath(std::string &resource_path, std
return nullptr;
}

new_entity->SetRandomState(default_random_seed, true);

if(file_type == FILE_EXTENSION_COMPRESSED_AMALGAM_CODE)
{
new_entity->SetRoot(code, true);
Expand Down Expand Up @@ -198,7 +200,10 @@ Entity *AssetManager::LoadEntityFromResourcePath(std::string &resource_path, std
{
EvaluableNode **seed = metadata->GetMappedChildNode(ENBISI_rand_seed);
if(seed != nullptr)
{
default_random_seed = EvaluableNode::ToStringPreservingOpcodeType(*seed);
new_entity->SetRandomState(default_random_seed, true);
}

EvaluableNode **version = metadata->GetMappedChildNode(ENBISI_version);
if(version != nullptr)
Expand All @@ -220,8 +225,6 @@ Entity *AssetManager::LoadEntityFromResourcePath(std::string &resource_path, std
new_entity->evaluableNodeManager.FreeNodeTree(metadata);
}

new_entity->SetRandomState(default_random_seed, true);

if(persistent)
SetEntityPersistentPath(new_entity, resource_path);

Expand Down

0 comments on commit 17a634e

Please sign in to comment.