changeset 252:d75f26fc1c69

fixed saving ally
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Mon, 17 Nov 2008 12:44:42 +0800
parents 5527133b7c7e
children 9fe03a3d155c
files scan.pl
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scan.pl	Mon Nov 17 01:10:50 2008 +0800
+++ b/scan.pl	Mon Nov 17 12:44:42 2008 +0800
@@ -98,6 +98,7 @@
         } else {
             $ally = Ikariam::Ally->insert($h_ally);
         }
+        $ally->update();
     }
 }
 
@@ -122,8 +123,7 @@
 
         # scanning the island
         # 10 minutes cache.
-        if($island->time le (time - 60*10))
-        {
+        if($island->time le (time - 60*10)) {
             my $i = $self->{ikariam}->clone();
             my @cities = 
                 $i->viewIsland($h_island->{id});
@@ -145,19 +145,17 @@
 # alarm 3;
 our $i = new Ikariam($::server, $::user, $::pass);
 
+$i->login;
 if($#ARGV == 1) {
-    $i->login;
     my @islands = $i->viewWorldMap($ARGV[0], $ARGV[1]);
     # my $s = new Ikariam::Scanner($i);
     # $s->saveIslands(@islands);
     new Ikariam::Scanner($i)->saveIslands(@islands);
 } elsif($#ARGV == 0) {
-    $i->login;
     my $island = $ARGV[0];
     my @cities = $i->viewIsland($island);
     new Ikariam::Scanner($i)->saveCities($island, @cities);
 } elsif($#ARGV == -1) {
-    $i->login;
     my $cities = $i->check;
     # random
     foreach my $cityId (keys(%$cities)) {