From: TimePath <andrew.hardaker1995@gmail.com>
Date: Mon, 14 Mar 2016 04:04:48 +0000 (+1100)
Subject: damagetext: migrate legacy formatting
X-Git-Tag: xonotic-v0.8.2~1093
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=58625302ccbb8c94d92e67ea398fad29028a1d4a;p=xonotic%2Fxonotic-data.pk3dir.git

damagetext: migrate legacy formatting

Closes #1679
---

diff --git a/qcsrc/common/mutators/mutator/damagetext/damagetext.qc b/qcsrc/common/mutators/mutator/damagetext/damagetext.qc
index 70c574853..86adda03f 100644
--- a/qcsrc/common/mutators/mutator/damagetext/damagetext.qc
+++ b/qcsrc/common/mutators/mutator/damagetext/damagetext.qc
@@ -14,6 +14,9 @@ REGISTER_MUTATOR(damagetext, true);
 // no translatable cvar description please
 AUTOCVAR_SAVE(cl_damagetext,                    bool,   false,      "Draw damage dealt where you hit the enemy");
 AUTOCVAR_SAVE(cl_damagetext_format,             string, "-{total}", "How to format the damage text. {health}, {armor}, {total}");
+STATIC_INIT(DamageText_LegacyFormat) {
+    if (strstrofs(autocvar_cl_damagetext_format, "{", 0) < 0) autocvar_cl_damagetext_format = "-{total}";
+}
 AUTOCVAR_SAVE(cl_damagetext_color,              vector, '1 1 0',    "Damage text color");
 AUTOCVAR_SAVE(cl_damagetext_color_per_weapon,   bool,   false,      "Damage text uses weapon color");
 AUTOCVAR_SAVE(cl_damagetext_size,               float,  8,          "Damage text font size");