Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2005:
[Freeciv-Dev] (PR#13565) putting ptile->owner into playermap is bad
Home

[Freeciv-Dev] (PR#13565) putting ptile->owner into playermap is bad

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13565) putting ptile->owner into playermap is bad
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Oct 2005 22:42:06 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13565 >

This patch reverts the PR#10191 border behavior, making borders
omniscient again.

-jason

Index: server/citytools.c
===================================================================
--- server/citytools.c  (revision 11137)
+++ server/citytools.c  (working copy)
@@ -1332,9 +1332,9 @@
   struct city *pcity = tile_get_city(ptile);
 
   packet->id = pdcity->id;
-  if (pdtile->owner >= 0) {
+  if (ptile->owner) {
     /* Use tile owner information not city owner information. */
-    packet->owner = pdtile->owner;
+    packet->owner = ptile->owner->player_no;
   } else {
     packet->owner = pdcity->owner->player_no;
   }
Index: server/maphand.c
===================================================================
--- server/maphand.c    (revision 11131)
+++ server/maphand.c    (working copy)
@@ -464,6 +464,7 @@
 
   info.x = ptile->x;
   info.y = ptile->y;
+  info.owner = ptile->owner ? ptile->owner->player_no : MAP_TILE_OWNER_NULL;
   if (ptile->spec_sprite) {
     sz_strlcpy(info.spec_sprite, ptile->spec_sprite);
   } else {
@@ -484,7 +485,6 @@
        info.special[spe] = BV_ISSET(ptile->special, spe);
       }
       info.continent = ptile->continent;
-      info.owner = ptile->owner ? ptile->owner->player_no : 
MAP_TILE_OWNER_NULL;
       send_packet_tile_info(pconn, &info);
     } else if (pplayer && map_is_known(ptile, pplayer)
               && map_get_seen(ptile, pplayer) == 0) {
@@ -492,7 +492,6 @@
 
       info.known = TILE_KNOWN_FOGGED;
       info.type = plrtile->terrain->index;
-      info.owner = plrtile->owner >= 0 ? plrtile->owner : MAP_TILE_OWNER_NULL;
       for (spe = 0; spe < S_LAST; spe++) {
        info.special[spe] = BV_ISSET(plrtile->special, spe);
       }
@@ -1043,7 +1042,6 @@
 
   plrtile->last_updated = GAME_START_YEAR;
   plrtile->own_seen = plrtile->seen_count;
-  plrtile->owner = -1;
 }
 
 /****************************************************************************
@@ -1071,16 +1069,9 @@
 
   if (plrtile->terrain != ptile->terrain
       || memcmp(&plrtile->special, &ptile->special,
-               sizeof(plrtile->special)) != 0
-      || (ptile->owner && plrtile->owner != ptile->owner->player_no)
-      || (!ptile->owner && plrtile->owner >= 0)) {
+               sizeof(plrtile->special)) != 0) {
     plrtile->terrain = ptile->terrain;
     plrtile->special = ptile->special;
-    if (ptile->owner) {
-      plrtile->owner = ptile->owner->player_no;
-    } else {
-      plrtile->owner = -1;
-    }
     return TRUE;
   }
   return FALSE;
@@ -1148,7 +1139,6 @@
       map_set_known(ptile, pdest);
       dest_tile->terrain = from_tile->terrain;
       dest_tile->special = from_tile->special;
-      dest_tile->owner = from_tile->owner;
       dest_tile->last_updated = from_tile->last_updated;
       send_tile_info(pdest->connections, ptile);
        
@@ -1638,7 +1628,10 @@
 
       if (new_owner != tile_get_owner(tile1)) {
        tile_set_owner(tile1, new_owner);
-        update_tile_knowledge(tile1);
+       /* Note we call send_tile_info, not update_tile_knowledge here.
+        * Borders information is sent to everyone who has seen the tile
+        * before; it's not stored in the playermap. */
+       send_tile_info(NULL, tile1);
        tile_update_owner(tile1);
        /* Update happiness */
        if (game.info.happyborders > 0) {
Index: server/maphand.h
===================================================================
--- server/maphand.h    (revision 11131)
+++ server/maphand.h    (working copy)
@@ -39,7 +39,6 @@
 struct player_tile {
   struct terrain *terrain; /* May be NULL for unknown tiles. */
   bv_special special;
-  signed char owner;
   unsigned short seen_count;
   unsigned short own_seen;
   /* If you build a city with an unknown square within city radius
Index: server/savegame.c
===================================================================
--- server/savegame.c   (revision 11131)
+++ server/savegame.c   (working copy)
@@ -185,8 +185,7 @@
 #define SAVEFILE_OPTIONS "startoptions spacerace2 rulesets" \
 " diplchance_percent map_editor known32fix turn " \
 "attributes watchtower rulesetdir client_worklists orders " \
-"startunits turn_last_built improvement_order technology_order embassies " \
-"owner_player_map"
+"startunits turn_last_built improvement_order technology_order embassies"
 
 static const char hex_chars[] = "0123456789abcdef";
 
@@ -2270,7 +2269,6 @@
                            char** improvement_order,
                            int improvement_order_size)
 {
-  char *savefile_options = secfile_lookup_str(file, "savefile.options");
   int i;
 
   if (!plr->is_alive)
@@ -2332,29 +2330,6 @@
                  map_get_player_tile(ptile, plr)->last_updated |=
                  ascii_hex2bin(ch, 3));
 
-    /* get 4-bit segments of 8-bit "owner" field */
-    if (has_capability("owner_player_map", savefile_options)) {
-      LOAD_MAP_DATA(ch, nat_y, ptile,
-                    secfile_lookup_str
-                    (file, "player%d.map_oa%03d", plrno, nat_y),
-                    map_get_player_tile(ptile, plr)->owner =
-                    ascii_hex2bin(ch, 0));
-      LOAD_MAP_DATA(ch, nat_y, ptile,
-                    secfile_lookup_str
-                    (file, "player%d.map_ob%03d", plrno, nat_y),
-                    map_get_player_tile(ptile, plr)->owner =
-                    ascii_hex2bin(ch, 1));
-    } else {
-      int nat_x, nat_y;
-      for (nat_y = 0; nat_y < map.ysize; nat_y++) {
-        for (nat_x = 0; nat_x < map.xsize; nat_x++) {
-          struct tile *ptile = native_pos_to_tile(nat_x, nat_y);
-          map_get_player_tile(ptile, plr)->owner =
-            ptile->owner ? ptile->owner->player_no : -1;
-        }
-      }
-    }
-
     {
       int j;
       struct dumb_city *pdcity;
@@ -2933,14 +2908,6 @@
                         bin2ascii_hex(map_get_player_tile
                                       (ptile, plr)->last_updated, 3));
 
-    /* put 4-bit segments of 8-bit "owner" field */
-    SAVE_PLAYER_MAP_DATA(ptile, file, "player%d.map_oa%03d", plrno,
-                         bin2ascii_hex(map_get_player_tile
-                                       (ptile, plr)->owner, 0));
-    SAVE_PLAYER_MAP_DATA(ptile, file, "player%d.map_ob%03d", plrno,
-                         bin2ascii_hex(map_get_player_tile
-                                       (ptile, plr)->owner, 1));
-
     if (TRUE) {
       struct dumb_city *pdcity;
       char impr_buf[MAX_NUM_ITEMS + 1];

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13565) putting ptile->owner into playermap is bad, Jason Short <=