fix directives stitching bug when parsing scale
This commit is contained in:
parent
789597dde4
commit
8cbb262c24
@ -7,7 +7,7 @@
|
|||||||
"colors" : {
|
"colors" : {
|
||||||
"local" : "^white;",
|
"local" : "^white;",
|
||||||
"party" : "^blue;",
|
"party" : "^blue;",
|
||||||
"broadcast" : "^yellow;",
|
"broadcast" : "^#fe6;",
|
||||||
"whisper" : "^pink;",
|
"whisper" : "^pink;",
|
||||||
"commandResult" : "^lightgray;",
|
"commandResult" : "^lightgray;",
|
||||||
"radioMessage" : "^cyan;",
|
"radioMessage" : "^cyan;",
|
||||||
|
@ -1387,8 +1387,8 @@ pair<Vec2F, Directives> Humanoid::extractScaleFromDirectives(Directives const& d
|
|||||||
if (!directives)
|
if (!directives)
|
||||||
return make_pair(Vec2F::filled(1.f), Directives());
|
return make_pair(Vec2F::filled(1.f), Directives());
|
||||||
|
|
||||||
List<StringView> operations;
|
List<Directives::Entry*> entries;
|
||||||
size_t totalLength = 0;
|
size_t toReserve = 0;
|
||||||
Maybe<Vec2F> scale;
|
Maybe<Vec2F> scale;
|
||||||
|
|
||||||
for (auto& entry : directives->entries) {
|
for (auto& entry : directives->entries) {
|
||||||
@ -1399,17 +1399,22 @@ pair<Vec2F, Directives> Humanoid::extractScaleFromDirectives(Directives const& d
|
|||||||
|
|
||||||
if (op)
|
if (op)
|
||||||
scale = scale.value(Vec2F::filled(1.f)).piecewiseMultiply(op->scale);
|
scale = scale.value(Vec2F::filled(1.f)).piecewiseMultiply(op->scale);
|
||||||
else
|
else {
|
||||||
totalLength += operations.emplace_back(string).utf8Size();
|
entries.emplace_back(entry);
|
||||||
|
toReserve += string.utf8Size() + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!scale)
|
if (!scale)
|
||||||
return make_pair(Vec2F::filled(1.f), directives);
|
return make_pair(Vec2F::filled(1.f), directives);
|
||||||
|
|
||||||
String mergedDirectives;
|
String mergedDirectives;
|
||||||
mergedDirectives.reserve(totalLength);
|
mergedDirectives.reserve(toReserve);
|
||||||
for (auto& directive : operations)
|
for (auto& entry : entries) {
|
||||||
mergedDirectives.append(directive.utf8Ptr(), directive.utf8Size());
|
if (entry->begin > 0)
|
||||||
|
mergedDirectives.append('?');
|
||||||
|
mergedDirectives.append(entry->string(*directives));
|
||||||
|
}
|
||||||
|
|
||||||
return make_pair(*scale, Directives(mergedDirectives));
|
return make_pair(*scale, Directives(mergedDirectives));
|
||||||
}
|
}
|
||||||
|
@ -447,7 +447,7 @@ ItemBagConstPtr PlayerInventory::bagContents(String const& type) const {
|
|||||||
return m_bags.get(type);
|
return m_bags.get(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerInventory::condenseBagStacks(String const& bagType) {\
|
void PlayerInventory::condenseBagStacks(String const& bagType) {
|
||||||
auto bag = m_bags[bagType];
|
auto bag = m_bags[bagType];
|
||||||
|
|
||||||
bag->condenseStacks();
|
bag->condenseStacks();
|
||||||
|
Loading…
Reference in New Issue
Block a user