Author: sveinung
Date: Wed Oct  5 02:26:04 2016
New Revision: 33999

URL: http://svn.gna.org/viewcvs/freeciv?rev=33999&view=rev
Log:
unit_conquer_city(): soften rule hard coding.

The function unit_conquer_city() should no longer be asked to have a unit
conquer a city it can't conquer because it isn't at war with it or because
it can't conquer any cities. Turn the checks into assertions.

See patch #7755

Modified:
    trunk/server/citytools.c

Modified: trunk/server/citytools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/citytools.c?rev=33999&r1=33998&r2=33999&view=diff
==============================================================================
--- trunk/server/citytools.c    (original)
+++ trunk/server/citytools.c    Wed Oct  5 02:26:04 2016
@@ -1858,12 +1858,14 @@
   struct player *pplayer = unit_owner(punit);
   struct player *cplayer = city_owner(pcity);
 
-  /* If not at war, may peacefully enter city. Or, if we cannot occupy
-   * the city, this unit entering will not trigger the effects below. */
-  if (!pplayers_at_war(pplayer, cplayer)
-      || !unit_can_take_over(punit)) {
-    return FALSE;
-  }
+  /* If not at war, may peacefully enter city. */
+  fc_assert_ret_val_msg(pplayers_at_war(pplayer, cplayer), FALSE,
+                        "Can't conquer city during peace.");
+
+  /* If we cannot occupy the city, this unit entering will not trigger the
+   * effects below. */
+  fc_assert_ret_val_msg(unit_can_take_over(punit), FALSE,
+                        "Bad unit for city occupation.");
 
   /* A transported unit trying to conquer a city should already have been
    * unloaded. */


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to