diff --git a/src/move.c b/src/move.c index 5eb46598d..bb6b9d212 100644 --- a/src/move.c +++ b/src/move.c @@ -1133,25 +1133,19 @@ order * cycle_route(order * ord, const struct locale *lang, int gereist) order * make_movement_order(const struct locale *lang, direction_t steps[], int length) { - char zOrder[128], *bufp = zOrder; - size_t size = sizeof(zOrder) - 1; + sbstring sbs; + char zOrder[128]; int i; + sbs_init(&sbs, zOrder, sizeof(zOrder)); for (i = 0; i != length; ++i) { - int bytes; direction_t dir = steps[i]; - if (size > 1 && bufp != zOrder) { - *bufp++ = ' '; - --size; + if (i > 0) { + sbs_strcat(&sbs, " "); } - bytes = - (int)str_strlcpy(bufp, - (const char *)LOC(lang, directions[dir]), size); - if (wrptr(&bufp, &size, bytes) != 0) - WARN_STATIC_BUFFER(); + sbs_strcat(&sbs, LOC(lang, directions[dir])); } - *bufp = 0; return create_order(K_MOVE, lang, zOrder); }