comparison scan.pl @ 126:3196b1f5dc13

merged changes.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Fri, 31 Oct 2008 00:51:49 +0800
parents 6043e9bfdeef
children 124fc7abda39
comparison
equal deleted inserted replaced
120:bdf025bc50ea 126:3196b1f5dc13
11 if ($#cities == -1) { 11 if ($#cities == -1) {
12 warn ("empty cities list.\n"); 12 warn ("empty cities list.\n");
13 return; 13 return;
14 } 14 }
15 15
16 foreach my $h_city (@cities) 16 foreach my $h_city (@cities) {
17 {
18 $h_city->{island} = $island; 17 $h_city->{island} = $island;
19 $h_city->{'time'} = time; 18 $h_city->{'time'} = time;
20 my $c = Ikariam::Cities->retrieve($h_city->{cityId}); 19 my $c = Ikariam::Cities->retrieve($h_city->{cityId});
21 if(defined($c)) { 20 if(defined($c)) {
22 foreach (keys(%$h_city)) { 21 foreach (keys(%$h_city)) {
26 $c = Ikariam::Cities->insert($h_city); 25 $c = Ikariam::Cities->insert($h_city);
27 } 26 }
28 $c->update(); 27 $c->update();
29 28
30 my $user = Ikariam::User->retrieve($h_city->{'user'}); 29 my $user = Ikariam::User->retrieve($h_city->{'user'});
31 next if (defined($user) && $user->time le (time - 60*60*1)); 30 next if (defined($user) && defined($user->time) && $user->time le (time - 60*60*1));
32 31
33 saveUser($h_city->{owner}); 32 saveUser($h_city->{owner});
34 } 33 }
35 } 34 }
36 35
94 $i->login; 93 $i->login;
95 @islands = $i->viewHomeMap(); 94 @islands = $i->viewHomeMap();
96 } else { 95 } else {
97 die("Usage: $0\nUsage: $0 x y\n"); 96 die("Usage: $0\nUsage: $0 x y\n");
98 } 97 }
98
99 foreach my $h_island (@islands) 99 foreach my $h_island (@islands)
100 { 100 {
101 printf("checking island %d\n", $h_island->{id}); 101 printf("checking island %d\n", $h_island->{id});
102 102
103 my $island; 103 my $island;