Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2005:
[Freeciv-Dev] (PR#13916) loaded units shouldn't be allowed to fortify
Home

[Freeciv-Dev] (PR#13916) loaded units shouldn't be allowed to fortify

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13916) loaded units shouldn't be allowed to fortify
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 3 Oct 2005 16:38:24 -0700
Reply-to: bugs@xxxxxxxxxxx

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

> [jdorje - Mon Oct 03 18:24:36 2005]:
> 
> > [jdorje - Wed Sep 07 21:22:47 2005]:
> > 
> > Units loaded in transporters either shouldn't be allowed to fortify (in 
> > can_unit_do_activity) or the act of fortifying should unload them.
> 
> Here's a patch for 2.0.  For 2.1 I'd like to make some more exciting
> changes here...

This version also fixes a bug for the sentry check.

-jason

? data/amplio
? data/amplio.tilespec
Index: common/unit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v
retrieving revision 1.219.2.7
diff -p -u -r1.219.2.7 unit.c
--- common/unit.c       24 Sep 2005 01:28:05 -0000      1.219.2.7
+++ common/unit.c       3 Oct 2005 18:38:25 -0000
@@ -908,6 +908,7 @@ bool can_unit_do_activity_targeted_at(st
 
   case ACTIVITY_FORTIFYING:
     return (is_ground_unit(punit)
+           && punit->transported_by == -1
            && punit->activity != ACTIVITY_FORTIFIED
            && !unit_flag(punit, F_SETTLERS)
            && !is_ocean(ptile->terrain));
@@ -929,12 +930,9 @@ bool can_unit_do_activity_targeted_at(st
            && !is_ocean(ptile->terrain));
 
   case ACTIVITY_SENTRY:
-    if (!can_unit_survive_at_tile(punit, punit->tile)
-       && punit->transported_by == -1) {
-      /* Don't let units sentry on tiles they will die on. */
-      return FALSE;
-    }
-    return TRUE;
+    /* Don't let units sentry on tiles they will die on. */
+    return (can_unit_survive_at_tile(punit, ptile)
+           || (ptile == punit->tile && punit->transported_by != -1));
 
   case ACTIVITY_RAILROAD:
     /* if the tile has road, the terrain must be ok.. */

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