summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeterN <peter1138@openttd.org>2021-05-02 10:43:14 +0100
committerGitHub <noreply@github.com>2021-05-02 10:43:14 +0100
commit18651dd8b13d8a427ae71d8af00792d52ad9ed60 (patch)
tree13f0090e463114a6876c037b312dc7e7df4b13f5 /src
parent256dbee25597f4da8726063084f94eb821babf14 (diff)
downloadopenttd-18651dd8b13d8a427ae71d8af00792d52ad9ed60.tar.xz
Fix: Update text effect size when font zoom is changed. (#9174)
Diffstat (limited to 'src')
-rw-r--r--src/saveload/afterload.cpp1
-rw-r--r--src/texteff.cpp11
-rw-r--r--src/texteff.hpp1
3 files changed, 12 insertions, 1 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index d4b230dfd..56680511c 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -219,6 +219,7 @@ void UpdateAllVirtCoords()
UpdateAllStationVirtCoords();
UpdateAllSignVirtCoords();
UpdateAllTownVirtCoords();
+ UpdateAllTextEffectVirtCoords();
RebuildViewportKdtree();
}
diff --git a/src/texteff.cpp b/src/texteff.cpp
index f08701939..e29326a90 100644
--- a/src/texteff.cpp
+++ b/src/texteff.cpp
@@ -73,7 +73,16 @@ void UpdateTextEffect(TextEffectID te_id, StringID msg)
te->params_1 = GetDParam(0);
te->params_2 = GetDParam(1);
- te->UpdatePosition(te->center, te->top, msg);
+ te->UpdatePosition(te->center, te->top, te->string_id, te->string_id - 1);
+}
+
+void UpdateAllTextEffectVirtCoords()
+{
+ for (auto &te : _text_effects) {
+ SetDParam(0, te.params_1);
+ SetDParam(1, te.params_2);
+ te.UpdatePosition(te.center, te.top, te.string_id, te.string_id - 1);
+ }
}
void RemoveTextEffect(TextEffectID te_id)
diff --git a/src/texteff.hpp b/src/texteff.hpp
index 789b12d54..d122b17e9 100644
--- a/src/texteff.hpp
+++ b/src/texteff.hpp
@@ -32,6 +32,7 @@ void InitTextEffects();
void DrawTextEffects(DrawPixelInfo *dpi);
void UpdateTextEffect(TextEffectID effect_id, StringID msg);
void RemoveTextEffect(TextEffectID effect_id);
+void UpdateAllTextEffectVirtCoords();
/* misc_gui.cpp */
TextEffectID ShowFillingPercent(int x, int y, int z, uint8 percent, StringID colour);