forked from github/server
Not saving more than 128 orders in the datafile (damn those script-kiddies)
This commit is contained in:
parent
16679a9346
commit
1b15838f4e
1 changed files with 15 additions and 5 deletions
|
@ -1237,7 +1237,7 @@ void
|
||||||
writeunit(FILE * F, const unit * u)
|
writeunit(FILE * F, const unit * u)
|
||||||
{
|
{
|
||||||
order * ord;
|
order * ord;
|
||||||
int i;
|
int i, p = 0;
|
||||||
wi36(F, u->no);
|
wi36(F, u->no);
|
||||||
wi36(F, u->faction->no);
|
wi36(F, u->faction->no);
|
||||||
ws(F, u->name);
|
ws(F, u->name);
|
||||||
|
@ -1257,15 +1257,25 @@ writeunit(FILE * F, const unit * u)
|
||||||
wnl(F);
|
wnl(F);
|
||||||
#ifndef LASTORDER
|
#ifndef LASTORDER
|
||||||
for (ord = u->old_orders; ord; ord=ord->next) {
|
for (ord = u->old_orders; ord; ord=ord->next) {
|
||||||
|
if (++p<MAXPERSISTENT) {
|
||||||
fwriteorder(F, ord, u->faction->locale);
|
fwriteorder(F, ord, u->faction->locale);
|
||||||
fputc(' ', F);
|
fputc(' ', F);
|
||||||
|
} else {
|
||||||
|
log_error(("%s had %d or more persistent orders\n", unitname(u), MAXPERSISTENT));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
for (ord = u->orders; ord; ord=ord->next) {
|
for (ord = u->orders; ord; ord=ord->next) {
|
||||||
if (u->old_orders && is_repeated(ord)) continue; /* has new defaults */
|
if (u->old_orders && is_repeated(ord)) continue; /* has new defaults */
|
||||||
if (is_persistent(ord)) {
|
if (is_persistent(ord)) {
|
||||||
|
if (++p<MAXPERSISTENT) {
|
||||||
fwriteorder(F, ord, u->faction->locale);
|
fwriteorder(F, ord, u->faction->locale);
|
||||||
fputc(' ', F);
|
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 */
|
/* write an empty string to terminate the list */
|
||||||
|
|
Loading…
Reference in a new issue