Längenbegrenzung für ROUTE wird überprüft

This commit is contained in:
Enno Rehling 2002-09-22 15:40:33 +00:00
parent b41b312998
commit b71709e515
1 changed files with 4 additions and 1 deletions

View File

@ -733,7 +733,7 @@ cycle_route(unit *u, int gereist)
{ {
int cm = 0; int cm = 0;
char tail[1024]; char tail[1024];
char neworder[1024]; char neworder[2048];
char *token; char *token;
direction_t d = NODIRECTION; direction_t d = NODIRECTION;
boolean paused = false; boolean paused = false;
@ -744,6 +744,8 @@ cycle_route(unit *u, int gereist)
strcpy(neworder, locale_string(u->faction->locale, keywords[K_ROUTE])); strcpy(neworder, locale_string(u->faction->locale, keywords[K_ROUTE]));
/* fprintf(stderr, "Calc route: %s %s\n", unitname(u), regionname(u->region, NULL)); */
for (cm=0;;++cm) { for (cm=0;;++cm) {
const struct locale * lang = u->faction->locale; const struct locale * lang = u->faction->locale;
pause = false; pause = false;
@ -759,6 +761,7 @@ cycle_route(unit *u, int gereist)
assert(!pause); assert(!pause);
if (!pause) strcat(strcat(tail, " "), LOC(lang, shortdirections[d])); if (!pause) strcat(strcat(tail, " "), LOC(lang, shortdirections[d]));
} }
else if (strlen(neworder)>sizeof(neworder)/2) break;
else if (cm==gereist && !paused && pause) { else if (cm==gereist && !paused && pause) {
strcat(strcat(tail, " "), LOC(lang, parameters[P_PAUSE])); strcat(strcat(tail, " "), LOC(lang, parameters[P_PAUSE]));
paused=true; paused=true;