Mercurial > eagle-eye
comparison agent.pl @ 201:eec013e81fb0
fixed count warehouse level
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Mon, 03 Nov 2008 13:10:50 +0800 |
parents | b33c8dbe9b04 |
children | 2c2dcbcc5c4d |
comparison
equal
deleted
inserted
replaced
200:e9f111057392 | 201:eec013e81fb0 |
---|---|
48 sub is_warehouse_enougn_for_governorsresidence { | 48 sub is_warehouse_enougn_for_governorsresidence { |
49 my ($self, $city) = @_; | 49 my ($self, $city) = @_; |
50 my @warehouse = (qw/undef undef 0 4 9 16 18 19 20 21 22 23 24 25/); | 50 my @warehouse = (qw/undef undef 0 4 9 16 18 19 20 21 22 23 24 25/); |
51 my @cities = keys(%{$self->{ikariam}->{cities}}); | 51 my @cities = keys(%{$self->{ikariam}->{cities}}); |
52 | 52 |
53 Carp::carp(sprintf("Required warehouse level %s, current is %s only\n", $warehouse[$#cities], $city->{buildings}->{warehouse})); | 53 Carp::carp(sprintf("Required warehouse level %s, current is %s\n", $warehouse[$#cities], $city->{buildings}->{warehouse})); |
54 return 0 if(!defined($city->{buildings}->{warehouse})); | 54 return 0 if(!defined($city->{buildings}->{warehouse})); |
55 return ($city->{buildings}->{warehouse} > $warehouse[$#cities]) ? 0 : 1; | 55 return ($city->{buildings}->{warehouse} >= $warehouse[$#cities]) ? 1 : 0; |
56 } | 56 } |
57 | 57 |
58 sub is_corruption { | 58 sub is_corruption { |
59 my ($self, $city) = @_; | 59 my ($self, $city) = @_; |
60 return ($city->{corruption} > 0) ? 1 : 0; | 60 return ($city->{corruption} > 0) ? 1 : 0; |