From: Markus Armbruster Date: Sun, 27 Jan 2013 09:27:36 +0000 (+0100) Subject: ef_verify: Cover sector coordinates in game state verification X-Git-Tag: v4.3.32~48 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=22d39b9afa269cb405f8ce82c9a64ae130d733d1 ef_verify: Cover sector coordinates in game state verification Signed-off-by: Markus Armbruster --- diff --git a/src/lib/common/ef_verify.c b/src/lib/common/ef_verify.c index 1443e5247..5c9bbf070 100644 --- a/src/lib/common/ef_verify.c +++ b/src/lib/common/ef_verify.c @@ -28,7 +28,7 @@ * * Known contributors to this file: * Ron Koenderink, 2005 - * Markus Armbruster, 2006-2011 + * Markus Armbruster, 2006-2013 */ #include @@ -209,6 +209,27 @@ verify_table(int type) return retval; } +static int +verify_sectors(int may_put) +{ + int i; + struct sctstr *sp; + coord x, y; + + /* laziness: assumes sector file is EFF_MEM */ + for (i = 0; (sp = getsectid(i)); i++) { + sctoff2xy(&x, &y, sp->sct_uid); + if (sp->sct_x != x || sp->sct_y != y) { + sp->sct_x = x; + sp->sct_y = y; + if (may_put) + putsect(sp); + verify_fail(EF_SECTOR, i, NULL, 0, "bogus coordinates (fixed)"); + } + } + return 0; +} + static int verify_planes(int may_put) { @@ -351,6 +372,7 @@ ef_verify_state(int may_put) } /* Special checks */ + retval |= verify_sectors(may_put); retval |= verify_planes(may_put); retval |= verify_lands(may_put); retval |= verify_nukes(may_put);