Author: cazfi
Date: Fri Dec 12 20:04:04 2014
New Revision: 27276

URL: http://svn.gna.org/viewcvs/freeciv?rev=27276&view=rev
Log:
Added sanity check that units doing activity that requires target, do have one

See patch #5503

Modified:
    trunk/server/sanitycheck.c

Modified: trunk/server/sanitycheck.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/sanitycheck.c?rev=27276&r1=27275&r2=27276&view=diff
==============================================================================
--- trunk/server/sanitycheck.c  (original)
+++ trunk/server/sanitycheck.c  Fri Dec 12 20:04:04 2014
@@ -358,6 +358,7 @@
   players_iterate(pplayer) {
     unit_list_iterate(pplayer->units, punit) {
       struct tile *ptile = unit_tile(punit);
+      struct terrain *pterr = tile_terrain(ptile);
       struct city *pcity;
       struct city *phome;
       struct unit *ptrans = unit_transport_get(punit);
@@ -382,6 +383,12 @@
                     TILE_XY(ptile), unit_rule_name(punit),
                     get_activity_text(punit->activity),
                     tile_get_info_text(ptile, TRUE, 0));
+      }
+
+      if (activity_requires_target(punit->activity)
+          && (punit->activity != ACTIVITY_IRRIGATE || pterr->irrigation_result 
== pterr)
+          && (punit->activity != ACTIVITY_MINE || pterr->mining_result == 
pterr)) {
+        SANITY_CHECK(punit->activity_target != NULL);
       }
 
       pcity = tile_city(ptile);


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

Reply via email to