]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/util.qc
Merge branch 'terencehill/translation_system_improvements_2' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / util.qc
index 619e1d1a5a5e40da48989789c482bf9276286dad..f4faea62b92a3623530aa684f63a54fb58445590 100644 (file)
@@ -17,39 +17,6 @@ float GL_Have_TextureCompression()
        return (GL_CheckExtension("GL_EXT_texture_compression_s3tc") && GL_CheckExtension("GL_ARB_texture_compression"));
 }
 
-void loadTooltips()
-{
-       tooltipdb = db_load(language_filename("tooltips.db"));
-}
-void unloadTooltips()
-{
-       if(tooltipdb >= 0)
-               db_close(tooltipdb);
-       tooltipdb = -1;
-}
-string getZonedTooltipForIdentifier(string s)
-{
-       string t;
-       if(s == "")
-               return string_null;
-       if(tooltipdb >= 0)
-       {
-               t = db_get(tooltipdb, s);
-               if(t == "-")
-                       return string_null;
-               if(t != "")
-                       return strzone(t);
-       }
-       if(prvm_language == "en")
-       {
-               t = cvar_description(s);
-               if(t != "" && t != "custom cvar")
-                       return strzone(t);
-       }
-       LOG_TRACE("WARNING: no tooltip set for ", s, "\n");
-       return string_null;
-}
-
 .entity parent, firstChild, nextSibling;
 void forAllDescendants(entity root, void(entity, entity) funcPre, void(entity, entity) funcPost, entity pass)
 {
@@ -274,6 +241,32 @@ void setDependentWeird(entity e, float(entity) func)
        setDependent_Check(e);
 }
 
+void setZonedTooltip(entity e, string theTooltip, string theCvar)
+{
+       if(theTooltip == "") // no tooltip, use cvar description then
+       {
+               if(theCvar != "" && prvm_language == "en")
+               {
+                       string t = cvar_description(theCvar);
+                       if(t != "" && t != "custom cvar")
+                               theTooltip = t;
+               }
+       }
+       else if(theTooltip == "-") // no cvar description as tooltip
+       {
+               theTooltip = string_null;
+       }
+
+       if(e.tooltip)
+               strunzone(e.tooltip);
+       e.tooltip = (theTooltip != "") ? strzone(theTooltip) : string_null;
+}
+
+void clearTooltip(entity e)
+{
+       setZonedTooltip(e, string_null, string_null);
+}
+
 // URI SYSTEM ////////////////////////////////////////////////////////
 
 float _Nex_ExtResponseSystem_Queried;