From: terencehill Date: Thu, 29 Jun 2017 13:59:54 +0000 (+0200) Subject: Replace some sprintfs with simpler strcats X-Git-Tag: xonotic-v0.8.5~2670 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d33c70524ec999d8115523881a6780f07bd98b2a;p=xonotic%2Fxonotic-data.pk3dir.git Replace some sprintfs with simpler strcats --- diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index f38d39d61..b80875e36 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -3,7 +3,7 @@ string BUFF_NAME(int i) { Buff b = Buffs_from(i); - return sprintf("%s%s", rgb_to_hexcolor(b.m_color), b.m_prettyName); + return strcat(rgb_to_hexcolor(b.m_color), b.m_prettyName); } entity buff_FirstFromFlags(int _buffs) diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 5e03def24..811115b68 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -227,14 +227,14 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew) string _fn2 = substring(_fn, 0 , strlen(_fn) -4); this.draw = ItemDrawSimple; - if(fexists(sprintf("%s%s.md3", _fn2, autocvar_cl_simpleitems_postfix))) - this.mdl = strzone(sprintf("%s%s.md3", _fn2, autocvar_cl_simpleitems_postfix)); - else if(fexists(sprintf("%s%s.dpm", _fn2, autocvar_cl_simpleitems_postfix))) - this.mdl = strzone(sprintf("%s%s.dpm", _fn2, autocvar_cl_simpleitems_postfix)); - else if(fexists(sprintf("%s%s.iqm", _fn2, autocvar_cl_simpleitems_postfix))) - this.mdl = strzone(sprintf("%s%s.iqm", _fn2, autocvar_cl_simpleitems_postfix)); - else if(fexists(sprintf("%s%s.mdl", _fn2, autocvar_cl_simpleitems_postfix))) - this.mdl = strzone(sprintf("%s%s.mdl", _fn2, autocvar_cl_simpleitems_postfix)); + if(fexists(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".md3"))) + this.mdl = strzone(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".md3")); + else if(fexists(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".dpm"))) + this.mdl = strzone(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".dpm")); + else if(fexists(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".iqm"))) + this.mdl = strzone(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".iqm")); + else if(fexists(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".mdl"))) + this.mdl = strzone(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".mdl")); else { this.draw = ItemDraw; diff --git a/qcsrc/lib/counting.qh b/qcsrc/lib/counting.qh index e430a648d..c44951225 100644 --- a/qcsrc/lib/counting.qh +++ b/qcsrc/lib/counting.qh @@ -163,42 +163,37 @@ string process_time(float outputtype, float seconds) if (tmp_minutes) { - output = sprintf( - "%s%s", + output = strcat( count_minutes(tmp_minutes), - ((output != "") ? sprintf(", %s", output) : "")); + ((output != "") ? strcat(", ", output) : "")); } if (tmp_hours) { - output = sprintf( - "%s%s", + output = strcat( count_hours(tmp_hours), - ((output != "") ? sprintf(", %s", output) : "")); + ((output != "") ? strcat(", ", output) : "")); } if (tmp_days) { - output = sprintf( - "%s%s", + output = strcat( count_days(tmp_days), - ((output != "") ? sprintf(", %s", output) : "")); + ((output != "") ? strcat(", ", output) : "")); } if (tmp_weeks) { - output = sprintf( - "%s%s", + output = strcat( count_weeks(tmp_weeks), - ((output != "") ? sprintf(", %s", output) : "")); + ((output != "") ? strcat(", ", output) : "")); } if (tmp_years) { - output = sprintf( - "%s%s", + output = strcat( count_years(tmp_years), - ((output != "") ? sprintf(", %s", output) : "")); + ((output != "") ? strcat(", ", output) : "")); } return output; @@ -214,9 +209,8 @@ string process_time(float outputtype, float seconds) if (tmp_days) { output = sprintf( - "%s%s", count_days(tmp_days), - ((output != "") ? sprintf(", %s", output) : "")); + ((output != "") ? strcat(", ", output) : "")); } return output;