Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2005:
[Freeciv-Dev] (PR#14319) rehoming homeless units
Home

[Freeciv-Dev] (PR#14319) rehoming homeless units

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#14319) rehoming homeless units
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Oct 2005 00:55:41 -0700
Reply-to: bugs@xxxxxxxxxxx

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

It's always bugged me that accidentally pressing 'h' will give 
homecities to those all-important homeless units.

This patch prevents it.

-jason

Index: common/unit.c
===================================================================
--- common/unit.c       (revision 11127)
+++ common/unit.c       (working copy)
@@ -427,7 +427,15 @@
 **************************************************************************/
 bool can_unit_change_homecity(const struct unit *punit)
 {
-  return punit->tile->city && punit->tile->city->owner == punit->owner;
+  /* Requirements to change homecity:
+   *
+   * 1. Homeless cities can't change homecity (this is a feature since
+   *    being homeless is a big benefit).
+   * 2. The unit must be inside the city it is rehoming to.
+   * 3. Of course you can only have your own cities as homecity. */
+  return (punit->homecity != -1
+         && punit->tile->city
+         && punit->tile->city->owner == punit->owner);
 }
 
 /**************************************************************************

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#14319) rehoming homeless units, Jason Short <=