From: Mario Date: Sat, 29 Aug 2015 14:04:41 +0000 (+1000) Subject: Clean up scoreboard items a little bit X-Git-Tag: xonotic-v0.8.2~1992 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=568e0ee8a20d2376bfbd03b6e016a26a8e1c2d5b;p=xonotic%2Fxonotic-data.pk3dir.git Clean up scoreboard items a little bit --- diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index 34447c026..a601ae5d2 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -386,41 +386,38 @@ void Cmd_HUD_SetFields(float argc) hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], false, hud_fontsize); str = strtolower(str); - if(str == "ping") { - hud_field[hud_num_fields] = SP_PING; - } else if(str == "pl") { - hud_field[hud_num_fields] = SP_PL; - } else if(str == "kd" || str == "kdr" || str == "kdratio" || str == "k/d") { - hud_field[hud_num_fields] = SP_KDRATIO; - } else if(str == "sum" || str == "diff" || str == "k-d") { - hud_field[hud_num_fields] = SP_SUM; - } else if(str == "name" || str == "nick") { - hud_field[hud_num_fields] = SP_NAME; - have_name = 1; - } else if(str == "|") { - hud_field[hud_num_fields] = SP_SEPARATOR; - have_separator = 1; - } else { - for(j = 0; j < MAX_SCORE; ++j) - if(str == strtolower(scores_label[j])) - goto found; // sorry, but otherwise fteqcc -O3 miscompiles this and warns about "unreachable code" -:notfound - if(str == "frags") - { - j = SP_FRAGS; - } - else + switch(str) + { + case "ping": hud_field[hud_num_fields] = SP_PING; break; + case "pl": hud_field[hud_num_fields] = SP_PL; break; + case "pl": hud_field[hud_num_fields] = SP_PL; break; + case "kd": case "kdr": case "kdratio": case "k/d": hud_field[hud_num_fields] = SP_KDRATIO; break; + case "sum": case "diff": case "k-d": hud_field[hud_num_fields] = SP_SUM; break; + case "name": case "nick": hud_field[hud_num_fields] = SP_NAME; have_name = true; break; + case "|": hud_field[hud_num_fields] = SP_SEPARATOR; have_separator = true; break; + default: { - if (!nocomplain) - LOG_INFOF("^1Error:^7 Unknown score field: '%s'\n", str); - continue; - } + for(j = 0; j < MAX_SCORE; ++j) + if(str == strtolower(scores_label[j])) + goto found; // sorry, but otherwise fteqcc -O3 miscompiles this and warns about "unreachable code" + +:notfound + if(str == "frags") + j = SP_FRAGS; + else + { + if(!nocomplain) + LOG_INFOF("^1Error:^7 Unknown score field: '%s'\n", str); + continue; + } :found - hud_field[hud_num_fields] = j; - if(j == ps_primary) - have_primary = 1; - if(j == ps_secondary) - have_secondary = 1; + hud_field[hud_num_fields] = j; + if(j == ps_primary) + have_primary = 1; + if(j == ps_secondary) + have_secondary = 1; + + } } ++hud_num_fields; if(hud_num_fields >= MAX_HUD_FIELDS)