diff inference.pl @ 29:dbec53e754e3

added rule_building
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Fri, 10 Oct 2008 05:15:40 +0800
parents 99723b8f348b
children de5de6d472f9
line wrap: on
line diff
--- a/inference.pl	Fri Oct 10 04:42:05 2008 +0800
+++ b/inference.pl	Fri Oct 10 05:15:40 2008 +0800
@@ -41,6 +41,20 @@
     }
 }
 
+sub rule_building
+{
+    my $cityId = shift;
+
+    # 城鎮跟圍牆
+    if($cities->{$cityId}->{buildings}->{wall} < $cities->{$cityId}->{buildings}->{townHall}) {
+        Warn($cityId, sprintf("Wall level (%d) is lower then twon hall (%d)!",
+                $cities->{$cityId}->{buildings}->{wall},
+                $cities->{$cityId}->{buildings}->{townHall}
+            ));
+    }
+
+}
+
 # 貪腐
 sub rule_corruption
 {
@@ -53,7 +67,7 @@
 
 # space
 # Checking rules
-foreach my $procedure (qw/rule_happiness rule_corruption rule_resource/) {
+foreach my $procedure (qw/rule_happiness rule_corruption rule_building rule_resource/) {
     foreach my $id (keys(%$cities)) {
         eval(sprintf("%s(%s);", $procedure, $id));
     }