Closed ceski-1 closed 2 weeks ago
Somehow can't get it to work. If I select "Show player coords: advanced", nothing shows up.
Somehow can't get it to work. If I select "Show player coords: advanced", nothing shows up.
Maybe I'm doing bad string manipulation here: https://github.com/fabiangreffrath/woof/pull/1760/files#diff-a4f029940e50c96b9e3766ac0da54d42f3a3f0fbd915269dc0b4b4c1c2e3f9f3R97-R98
This works, but well...
--- a/src/hu_coordinates.c
+++ b/src/hu_coordinates.c
@@ -94,9 +94,10 @@ static split_angle_t SplitAngle(angle_t x)
static void BuildString(hu_multiline_t *const w_coord, char *buf, int len)
{
- const char *s = buf;
+ char *s = M_StringDuplicate(buf);
M_snprintf(buf, len, "%-*s", WIDGET_WIDTH, s);
HUlib_add_string_keep_space(w_coord, buf);
+ free(s);
}
static void FixedToString(hu_multiline_t *const w_coord, const char *label,
This works, but well...
Thanks! Fixed here: https://github.com/fabiangreffrath/woof/pull/1760/commits/566e848d4f9e73afbb88436deb2c47c837df0c59
There must be a better solution than running strdup()
several times per tic on the same string.
There must be a better solution than running
strdup()
several times per tic on the same string.
Different approach here: https://github.com/fabiangreffrath/woof/pull/1760/commits/bc8e19b48687f8592b21778612d2d464df0e0e18
Added by request. I'll fix any conflicts from https://github.com/fabiangreffrath/woof/pull/1759.