cleanup formatted output of entity attributes

This commit is contained in:
ac-stef
2015-05-27 15:47:05 +02:00
parent aa4e6e837c
commit 2f1fc1c9c8
4 changed files with 15 additions and 9 deletions
+11
View File
@@ -705,3 +705,14 @@ void clampentityattributes(persistent_entity &e)
CLAMPATTR(7);
}
}
const char *formatentityattributes(const persistent_entity &e, bool withcomma)
{
static string res;
int t = e.type < MAXENTTYPES ? e.type : 0;
const char *c = withcomma ? "," : "";
#define AA(x) floatstr(float(e.attr##x) / entscale[t][x - 1], true)
formatstring(res)("%s%s %s%s %s%s %s%s %s%s %s%s %s", AA(1), c, AA(2), c, AA(3), c, AA(4), c, AA(5), c, AA(6), c, AA(7));
#undef AA
return res;
}