Commit cdf9545d authored by Phillip Stephens's avatar Phillip Stephens

Fix MemoryRelay handling in DataSpec

parent e552030d
......@@ -124,8 +124,9 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
r.enumerate<atUint32>("memrelays", memRelays);
}
std::vector<MemRelayLink> memRelayLinks;
/* Bare minimum we'll need exactly the same number of links as relays */
std::vector<MemRelayLink> memRelayLinks(memRelays.size());
memRelayLinks.reserve(memRelays.size());
hecl::DirectoryEnumerator dEnum(area.path.getAbsolutePath(), hecl::DirectoryEnumerator::Mode::DirsSorted);
bool areaInit = false;
......@@ -256,13 +257,8 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
/* We must have a new relay, let's track it */
memRelayLinks.push_back(linkOut);
memRelays.push_back(memRelay.id);
} else /* Lets insert this in it's appropriate location, target order doesn't matter */
{
atUint32 idx = iter - memRelays.begin();
if (idx >= memRelayLinks.size())
} else {
memRelayLinks.push_back(linkOut);
else
memRelayLinks.insert(memRelayLinks.begin() + idx, linkOut);
}
}
}
......@@ -311,7 +307,8 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
}
/* Append Memory Relays */
mlvl.memRelayLinks.insert(mlvl.memRelayLinks.end(), memRelayLinks.begin(), memRelayLinks.end());
if (!memRelayLinks.empty())
mlvl.memRelayLinks.insert(mlvl.memRelayLinks.end(), memRelayLinks.begin(), memRelayLinks.end());
/* Cull duplicate area paths and add typed hash to list */
auto& conn = btok.getBlenderConnection();
......
......@@ -9,7 +9,7 @@ struct MemoryRelay : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> unknown;
Value<bool> active;
Value<bool> skipSendActive;
};
} // namespace DataSpec::DNAMP1
......@@ -5,10 +5,10 @@
namespace urde {
CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool b1,
CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool defaultActive,
bool skipSendActive, bool ignoreMessages)
: CEntity(uid, info, true, name)
, x34_24_(b1)
, x34_24_defaultActive(defaultActive)
, x34_25_skipSendActive(skipSendActive)
, x34_26_ignoreMessages(ignoreMessages) {}
......
......@@ -6,7 +6,7 @@ namespace urde {
class CScriptMemoryRelay : public CEntity {
union {
struct {
bool x34_24_;
bool x34_24_defaultActive;
bool x34_25_skipSendActive;
bool x34_26_ignoreMessages;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment