changeset 39:65e847de5187

refined the defending rules
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Thu, 16 Oct 2008 21:43:20 +0800
parents 0863b32e1a05
children 1168ad6e26f7
files inference.pl
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/inference.pl	Thu Oct 16 21:42:16 2008 +0800
+++ b/inference.pl	Thu Oct 16 21:43:20 2008 +0800
@@ -45,12 +45,15 @@
     my $cityId = shift;
 
     # 城鎮跟圍牆
-    if($cities->{$cityId}->{buildings}->{wall} < $cities->{$cityId}->{buildings}->{townHall}) {
-        Warn($cityId, sprintf("Wall level (%d) is lower then town hall (%d)!",
-                $cities->{$cityId}->{buildings}->{wall},
-                $cities->{$cityId}->{buildings}->{townHall}
-            )) 
-        if($cities->{$cityId}->{construction} != 1);
+    if($cities->{$cityId}->{construction} != 1) {
+        if($cities->{$cityId}->{buildings}->{wall} < $cities->{$cityId}->{buildings}->{townHall}) {
+            Warn($cityId, sprintf("Wall level (%d) is lower then town hall (%d)!",
+                    $cities->{$cityId}->{buildings}->{wall},
+                    $cities->{$cityId}->{buildings}->{townHall}
+                )) 
+        } else {
+            Warn($cityId, sprintf("is not building."));
+        }
     }
 }
 
@@ -117,7 +120,7 @@
     }
 }
 
-foreach my $procedure (qw/rule_war rule_engagement/) {
+foreach my $procedure (qw/rule_engagement/) {
     foreach my $id (keys(%$cities)) {
         eval(sprintf("%s(%s);", $procedure, $id));
         last;