[Freeciv-Dev] Re: (PR#6413) improved sanity check for unavailable tiles
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] Re: (PR#6413) improved sanity check for unavailable tiles |
From: |
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> |
Date: |
Tue, 7 Oct 2003 14:35:28 -0700 |
Reply-to: |
rt@xxxxxxxxxxxxxx |
Jason Short wrote:
> check_cities should go straight to the source to verify that a tile is
> actually unavailable.
This patch adds city_can_work_tile checks for empty and worked tiles as
well. The sanity check code already checks explicity conditions, but
not all of them - making the full call ensures that we catch everything.
This does mean that if there's an error multiple messages will be given.
This could be avoided with some "else" clauses.
jason
Index: server/sanitycheck.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sanitycheck.c,v
retrieving revision 1.35
diff -u -r1.35 sanitycheck.c
--- server/sanitycheck.c 2003/09/23 18:53:08 1.35
+++ server/sanitycheck.c 2003/10/07 21:33:34
@@ -25,6 +25,7 @@
#include "terrain.h"
#include "unit.h"
+#include "citytools.h"
#include "maphand.h"
#include "sanitycheck.h"
#include "unittools.h"
@@ -176,6 +177,12 @@
"empty but in enemy territory!",
pcity->name, x, y);
}
+ if (!city_can_work_tile(pcity, x, y)) {
+ /* Complete check. */
+ freelog(LOG_ERROR, "Tile at %s->%d,%d marked as "
+ "empty but is unavailable!",
+ pcity->name, x, y);
+ }
break;
case C_TILE_WORKER:
if (map_get_tile(map_x, map_y)->worked != pcity) {
@@ -194,12 +201,15 @@
"worked but in enemy territory!",
pcity->name, x, y);
}
+ if (!city_can_work_tile(pcity, x, y)) {
+ /* Complete check. */
+ freelog(LOG_ERROR, "Tile at %s->%d,%d marked as "
+ "worked but is unavailable!",
+ pcity->name, x, y);
+ }
break;
case C_TILE_UNAVAILABLE:
- if (!map_get_tile(map_x, map_y)->worked
- && !is_enemy_unit_tile(ptile, pplayer)
- && map_is_known(map_x, map_y, pplayer)
- && (!owner || owner->player_no == pcity->owner)) {
+ if (city_can_work_tile(pcity, x, y)) {
freelog(LOG_ERROR, "Tile at %s->%d,%d marked as "
"unavailable but seems to be available!",
pcity->name, x, y);
|
|