From: TimePath Date: Sat, 10 Oct 2015 03:28:18 +0000 (+1100) Subject: String: use strhasword X-Git-Tag: xonotic-v0.8.2~1839^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=92aab7de21d16166eb28ef5e0caf15c850e3dbf4;p=xonotic%2Fxonotic-data.pk3dir.git String: use strhasword --- diff --git a/qcsrc/menu/xonotic/cvarlist.qc b/qcsrc/menu/xonotic/cvarlist.qc index c30361532..8323221da 100644 --- a/qcsrc/menu/xonotic/cvarlist.qc +++ b/qcsrc/menu/xonotic/cvarlist.qc @@ -70,12 +70,12 @@ float XonoticCvarList_updateCvarType(entity me) t = cvar_type(me.cvarName); me.cvarType = ""; float needsForcing; - if(strstrofs(strcat(" ", autocvar_menu_forced_saved_cvars, " "), strcat(" ", me.cvarName, " "), 0) >= 0) + if(strhasword(autocvar_menu_forced_saved_cvars, me.cvarName)) { me.cvarType = strcat(me.cvarType, ", ", _("forced to be saved to config.cfg")); needsForcing = 0; } - else if(strstrofs(strcat(" ", autocvar_menu_reverted_nonsaved_cvars, " "), strcat(" ", me.cvarName, " "), 0) >= 0) + else if(strhasword(autocvar_menu_reverted_nonsaved_cvars, me.cvarName)) { // Currently claims to be saved, but won't be on next startup. me.cvarType = strcat(me.cvarType, ", ", _("will not be saved")); @@ -177,9 +177,9 @@ void XonoticCvarList_drawListBoxItem(entity me, int i, vector absSize, bool isSe v = cvar_string(k); d = cvar_defstring(k); t = cvar_type(k); - if(strstrofs(strcat(" ", autocvar_menu_forced_saved_cvars, " "), strcat(" ", k, " "), 0) >= 0) + if(strhasword(autocvar_menu_forced_saved_cvars, k)) theAlpha = SKINALPHA_CVARLIST_SAVED; - else if(strstrofs(strcat(" ", autocvar_menu_reverted_nonsaved_cvars, " "), strcat(" ", k, " "), 0) >= 0) + else if(strhasword(autocvar_menu_reverted_nonsaved_cvars, k)) theAlpha = SKINALPHA_CVARLIST_TEMPORARY; else if(t & CVAR_TYPEFLAG_SAVED) theAlpha = SKINALPHA_CVARLIST_SAVED; @@ -243,7 +243,7 @@ void CvarList_Revert_Click(entity btn, entity me) { me.cvarValueBox.setText(me.cvarValueBox, me.cvarDefault); me.cvarValueBox.cursorPos = strlen(me.cvarDefault); - if(strstrofs(strcat(" ", autocvar_menu_forced_saved_cvars, " "), strcat(" ", me.cvarName, " "), 0) >= 0) + if(strhasword(autocvar_menu_forced_saved_cvars, me.cvarName)) { cvar_set("menu_forced_saved_cvars", substring(strreplace(strcat(" ", me.cvarName, " "), " ", strcat(" ", autocvar_menu_forced_saved_cvars, " ")), 1, -2)); if (autocvar_menu_reverted_nonsaved_cvars == "") diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index 157a9199c..146075eca 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -11,7 +11,7 @@ float GL_CheckExtension(string ext) { - return (strstrofs(strcat(" ", cvar_string("gl_info_extensions"), " "), strcat(" ", ext, " "), 0) >= 0); + return strhasword(cvar_string("gl_info_extensions"), ext); } float GL_Have_TextureCompression() diff --git a/qcsrc/server/weapons/hitplot.qc b/qcsrc/server/weapons/hitplot.qc index 065edf1b1..39d91a21e 100644 --- a/qcsrc/server/weapons/hitplot.qc +++ b/qcsrc/server/weapons/hitplot.qc @@ -79,7 +79,7 @@ void W_HitPlotAnalysis(entity player, vector screenforward, vector screenright, void W_HitPlotOpen(entity player) { - if(autocvar_g_hitplots || strstrofs(strcat(" ", autocvar_g_hitplots_individuals, " "), strcat(" ", player.netaddress, " "), 0) >= 0) + if(autocvar_g_hitplots || strhasword(autocvar_g_hitplots_individuals, player.netaddress)) { player.hitplotfh = fopen(strcat("hits-", matchid, "-", player.netaddress, "-", ftos(player.playerid), ".plot"), FILE_WRITE); fputs(player.hitplotfh, strcat("#name ", player.netname, "\n"));