comparison 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
comparison
equal deleted inserted replaced
28:99723b8f348b 29:dbec53e754e3
39 Warn($id, sprintf("Running out %s (%d)!", $good, $cities->{$id}->{$good})); 39 Warn($id, sprintf("Running out %s (%d)!", $good, $cities->{$id}->{$good}));
40 } 40 }
41 } 41 }
42 } 42 }
43 43
44 sub rule_building
45 {
46 my $cityId = shift;
47
48 # 城鎮跟圍牆
49 if($cities->{$cityId}->{buildings}->{wall} < $cities->{$cityId}->{buildings}->{townHall}) {
50 Warn($cityId, sprintf("Wall level (%d) is lower then twon hall (%d)!",
51 $cities->{$cityId}->{buildings}->{wall},
52 $cities->{$cityId}->{buildings}->{townHall}
53 ));
54 }
55
56 }
57
44 # 貪腐 58 # 貪腐
45 sub rule_corruption 59 sub rule_corruption
46 { 60 {
47 my $id = shift; 61 my $id = shift;
48 62
51 } 65 }
52 } 66 }
53 67
54 # space 68 # space
55 # Checking rules 69 # Checking rules
56 foreach my $procedure (qw/rule_happiness rule_corruption rule_resource/) { 70 foreach my $procedure (qw/rule_happiness rule_corruption rule_building rule_resource/) {
57 foreach my $id (keys(%$cities)) { 71 foreach my $id (keys(%$cities)) {
58 eval(sprintf("%s(%s);", $procedure, $id)); 72 eval(sprintf("%s(%s);", $procedure, $id));
59 } 73 }
60 } 74 }