Update to newer CreatureLib.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#define PKMNLIB_IPKMNBINARYSTREAM_HPP
|
||||
|
||||
#include <Arbutils/Collections/Dictionary.hpp>
|
||||
#include <Arbutils/ConstString.hpp>
|
||||
#include <Arbutils/StringView.hpp>
|
||||
#include <CreatureLib/Battling/ScriptHandling/ScriptCategory.hpp>
|
||||
#include <angelscript.h>
|
||||
|
||||
@@ -13,8 +13,8 @@ protected:
|
||||
IPkmnBinaryStream(size_t angelScriptBound) : _angelScriptBound(angelScriptBound) {}
|
||||
|
||||
public:
|
||||
virtual void
|
||||
WriteTypes(const ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ConstString, AngelScriptTypeInfo*>>& types) {
|
||||
virtual void WriteTypes(
|
||||
const ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo*>>& types) {
|
||||
// We serialize our types in the format
|
||||
// "[category(byte)][name(str)]\2[decl(str)]\2[name(str)]\2[decl(str)]\1[category(byte)]...."
|
||||
|
||||
@@ -38,9 +38,9 @@ public:
|
||||
Write("\1", sizeof(char));
|
||||
}
|
||||
}
|
||||
virtual ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ConstString, uint32_t>> ReadTypes() {
|
||||
virtual ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, uint32_t>> ReadTypes() {
|
||||
_angelScriptBound = SIZE_MAX;
|
||||
ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ConstString, uint32_t>> types;
|
||||
ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, uint32_t>> types;
|
||||
ScriptCategory categoryArr[1];
|
||||
while (true) {
|
||||
// Every inner database starts with the category, of known size. Read that.
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
if (read == 0) {
|
||||
break;
|
||||
}
|
||||
ArbUt::Dictionary<ConstString, uint32_t> innerDb;
|
||||
ArbUt::Dictionary<ArbUt::StringView, uint32_t> innerDb;
|
||||
|
||||
// We don't know the sizes of the name and decl. Allocate 128 characters for them, as that should be enough.
|
||||
char name[128];
|
||||
@@ -68,8 +68,7 @@ public:
|
||||
if (isDecl) {
|
||||
// Insert the name and decl into the dictionary. Close off the decl with eof as well.
|
||||
decl[pos] = '\0';
|
||||
innerDb.Insert(ArbUt::CaseInsensitiveConstString(name),
|
||||
ArbUt::CaseInsensitiveConstString::GetHash(decl));
|
||||
innerDb.Insert(ArbUt::StringView(name), ArbUt::StringView::CalculateHash(decl));
|
||||
}
|
||||
// If we have found \1, we are done with the current category, so break.
|
||||
break;
|
||||
@@ -80,8 +79,7 @@ public:
|
||||
if (isDecl) {
|
||||
// Insert the name and decl into the dictionary. Close off the decl with eof as well.
|
||||
decl[pos] = '\0';
|
||||
innerDb.Insert(ArbUt::CaseInsensitiveConstString(name),
|
||||
ArbUt::CaseInsensitiveConstString::GetHash(decl));
|
||||
innerDb.Insert(ArbUt::StringView(name), ArbUt::StringView::CalculateHash(decl));
|
||||
// Reset our position and toggle back to name.
|
||||
pos = 0;
|
||||
isDecl = false;
|
||||
|
||||
Reference in New Issue
Block a user