return -1;
fh = fopen(pFilename, FILE_READ);
if(fh < 0)
- return buf;
+ {
+ buf_del(buf);
+ return -1;
+ }
i = 0;
while((l = fgets(fh)))
{
fn = get_model_datafilename(m, sk, "txt");
fh = fopen(fn, FILE_READ);
if(fh < 0)
- return 0;
+ {
+ sk = 0;
+ fn = get_model_datafilename(m, sk, "txt");
+ fh = fopen(fn, FILE_READ);
+ if(fh < 0)
+ return 0;
+ }
get_model_parameters_modelname = m;
get_model_parameters_modelskin = sk;
}
return l;
}
+
+// translation helpers
+string language_filename(string s)
+{
+ string fn;
+ float fh;
+ fn = prvm_language;
+ if(fn == "" || fn == "dump")
+ return s;
+ fn = strcat(s, ".", fn);
+ if((fh = fopen(fn, FILE_READ)) >= 0)
+ {
+ fclose(fh);
+ return fn;
+ }
+ return s;
+}
+string CTX(string s)
+{
+ float p = strstrofs(s, "^", 0);
+ if(p < 0)
+ return s;
+ return substring(s, p+1, -1);
+}