comparison agent.pl @ 233:afd3f5cb8597

refined warehouse levels
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Thu, 06 Nov 2008 20:32:17 +0800
parents f6836ef11203
children b7ea7c43dbad
comparison
equal deleted inserted replaced
231:c0b9604b0be9 233:afd3f5cb8597
66 return (($city->{buildings}->{townHall} <= ($city->{buildings}->{safehouse} + 4)) ? 0 : 1); 66 return (($city->{buildings}->{townHall} <= ($city->{buildings}->{safehouse} + 4)) ? 0 : 1);
67 } 67 }
68 68
69 sub is_warehouse_enough { 69 sub is_warehouse_enough {
70 my ($self, $city) = @_; 70 my ($self, $city) = @_;
71 my @warehouse = (qw/undef undef 0 4 9 16 18 19 20 21 22 23 24 25/); 71 # my @warehouse = (qw/undef undef 0 4 9 16 18 19 20 21 22 23 24 25/);
72 my @warehouse = (qw/undef undef 0 4 9 15 18 19 20 21 22 23 24 25/);
72 my @cities = keys(%{$self->{ikariam}->{cities}}); 73 my @cities = keys(%{$self->{ikariam}->{cities}});
73 my $nextCities = ($#cities + 1) + 1; 74 my $nextCities = ($#cities + 1) + 1;
74 75
75 Carp::carp(sprintf("Required warehouse level %s for next city (%s), current is %s\n", $warehouse[$nextCities], $nextCities, $city->{buildings}->{warehouse})); 76 Carp::carp(sprintf("Required warehouse level %s for next city (%s), current is %s\n", $warehouse[$nextCities], $nextCities, $city->{buildings}->{warehouse}));
76 return 0 if(!defined($city->{buildings}->{warehouse})); 77 return 0 if(!defined($city->{buildings}->{warehouse}));