Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/game/StarHumanoid.cpp19
-rw-r--r--source/game/StarPlayerInventory.cpp2
2 files changed, 13 insertions, 8 deletions
diff --git a/source/game/StarHumanoid.cpp b/source/game/StarHumanoid.cpp
index 0b33ba4..1367a30 100644
--- a/source/game/StarHumanoid.cpp
+++ b/source/game/StarHumanoid.cpp
@@ -1387,8 +1387,8 @@ pair<Vec2F, Directives> Humanoid::extractScaleFromDirectives(Directives const& d
if (!directives)
return make_pair(Vec2F::filled(1.f), Directives());
- List<StringView> operations;
- size_t totalLength = 0;
+ List<Directives::Entry*> entries;
+ size_t toReserve = 0;
Maybe<Vec2F> scale;
for (auto& entry : directives->entries) {
@@ -1399,17 +1399,22 @@ pair<Vec2F, Directives> Humanoid::extractScaleFromDirectives(Directives const& d
if (op)
scale = scale.value(Vec2F::filled(1.f)).piecewiseMultiply(op->scale);
- else
- totalLength += operations.emplace_back(string).utf8Size();
+ else {
+ entries.emplace_back(entry);
+ toReserve += string.utf8Size() + 1;
+ }
}
if (!scale)
return make_pair(Vec2F::filled(1.f), directives);
String mergedDirectives;
- mergedDirectives.reserve(totalLength);
- for (auto& directive : operations)
- mergedDirectives.append(directive.utf8Ptr(), directive.utf8Size());
+ mergedDirectives.reserve(toReserve);
+ for (auto& entry : entries) {
+ if (entry->begin > 0)
+ mergedDirectives.append('?');
+ mergedDirectives.append(entry->string(*directives));
+ }
return make_pair(*scale, Directives(mergedDirectives));
}
diff --git a/source/game/StarPlayerInventory.cpp b/source/game/StarPlayerInventory.cpp
index 0fbcd66..0d74e05 100644
--- a/source/game/StarPlayerInventory.cpp
+++ b/source/game/StarPlayerInventory.cpp
@@ -447,7 +447,7 @@ ItemBagConstPtr PlayerInventory::bagContents(String const& type) const {
return m_bags.get(type);
}
-void PlayerInventory::condenseBagStacks(String const& bagType) {\
+void PlayerInventory::condenseBagStacks(String const& bagType) {
auto bag = m_bags[bagType];
bag->condenseStacks();