Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] (PR#2513) Movepoints of defending ships
Home

[Freeciv-Dev] (PR#2513) Movepoints of defending ships

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2513) Movepoints of defending ships
From: "Thomas Strub via RT" <rt@xxxxxxxxxxxxxx>
Date: Sat, 7 Dec 2002 10:46:10 -0800
Reply-to: rt@xxxxxxxxxxxxxx

Hi,

this is a repost of my patch to change the behavior of ships which get
attacked from other ships.

Situation now:
Ship don't lose MP when losing HP in defending situation.

Situation which should be:
Ship is loosing MP when losing HP in defending situation.

Thomas
-- 
Thomas Strub  ***  eMail ue80@xxxxxxxxxxxxxxxxxxx
Nur weil das Aufzeichnen, Kopieren und Schnüffeln bei elektronischem 
Datenverkehr leichter als bei der klassischen Post ist, darf man es nicht
einfach tun.

? 3clads-against-4dest.gz
? city_incite_cost-2.1.diff
? city_incite_cost-2.2.0.diff
? city_incite_cost-2.2.1.diff
? city_incite_cost-2.2.diff
? city_incite_cost-2.diff
? city_incite_cost.diff
? city_incite_cost3.diff
? city_incite_cost4.diff
? def_ships_moves1.diff
? def_ships_moves2.diff
? dipl1.diff
? dipl2.diff
? test-prize-2.gz
? test-the-price.gz
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.234
diff -u -r1.234 unithand.c
--- server/unithand.c   2002/09/27 12:32:48     1.234
+++ server/unithand.c   2002/10/03 17:15:20
@@ -636,8 +636,8 @@
   struct player *pplayer = unit_owner(punit);
   struct packet_unit_combat combat;
   struct unit *plooser, *pwinner;
-  struct unit old_punit = *punit;      /* Used for new ship algorithm. -GJW */
   struct city *pcity;
+  int moves_used, def_moves_used; 
   int def_x = pdefender->x, def_y = pdefender->y;
   
   freelog(LOG_DEBUG, "Start attack: %s's %s against %s's %s.",
@@ -682,7 +682,9 @@
     do_nuclear_explosion(pplayer, def_x, def_y);
     return;
   }
-  
+  moves_used = unit_move_rate (punit) - punit->moves_left;
+  def_moves_used = unit_move_rate (pdefender) - pdefender->moves_left;
+
   unit_versus_unit(punit, pdefender);
 
   /* Adjust attackers moves_left _after_ unit_versus_unit() so that
@@ -695,11 +697,16 @@
    * itself). -GJW
    */
   if (is_sailing_unit (punit)) {
-    int moves_used = unit_move_rate (&old_punit) - old_punit.moves_left;
     punit->moves_left = unit_move_rate (punit) - moves_used - SINGLE_MOVE;
   } else {
     punit->moves_left -= SINGLE_MOVE;
   }
+
+  if (is_sailing_unit (pdefender)) {
+    pdefender->moves_left = unit_move_rate (pdefender) - def_moves_used;
+  } 
+
+  
   if(punit->moves_left<0)
     punit->moves_left=0;
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#2513) Movepoints of defending ships, Thomas Strub via RT <=