]> git.pond.sub.org Git - empserver/commitdiff
Implement xundump table truncation
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 26 Feb 2008 20:19:26 +0000 (21:19 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 14 Mar 2008 19:25:10 +0000 (20:25 +0100)
src/lib/common/xundump.c

index ed31db4f1b78cec429d0ca5aa39c30d4b921325b..a2b3bd42339f4fa6627f221a64baaf07c731a3e6 100644 (file)
@@ -986,12 +986,9 @@ xubody(FILE *fp)
     if (CANT_HAPPEN(maxid > ep->fids))
        maxid = ep->fids;
     if (maxid < ep->fids) {
-       if (EF_IS_GAME_STATE(cur_type) && maxid != ep->csize)
-           /* TODO truncate file */
-           gripe("Warning: should resize table %s from %d to %d, not implemented",
-                 ef_nameof(cur_type), ep->csize, maxid);
-       else if (cur_type >= EF_SHIP_CHR && cur_type <= EF_NUKE_CHR)
-           ep->cids = ep->fids = maxid;
+       if (EF_IS_GAME_STATE(cur_type)
+           || (cur_type >= EF_SHIP_CHR && cur_type <= EF_NUKE_CHR))
+           ef_truncate(cur_type, maxid);
        else
            return gripe("Table %s requires %d rows, got %d",
                         ef_nameof(cur_type), ep->fids, maxid);