From 1b15838f4e3a484a358537424fc2b35d4009508b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 22 Aug 2005 19:49:51 +0000 Subject: [PATCH] Not saving more than 128 orders in the datafile (damn those script-kiddies) --- src/common/kernel/save.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 19c2545cb..4a3725532 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -1237,7 +1237,7 @@ void writeunit(FILE * F, const unit * u) { order * ord; - int i; + int i, p = 0; wi36(F, u->no); wi36(F, u->faction->no); ws(F, u->name); @@ -1257,15 +1257,25 @@ writeunit(FILE * F, const unit * u) wnl(F); #ifndef LASTORDER for (ord = u->old_orders; ord; ord=ord->next) { - fwriteorder(F, ord, u->faction->locale); - fputc(' ', F); + if (++pfaction->locale); + fputc(' ', F); + } else { + log_error(("%s had %d or more persistent orders\n", unitname(u), MAXPERSISTENT)); + break; + } } #endif for (ord = u->orders; ord; ord=ord->next) { if (u->old_orders && is_repeated(ord)) continue; /* has new defaults */ if (is_persistent(ord)) { - fwriteorder(F, ord, u->faction->locale); - fputc(' ', F); + if (++pfaction->locale); + fputc(' ', F); + } else { + log_error(("%s had %d or more persistent orders\n", unitname(u), MAXPERSISTENT)); + break; + } } } /* write an empty string to terminate the list */