# HG changeset patch # User "Rex Tsai " # Date 1223587444 -28800 # Node ID de5de6d472f9a203edc09775e17306486961765a # Parent dbec53e754e33e4a299c1e7ee3979a25b551efb2 added space checking diff -r dbec53e754e3 -r de5de6d472f9 Ikariam.pm --- a/Ikariam.pm Fri Oct 10 05:15:40 2008 +0800 +++ b/Ikariam.pm Fri Oct 10 05:24:04 2008 +0800 @@ -265,6 +265,10 @@ my ($elem) = $html->getElementsByAttribute("class", "city"); $self->{'cities'}->{$cityId}->{name} = $elem->innerText(); + my ($elem) = $html->getElementsByAttribute("class", 'constructionSite'); + $self->{'cities'}->{$cityId}->{construction} = 0; + $self->{'cities'}->{$cityId}->{construction} = 1 if(defined($elem)); + # check goods foreach my $good (qw/wood wine marble crystal sulfur/) { my ($elem) = $html->getElementsByAttribute("id", "value_" . $good); diff -r dbec53e754e3 -r de5de6d472f9 inference.pl --- a/inference.pl Fri Oct 10 05:15:40 2008 +0800 +++ b/inference.pl Fri Oct 10 05:24:04 2008 +0800 @@ -47,12 +47,25 @@ # 城鎮跟圍牆 if($cities->{$cityId}->{buildings}->{wall} < $cities->{$cityId}->{buildings}->{townHall}) { - Warn($cityId, sprintf("Wall level (%d) is lower then twon hall (%d)!", + Warn($cityId, sprintf("Wall level (%d) is lower then town hall (%d)!", $cities->{$cityId}->{buildings}->{wall}, $cities->{$cityId}->{buildings}->{townHall} )); } +} +sub rule_space +{ + my $cityId = shift; + + if($cities->{$cityId}->{space}->{total} == $cities->{$cityId}->{space}->{occupied}) + { + Warn($cityId, sprintf("your space is full, upgraded the hall")) if($cities->{$cityId}->{construction} != 1) + } +} + +sub rule_engagement +{ } # 貪腐 @@ -67,7 +80,7 @@ # space # Checking rules -foreach my $procedure (qw/rule_happiness rule_corruption rule_building rule_resource/) { +foreach my $procedure (qw/rule_happiness rule_corruption rule_building rule_space rule_resource/) { foreach my $id (keys(%$cities)) { eval(sprintf("%s(%s);", $procedure, $id)); }