comparison Ikariam.pm @ 359:4bea7db828eb

fixed scanner
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Mon, 23 Feb 2009 16:24:35 +0800
parents 824f949bc484
children d9d3cdff27c6
comparison
equal deleted inserted replaced
358:58351fccf619 359:4bea7db828eb
240 or die "gunzip failed: $GunzipError\n"; 240 or die "gunzip failed: $GunzipError\n";
241 241
242 my $nodes = jsonToObj($c); 242 my $nodes = jsonToObj($c);
243 my @islands; 243 my @islands;
244 244
245 print $nodes->{'data'}; 245 # print Dumper($nodes->{'data'});
246 foreach my $x (keys %{$nodes->{'data'}}) { 246 foreach my $x (keys %{$nodes->{'data'}}) {
247 foreach my $y (keys(%{$nodes->{data}->{$x}})) { 247 foreach my $y (keys(%{$nodes->{data}->{$x}})) {
248 my %island; 248 my %island;
249 $island{id} = $nodes->{data}->{$x}->{$y}[0];
250 $island{x} = $x; 249 $island{x} = $x;
251 $island{y} = $y; 250 $island{y} = $y;
251
252 $island{id} = $nodes->{data}->{$x}->{$y}[0];
252 $island{name} = $nodes->{data}->{$x}->{$y}[1]; 253 $island{name} = $nodes->{data}->{$x}->{$y}[1];
254 $island{tradegood} = $nodes->{data}->{$x}->{$y}[2];
255 $island{wonder} = $nodes->{data}->{$x}->{$y}[3];
256 $island{people} = $nodes->{data}->{$x}->{$y}[6];
253 257
254 # $island{tradegood} = $4;
255 # $island{wonder} = $5;
256 # $island{people} = $8;
257 push @islands, \%island; 258 push @islands, \%island;
258 } 259 }
259 } 260 }
260 return @islands; 261 return @islands;
261 } 262 }