diff enemy.pl @ 366:2cfa03edc22e

ignore island we don't know yet
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sun, 01 Mar 2009 11:10:52 +0800
parents f9a6b226fb79
children 6ca0677a361e
line wrap: on
line diff
--- a/enemy.pl	Sun Mar 01 11:10:32 2009 +0800
+++ b/enemy.pl	Sun Mar 01 11:10:52 2009 +0800
@@ -31,10 +31,11 @@
             my $city;
             $city->{id} = $target->id;
             $city->{name} = $target->cityname;
-            $city->{island}->{id} = $island->id;
-            $city->{island}->{x} = $island->x;
-            $city->{island}->{y} = $island->y;
-
+            if(defined($island)) {
+                $city->{island}->{id} = $island->id;
+                $city->{island}->{x} = $island->x;
+                $city->{island}->{y} = $island->y;
+            }
             push (@cities, $city);
         }
     }
@@ -108,6 +109,7 @@
     printf("\nCities\n");
     foreach my $city ($u->cities) {
         my $island = Ikariam::Island->retrieve($city->island);
+        next if(!defined($island));
 
         printf("Name: %s [%s:%s]\n", $city->cityname,  $island->x, $island->y);
         if(defined($city->status)) {