# HG changeset patch # User "Rex Tsai " # Date 1225684854 -28800 # Node ID b33c8dbe9b04394b9a8ed153adbb0c069c96e4e4 # Parent 2dfeb4371db7dc29b9d3f99a2b7de415be4dda6d fixed is_any_corruption diff -r 2dfeb4371db7 -r b33c8dbe9b04 agent.pl --- a/agent.pl Mon Nov 03 11:42:59 2008 +0800 +++ b/agent.pl Mon Nov 03 12:00:54 2008 +0800 @@ -51,6 +51,7 @@ my @cities = keys(%{$self->{ikariam}->{cities}}); Carp::carp(sprintf("Required warehouse level %s, current is %s only\n", $warehouse[$#cities], $city->{buildings}->{warehouse})); + return 0 if(!defined($city->{buildings}->{warehouse})); return ($city->{buildings}->{warehouse} > $warehouse[$#cities]) ? 0 : 1; } @@ -63,7 +64,7 @@ my ($self, $city) = @_; foreach (keys(%{$self->{ikariam}->{cities}})) { - return ($self->{ikariam}->{cities}->{$_}->{corruption} > 0) ? 1 : 0; + return 1 if ($self->{ikariam}->{cities}->{$_}->{corruption} > 0); } return 0; }