Update to 1.10.0-beta1

This commit is contained in:
dP
2019-10-31 22:24:28 +03:00
parent b84a475e14
commit 599ccf0c2b
1470 changed files with 354219 additions and 16795 deletions

View File

@@ -37,7 +37,7 @@ struct TextEffect : public ViewportSign {
}
};
static SmallVector<struct TextEffect, 32> _text_effects; ///< Text effects are stored there
static std::vector<struct TextEffect> _text_effects; ///< Text effects are stored there
/* Text Effects */
TextEffectID AddTextEffect(StringID msg, int center, int y, uint8 duration, TextEffectMode mode)
@@ -45,23 +45,23 @@ TextEffectID AddTextEffect(StringID msg, int center, int y, uint8 duration, Text
if (_game_mode == GM_MENU) return INVALID_TE_ID;
TextEffectID i;
for (i = 0; i < _text_effects.Length(); i++) {
for (i = 0; i < _text_effects.size(); i++) {
if (_text_effects[i].string_id == INVALID_STRING_ID) break;
}
if (i == _text_effects.Length()) _text_effects.Append();
if (i == _text_effects.size()) _text_effects.emplace_back();
TextEffect *te = _text_effects.Get(i);
TextEffect &te = _text_effects[i];
/* Start defining this object */
te->string_id = msg;
te->duration = duration;
te->params_1 = GetDParam(0);
te->params_2 = GetDParam(1);
te->mode = mode;
te.string_id = msg;
te.duration = duration;
te.params_1 = GetDParam(0);
te.params_2 = GetDParam(1);
te.mode = mode;
/* Make sure we only dirty the new area */
te->width_normal = 0;
te->UpdatePosition(center, y, msg);
te.width_normal = 0;
te.UpdatePosition(center, y, msg);
return i;
}
@@ -69,7 +69,7 @@ TextEffectID AddTextEffect(StringID msg, int center, int y, uint8 duration, Text
void UpdateTextEffect(TextEffectID te_id, StringID msg)
{
/* Update details */
TextEffect *te = _text_effects.Get(te_id);
TextEffect *te = _text_effects.data() + te_id;
if (msg == te->string_id && GetDParam(0) == te->params_1) return;
te->string_id = msg;
te->params_1 = GetDParam(0);
@@ -89,26 +89,26 @@ void MoveAllTextEffects(uint delta_ms)
uint count = texteffecttimer.CountElapsed(delta_ms);
if (count == 0) return;
const TextEffect *end = _text_effects.End();
for (TextEffect *te = _text_effects.Begin(); te != end; te++) {
if (te->string_id == INVALID_STRING_ID) continue;
if (te->mode != TE_RISING) continue;
for (TextEffect &te : _text_effects) {
if (te.string_id == INVALID_STRING_ID) continue;
if (te.mode != TE_RISING) continue;
if (te->duration < count) {
te->Reset();
if (te.duration < count) {
te.Reset();
continue;
}
te->MarkDirty(ZOOM_LVL_OUT_8X);
te->duration -= count;
te->top -= count * ZOOM_LVL_BASE;
te->MarkDirty(ZOOM_LVL_OUT_8X);
te.MarkDirty(ZOOM_LVL_OUT_8X);
te.duration -= count;
te.top -= count * ZOOM_LVL_BASE;
te.MarkDirty(ZOOM_LVL_OUT_8X);
}
}
void InitTextEffects()
{
_text_effects.Reset();
_text_effects.clear();
_text_effects.shrink_to_fit();
}
void DrawTextEffects(DrawPixelInfo *dpi)
@@ -116,11 +116,10 @@ void DrawTextEffects(DrawPixelInfo *dpi)
/* Don't draw the text effects when zoomed out a lot */
if (dpi->zoom > ZOOM_LVL_OUT_8X) return;
const TextEffect *end = _text_effects.End();
for (TextEffect *te = _text_effects.Begin(); te != end; te++) {
if (te->string_id == INVALID_STRING_ID) continue;
if (te->mode == TE_RISING || (_settings_client.gui.loading_indicators && !IsTransparencySet(TO_LOADING))) {
ViewportAddString(dpi, ZOOM_LVL_OUT_8X, te, te->string_id, te->string_id - 1, STR_NULL, te->params_1, te->params_2);
for (TextEffect &te : _text_effects) {
if (te.string_id == INVALID_STRING_ID) continue;
if (te.mode == TE_RISING || (_settings_client.gui.loading_indicators && !IsTransparencySet(TO_LOADING))) {
ViewportAddString(dpi, ZOOM_LVL_OUT_8X, &te, te.string_id, te.string_id - 1, STR_NULL, te.params_1, te.params_2);
}
}
}