diff -Nur -Xfreecivc-tileknown/diff_ignore rawcivc/client/Makefile.am freecivc-tileknown/client/Makefile.am --- rawcivc/client/Makefile.am Mon Sep 3 00:55:06 2001 +++ freecivc-tileknown/client/Makefile.am Thu Sep 13 22:33:15 2001 @@ -112,6 +112,8 @@ civclient.h \ climisc.c \ climisc.h \ + climap.c \ + climap.h \ clinet.c \ clinet.h \ control.c \ diff -Nur -Xfreecivc-tileknown/diff_ignore rawcivc/client/climap.c freecivc-tileknown/client/climap.c --- rawcivc/client/climap.c Wed Dec 31 18:00:00 1969 +++ freecivc-tileknown/client/climap.c Thu Sep 13 22:46:34 2001 @@ -0,0 +1,36 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +/********************************************************************** + this map contains client specific map functions. + don't even think about consolidating into tilespec.c and + we want codesize(climap.c) << codesize(tilespec.c) -mck +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "map.h" + +/*************************************************************** +... +***************************************************************/ +enum known_type tile_is_known(int x, int y) +{ + if (!normalize_map_pos(&x, &y)) + return TILE_UNKNOWN; + else + return (enum known_type) (map.tiles + map_inx(x, y))->known; +} + diff -Nur -Xfreecivc-tileknown/diff_ignore rawcivc/client/climap.h freecivc-tileknown/client/climap.h --- rawcivc/client/climap.h Wed Dec 31 18:00:00 1969 +++ freecivc-tileknown/client/climap.h Thu Sep 13 22:32:34 2001 @@ -0,0 +1,17 @@ +/********************************************************************** + Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +***********************************************************************/ + +enum known_type; + +enum known_type tile_is_known(int x, int y); + diff -Nur -Xfreecivc-tileknown/diff_ignore rawcivc/client/climisc.c freecivc-tileknown/client/climisc.c --- rawcivc/client/climisc.c Fri Sep 7 00:55:55 2001 +++ freecivc-tileknown/client/climisc.c Thu Sep 13 22:44:08 2001 @@ -39,6 +39,7 @@ #include "packets.h" #include "support.h" +#include "climap.h" #include "clinet.h" #include "chatline_g.h" #include "citydlg_g.h" diff -Nur -Xfreecivc-tileknown/diff_ignore rawcivc/client/control.c freecivc-tileknown/client/control.c --- rawcivc/client/control.c Mon Sep 3 00:55:07 2001 +++ freecivc-tileknown/client/control.c Thu Sep 13 22:55:55 2001 @@ -30,6 +30,7 @@ #include "menu_g.h" #include "civclient.h" +#include "climap.h" #include "clinet.h" #include "goto.h" #include "options.h" diff -Nur -Xfreecivc-tileknown/diff_ignore rawcivc/client/packhand.c freecivc-tileknown/client/packhand.c --- rawcivc/client/packhand.c Thu Sep 13 00:46:11 2001 +++ freecivc-tileknown/client/packhand.c Thu Sep 13 22:43:51 2001 @@ -43,6 +43,7 @@ #include "citydlg_g.h" #include "cityrep_g.h" #include "civclient.h" +#include "climap.h" #include "climisc.h" #include "clinet.h" /* aconnection */ #include "control.h" diff -Nur -Xfreecivc-tileknown/diff_ignore rawcivc/client/tilespec.c freecivc-tileknown/client/tilespec.c --- rawcivc/client/tilespec.c Thu Sep 13 00:46:11 2001 +++ freecivc-tileknown/client/tilespec.c Thu Sep 13 22:42:15 2001 @@ -42,6 +42,7 @@ #include "support.h" #include "unit.h" +#include "climap.h" #include "control.h" /* for fill_xxx */ #include "graphics_g.h" #include "options.h" /* for fill_xxx */ @@ -891,7 +892,7 @@ if(city_unhappy(pcity)) *sprs++ = sprites.city.disorder; - if(ptile->known==TILE_KNOWN_FOGGED && draw_fog_of_war) + if(tile_is_known(pcity->x, pcity->y) == TILE_KNOWN_FOGGED && draw_fog_of_war) *sprs++ = sprites.tx.fog; /* Put the size sprites last, so that they are not obscured @@ -1072,7 +1073,6 @@ int tspecial_north_east, tspecial_south_east, tspecial_south_west, tspecial_north_west; int tileno; - struct tile *ptile; struct city *pcity; struct Sprite **save_sprs = sprs; int dir, i; @@ -1082,11 +1082,10 @@ if (!normalize_map_pos(&x, &y)) return -1; - ptile = map_get_tile(x, y); - if (!ptile->known) + if (!tile_is_known(x, y)) return -1; - pcity = ptile->city; + pcity = map_get_city(x, y); ttype = map_get_terrain(x, y); tspecial = map_get_special(x, y); @@ -1303,7 +1302,7 @@ ptile=map_get_tile(abs_x0, abs_y0); - if(abs_y0>=map.ysize || ptile->known == TILE_UNKNOWN) { + if(abs_y0>=map.ysize || tile_is_known(abs_x0, abs_y0) == TILE_UNKNOWN) { return 0; } @@ -1527,7 +1526,8 @@ if(tspecial & S_AIRBASE && draw_fortress_airbase) *sprs++ = sprites.tx.airbase; if(tspecial & S_POLLUTION && draw_pollution) *sprs++ = sprites.tx.pollution; if(tspecial & S_FALLOUT && draw_pollution) *sprs++ = sprites.tx.fallout; - if(ptile->known==TILE_KNOWN_FOGGED && draw_fog_of_war) *sprs++ = sprites.tx.fog; + if(tile_is_known(abs_x0, abs_y0) == TILE_KNOWN_FOGGED && draw_fog_of_war) + *sprs++ = sprites.tx.fog; if(!citymode) { tileno = INDEX_NSEW((tile_is_known(abs_x0, abs_y0-1)==TILE_UNKNOWN), @@ -1716,7 +1716,7 @@ struct unit *punit; struct city *pcity; - if(!ptile->known) { + if(!tile_is_known(x, y)) { color=COLOR_STD_BLACK; } else if((pcity=map_get_city(x, y))) { if(pcity->owner==game.player_idx) diff -Nur -Xfreecivc-tileknown/diff_ignore rawcivc/common/map.c freecivc-tileknown/common/map.c --- rawcivc/common/map.c Wed Sep 12 00:49:25 2001 +++ freecivc-tileknown/common/map.c Thu Sep 13 22:34:06 2001 @@ -1245,18 +1245,6 @@ (map.tiles + x + y*map.xsize)->city=pcity; } - -/*************************************************************** -Only for use on the client side -***************************************************************/ -enum known_type tile_is_known(int x, int y) -{ - if (!normalize_map_pos(&x, &y)) - return TILE_UNKNOWN; - else - return (enum known_type) ((map.tiles + x + y * map.xsize)->known); -} - /*************************************************************** Are (x1,y1) and (x2,y2) really the same when adjusted? This function might be necessary ALOT of places... diff -Nur -Xfreecivc-tileknown/diff_ignore rawcivc/common/map.h freecivc-tileknown/common/map.h --- rawcivc/common/map.h Wed Sep 12 00:49:26 2001 +++ freecivc-tileknown/common/map.h Thu Sep 13 22:34:21 2001 @@ -212,7 +212,6 @@ void map_set_special(int x, int y, enum tile_special_type spe); void map_clear_special(int x, int y, enum tile_special_type spe); void tile_init(struct tile *ptile); -enum known_type tile_is_known(int x, int y); int check_coords(int *x, int *y); int is_real_tile(int x, int y); int normalize_map_pos(int *x, int *y);