Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] Re: (PR#4387) The Return of the Rand() Moves
Home

[Freeciv-Dev] Re: (PR#4387) The Return of the Rand() Moves

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#4387) The Return of the Rand() Moves
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sat, 12 Mar 2005 04:08:59 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Here is a patch to implement the best-time move model (ie if you have any
move points left, you can move onto any tile). Please playtest and give
feedback. I played it quite a bit, and it did not feel very different from
what we have now. It also has none of the annoyances of the worst-time
model. I say we go for this.

  - Per

Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.323
diff -u -r1.323 unithand.c
--- server/unithand.c   23 Feb 2005 03:34:06 -0000      1.323
+++ server/unithand.c   12 Mar 2005 12:02:15 -0000
@@ -1123,9 +1123,7 @@
     } unit_list_iterate_end;
   }
 
-
-  if (can_unit_move_to_tile_with_notify(punit, pdesttile, igzoc)
-      && try_move_unit(punit, pdesttile)) {
+  if (can_unit_move_to_tile_with_notify(punit, pdesttile, igzoc)) {
     int move_cost = map_move_cost(punit, pdesttile);
 
     (void) move_unit(punit, pdesttile, move_cost);
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.325
diff -u -r1.325 unittools.c
--- server/unittools.c  6 Mar 2005 18:37:28 -0000       1.325
+++ server/unittools.c  12 Mar 2005 12:02:16 -0000
@@ -2099,23 +2099,6 @@
 }
 
 /**************************************************************************
-Move the unit if possible 
-  if the unit has less moves than it costs to enter a square, we roll the dice:
-  1) either succeed
-  2) or have it's moves set to 0
-  a unit can always move atleast once
-**************************************************************************/
- bool try_move_unit(struct unit *punit, struct tile *dst_tile)
-{
-  if (myrand(1 + map_move_cost(punit, dst_tile)) > punit->moves_left
-      && punit->moves_left<unit_move_rate(punit)) {
-    punit->moves_left=0;
-    send_unit_info(unit_owner(punit), punit);
-  }
-  return punit->moves_left > 0;
-}
-
-/**************************************************************************
   go by airline, if both cities have an airport and neither has been used this
   turn the unit will be transported by it and have it's moves set to 0
 **************************************************************************/
Index: server/unittools.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.h,v
retrieving revision 1.71
diff -u -r1.71 unittools.h
--- server/unittools.h  29 Sep 2004 02:24:24 -0000      1.71
+++ server/unittools.h  12 Mar 2005 12:02:16 -0000
@@ -75,7 +75,6 @@
 
 /* doing a unit activity */
 void do_nuclear_explosion(struct player *pplayer, struct tile *ptile);
-bool try_move_unit(struct unit *punit, struct tile *ptile); 
 bool do_airline(struct unit *punit, struct city *city2);
 bool do_paradrop(struct unit *punit, struct tile *ptile);
 void load_unit_onto_transporter(struct unit *punit, struct unit *ptrans);

[Prev in Thread] Current Thread [Next in Thread]