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

summaryrefslogtreecommitdiff
path: root/source/game
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-26 01:42:18 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-26 01:42:18 +1000
commit09d26d43b5262f480fd55eab9980eff06a71edbb (patch)
tree1e53765861cd966d204782aeefd15b1a67b3266f /source/game
parent13a74602bd4c46149da9949d448387a40b8ebd1c (diff)
Add string view variant of Star::String and use it
it's 1:30 AM AGAIN !! !!!!! This might have broken the inventory icons of custom hats a little, need to look into that
Diffstat (limited to 'source/game')
-rw-r--r--source/game/CMakeLists.txt1
-rw-r--r--source/game/StarHumanoid.cpp10
-rw-r--r--source/game/StarImageMetadataDatabase.cpp25
-rw-r--r--source/game/StarParallax.cpp13
4 files changed, 27 insertions, 22 deletions
diff --git a/source/game/CMakeLists.txt b/source/game/CMakeLists.txt
index 1ff95ff..7328601 100644
--- a/source/game/CMakeLists.txt
+++ b/source/game/CMakeLists.txt
@@ -500,3 +500,4 @@ SET (star_game_SOURCES
)
ADD_LIBRARY (star_game OBJECT ${star_game_SOURCES} ${star_game_HEADERS})
+TARGET_PRECOMPILE_HEADERS (star_game REUSE_FROM star_core) \ No newline at end of file
diff --git a/source/game/StarHumanoid.cpp b/source/game/StarHumanoid.cpp
index b33df4b..8e571e5 100644
--- a/source/game/StarHumanoid.cpp
+++ b/source/game/StarHumanoid.cpp
@@ -71,15 +71,15 @@ Json HumanoidIdentity::toJson() const {
{"gender", GenderNames.getRight(gender)},
{"hairGroup", hairGroup},
{"hairType", hairType},
- {"hairDirectives", hairDirectives.toString()},
- {"bodyDirectives", bodyDirectives.toString()},
- {"emoteDirectives", emoteDirectives.toString()},
+ {"hairDirectives", hairDirectives.string()},
+ {"bodyDirectives", bodyDirectives.string()},
+ {"emoteDirectives", emoteDirectives.string()},
{"facialHairGroup", facialHairGroup},
{"facialHairType", facialHairType},
- {"facialHairDirectives", facialHairDirectives.toString()},
+ {"facialHairDirectives", facialHairDirectives.string()},
{"facialMaskGroup", facialMaskGroup},
{"facialMaskType", facialMaskType},
- {"facialMaskDirectives", facialMaskDirectives.toString()},
+ {"facialMaskDirectives", facialMaskDirectives.string()},
{"personalityIdle", personality.idle},
{"personalityArmIdle", personality.armIdle},
{"personalityHeadOffset", jsonFromVec2F(personality.headOffset)},
diff --git a/source/game/StarImageMetadataDatabase.cpp b/source/game/StarImageMetadataDatabase.cpp
index d15d802..e47c841 100644
--- a/source/game/StarImageMetadataDatabase.cpp
+++ b/source/game/StarImageMetadataDatabase.cpp
@@ -120,20 +120,21 @@ RectU ImageMetadataDatabase::nonEmptyRegion(AssetPath const& path) const {
AssetPath ImageMetadataDatabase::filterProcessing(AssetPath const& path) {
AssetPath newPath = { path.basePath, path.subPath, {} };
- List<Directives::Entry> filtered;
- path.directives.forEach([&](auto const& entry) {
+ String filtered;
+ path.directives.forEach([&](auto const& entry, Directives const& directives) {
ImageOperation const& operation = entry.operation;
- if (!(operation.is<HueShiftImageOperation>() ||
- operation.is<SaturationShiftImageOperation>() ||
- operation.is<BrightnessMultiplyImageOperation>() ||
- operation.is<FadeToColorImageOperation>() ||
- operation.is<ScanLinesImageOperation>() ||
- operation.is<SetColorImageOperation>())) {
- filtered.emplace_back(entry);
+ if (!(operation.is<HueShiftImageOperation>() ||
+ operation.is<SaturationShiftImageOperation>() ||
+ operation.is<BrightnessMultiplyImageOperation>() ||
+ operation.is<FadeToColorImageOperation>() ||
+ operation.is<ScanLinesImageOperation>() ||
+ operation.is<SetColorImageOperation>())) {
+ filtered += "?";
+ filtered += entry.string(*directives.shared);
}
- });
+ });
- newPath.directives.append(move(filtered));
+ newPath.directives = move(filtered);
return newPath;
}
@@ -230,7 +231,7 @@ Vec2U ImageMetadataDatabase::calculateImageSize(AssetPath const& path) const {
OperationSizeAdjust osa(imageSize);
- bool complete = path.directives.forEachAbortable([&](auto const& entry) -> bool {
+ bool complete = path.directives.forEachAbortable([&](auto const& entry, Directives const& directives) -> bool {
entry.operation.call(osa);
return !osa.hasError;
});
diff --git a/source/game/StarParallax.cpp b/source/game/StarParallax.cpp
index a950086..f895d83 100644
--- a/source/game/StarParallax.cpp
+++ b/source/game/StarParallax.cpp
@@ -41,7 +41,7 @@ ParallaxLayer::ParallaxLayer(Json const& store) : ParallaxLayer() {
Json ParallaxLayer::store() const {
return JsonObject{
{"textures", jsonFromStringList(textures)},
- {"directives", directives.toString()},
+ {"directives", directives.string()},
{"parallaxValue", jsonFromVec2F(parallaxValue)},
{"repeat", jsonFromVec2B(repeat)},
{"tileLimitTop", jsonFromMaybe(tileLimitTop)},
@@ -59,11 +59,14 @@ Json ParallaxLayer::store() const {
void ParallaxLayer::addImageDirectives(Directives const& newDirectives) {
if (newDirectives) { // TODO: Move to Directives +=
if (directives) {
- List<Directives::Entry> newEntries = *directives.entries;
- for (auto const& entry : *newDirectives.entries)
- newEntries.push_back(entry);
+ String newString;
- directives = move(newEntries);
+ for (auto const& entry : newDirectives.shared->entries) {
+ newString += "+";
+ newString += entry.string(*newDirectives.shared);
+ }
+
+ directives = move(newString);
}
else
directives = newDirectives;