Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2000:
[Freeciv-Dev] PATCH: optimized ai/advmilitary.c, ai/advspace.c
Home

[Freeciv-Dev] PATCH: optimized ai/advmilitary.c, ai/advspace.c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] PATCH: optimized ai/advmilitary.c, ai/advspace.c
From: Dirk Stoecker <stoecker@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 20 Sep 2000 14:43:51 +0200 (MET DST)

Hi,

removed compiler warnings from ai/advmilitary.c and
ai/advspace.c:

/ai/advmilitary.c 227: dead assignment eliminated "con"
/ai/advmilitary.c 640: dead assignment eliminated "harborcity"
/ai/advmilitary.c 646: dead assignment eliminated "fstk"
/ai/advmilitary.c 679: possibly uninitialized variable "bx"
/ai/advmilitary.c 679: possibly uninitialized variable "by"
/ai/advmilitary.c 731: dead assignment eliminated "m"
/ai/advmilitary.c 818: possibly uninitialized variable "bx"
/ai/advmilitary.c 815: possibly uninitialized variable "by"
/ai/advmilitary.c 1045: dead assignment eliminated "dist"

- removed obsolete con and harborcity variables and obsolete support stuff
- removed obsolete fstk variable
- bx, by initialized with 0
- removed assignments to m, dist

/ai/advspace.c 95: dead assignment eliminated "retval"

- removed assignment

Ciao
 ____  _ _  ____  _ _    _ _  ____
|    |  |  |    |  | \  / |  |    | the cool Gremlin from Bischofswerda
|  __   |   ____|  |  \/  |  |    | WWW: http://home.pages.de/~stoecker/
|    |  |  |       |      |  |    | PGP key available on www page.
|____| _|_ |____| _|_    _|_ |____| I hope AMIGA never ends to make fun!
diff -ur ../../freeciv-cvs/freeciv/ai/advmilitary.c ./ai/advmilitary.c
--- ../../freeciv-cvs/freeciv/ai/advmilitary.c  Wed Sep 20 08:56:44 2000
+++ ./ai/advmilitary.c  Wed Sep 20 09:32:59 2000
@@ -204,7 +204,7 @@
 ***********************************************************************/
 int assess_danger(struct city *pcity)
 {
-  int i, danger = 0, v, dist, con, m;
+  int i, danger = 0, v, dist, m;
   int danger2 = 0; /* linear for walls */
   int danger3 = 0; /* linear for coastal */
   int danger4 = 0; /* linear for SAM */
@@ -224,7 +224,6 @@
 
   memset(&virtualunit, 0, sizeof(struct unit));
   pplayer = &game.players[pcity->owner];
-  con = map_get_continent(pcity->x, pcity->y); /* Not using because of boats */
 
   generate_warmap(pcity, 0); /* generates both land and sea maps */
 
@@ -629,21 +628,18 @@
   int x, y, unhap = 0;
   struct unit *pdef, *aunit, *ferryboat;
   struct city *acity;
-  int boatid = 0, harborcity = 0, bx, by;
-  int needferry = 0, fstk, boatspeed, sanity;
+  int boatid = 0, bx = 0, by = 0;
+  int needferry = 0, boatspeed, sanity;
 
   if (pcity->ai.danger && !assess_defense(pcity)) return;
 
   if (is_ground_unit(myunit)) boatid = find_boat(pplayer, &bx, &by, 2);
-  if (is_ground_unit(myunit) && !myunit->id &&
-      is_terrain_near_tile(myunit->x, myunit->y, T_OCEAN))
-    harborcity++;
 
   ferryboat = player_find_unit_by_id(pplayer, boatid);
   if (ferryboat) boatspeed = (unit_flag(ferryboat->type, F_TRIREME) ? 6 : 12);
   else boatspeed = (get_invention(pplayer, game.rtech.nav) != TECH_KNOWN ? 6 : 
12);
 
-  fstk = find_something_to_kill(pplayer, myunit, &x, &y);
+  find_something_to_kill(pplayer, myunit, &x, &y);
 
   acity = map_get_city(x, y);
   if (!acity) aunit = get_defender(pplayer, myunit, x, y);
@@ -728,7 +724,6 @@
     } /* end dealing with cities */
 
     else {
-      m = 0;
       pdef = aunit; /* we KNOW this is the get_defender -- Syela */
 
       m = unit_types[pdef->type].build_cost;
@@ -1042,7 +1037,7 @@
 
 void establish_city_distances(struct player *pplayer, struct city *pcity)
 {
-  int dist = 0;
+  int dist;
   int wondercity;
   int freight;
 /* at this moment, our warmap is intact.  we need to do two things: */
diff -ur ../../freeciv-cvs/freeciv/ai/advspace.c ./ai/advspace.c
--- ../../freeciv-cvs/freeciv/ai/advspace.c     Wed Sep 20 08:56:43 2000
+++ ./ai/advspace.c     Wed Sep 20 09:37:34 2000
@@ -92,7 +92,6 @@
       packet.action = SSHIP_ACT_PLACE_STRUCTURAL;
       packet.num = 0;
       handle_spaceship_action(pplayer, &packet);
-      retval=1;
     }
     
     if (ship->habitation >= 1

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] PATCH: optimized ai/advmilitary.c, ai/advspace.c, Dirk Stoecker <=