Mercurial > eagle-eye
diff inference.pl @ 30:de5de6d472f9
added space checking
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Fri, 10 Oct 2008 05:24:04 +0800 |
parents | dbec53e754e3 |
children | 91e387b51aa0 |
line wrap: on
line diff
--- 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)); }