diff warfare.pl @ 258:689c4c9fa56b

fixed loop
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Tue, 18 Nov 2008 02:28:45 +0800
parents 5527133b7c7e
children a4e52feec5a5
line wrap: on
line diff
--- a/warfare.pl	Mon Nov 17 19:15:51 2008 +0800
+++ b/warfare.pl	Tue Nov 18 02:28:45 2008 +0800
@@ -106,10 +106,11 @@
         my $c = Ikariam::Report->search_victim($city->cityId, time - 24*60*60 - 7*60*60)->count();
         # check the current plunders
         foreach (@{$self->{ikariam}->{'military'}->{'homeland'}}) {
-            # we don't attack same city twice at same time.
-            next if($_->{to} == $city->cityId);
             # counting for both leaving and coming back.
             $c++ if($_->{to} == $city->cityId || $_->{from} == $city->cityId);
+
+            # we don't attack same city twice at same time.
+            next CITY if($_->{to} == $city->cityId);
         }
         # we attack one city maximum 4 times a day.
         next if($c >= 4);