comparison 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
comparison
equal deleted inserted replaced
365:2444685c68c9 366:2cfa03edc22e
29 foreach my $target ($user->cities) { 29 foreach my $target ($user->cities) {
30 my $island = Ikariam::Island->retrieve($target->island); 30 my $island = Ikariam::Island->retrieve($target->island);
31 my $city; 31 my $city;
32 $city->{id} = $target->id; 32 $city->{id} = $target->id;
33 $city->{name} = $target->cityname; 33 $city->{name} = $target->cityname;
34 $city->{island}->{id} = $island->id; 34 if(defined($island)) {
35 $city->{island}->{x} = $island->x; 35 $city->{island}->{id} = $island->id;
36 $city->{island}->{y} = $island->y; 36 $city->{island}->{x} = $island->x;
37 37 $city->{island}->{y} = $island->y;
38 }
38 push (@cities, $city); 39 push (@cities, $city);
39 } 40 }
40 } 41 }
41 42
42 my $n = $#cities; 43 my $n = $#cities;
106 travelMatrix($ARGV[0]); 107 travelMatrix($ARGV[0]);
107 108
108 printf("\nCities\n"); 109 printf("\nCities\n");
109 foreach my $city ($u->cities) { 110 foreach my $city ($u->cities) {
110 my $island = Ikariam::Island->retrieve($city->island); 111 my $island = Ikariam::Island->retrieve($city->island);
112 next if(!defined($island));
111 113
112 printf("Name: %s [%s:%s]\n", $city->cityname, $island->x, $island->y); 114 printf("Name: %s [%s:%s]\n", $city->cityname, $island->x, $island->y);
113 if(defined($city->status)) { 115 if(defined($city->status)) {
114 printf("Status: <<<%s>>>\n", $city->status); 116 printf("Status: <<<%s>>>\n", $city->status);
115 } 117 }