summaryrefslogtreecommitdiffstats
path: root/src/render/Font.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-06-06 18:25:37 +0200
committereray orçunus <erayorcunus@gmail.com>2020-06-06 18:25:37 +0200
commitfc0498b3a8029a6bb85cd00df4775cbe679338e8 (patch)
treec09111478e84fd5a1a58cb6dc35ce641f1819811 /src/render/Font.cpp
parentUse KnockOffRider (diff)
downloadre3-fc0498b3a8029a6bb85cd00df4775cbe679338e8.tar
re3-fc0498b3a8029a6bb85cd00df4775cbe679338e8.tar.gz
re3-fc0498b3a8029a6bb85cd00df4775cbe679338e8.tar.bz2
re3-fc0498b3a8029a6bb85cd00df4775cbe679338e8.tar.lz
re3-fc0498b3a8029a6bb85cd00df4775cbe679338e8.tar.xz
re3-fc0498b3a8029a6bb85cd00df4775cbe679338e8.tar.zst
re3-fc0498b3a8029a6bb85cd00df4775cbe679338e8.zip
Diffstat (limited to '')
-rw-r--r--src/render/Font.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/render/Font.cpp b/src/render/Font.cpp
index ef665fae..42637390 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -936,15 +936,27 @@ CFont::GetStringWidth(wchar *s, bool spaces)
} else
#endif
{
- for (; (*s != ' ' || spaces) && *s != '\0'; s++) {
- if (*s == '~') {
- s++;
- while (*s != '~') s++;
+ for (wchar c = *s; (c != ' ' || spaces) && c != '\0'; c = *(++s)) {
+ if (c == '~') {
+
+ // This is original code
+#if 0
s++;
- if (*s == ' ' && !spaces)
- break;
+ while (*s != '~') {
+ s++;
+ }
+#else
+ // TODO(Miami): This is my code to prevent fuck up until InsertPlayerControlKeysInString is done
+ if (*(s + 1) != '~') {
+ s++;
+ while (*s != '~') {
+ s++;
+ }
+ }
+#endif
+ } else {
+ w += GetCharacterSize(c - ' ');
}
- w += GetCharacterSize(*s - ' ');
}
}
return w;