Fix MemoryRelay handling in DataSpec

This commit is contained in:
Phillip Stephens 2019-07-16 19:10:57 -07:00
parent e552030d40
commit cdf9545de4
4 changed files with 9 additions and 12 deletions

View File

@ -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();

View File

@ -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

View File

@ -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) {}

View File

@ -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;
};