Mercurial > eagle-eye
comparison 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 |
comparison
equal
deleted
inserted
replaced
29:dbec53e754e3 | 30:de5de6d472f9 |
---|---|
45 { | 45 { |
46 my $cityId = shift; | 46 my $cityId = shift; |
47 | 47 |
48 # 城鎮跟圍牆 | 48 # 城鎮跟圍牆 |
49 if($cities->{$cityId}->{buildings}->{wall} < $cities->{$cityId}->{buildings}->{townHall}) { | 49 if($cities->{$cityId}->{buildings}->{wall} < $cities->{$cityId}->{buildings}->{townHall}) { |
50 Warn($cityId, sprintf("Wall level (%d) is lower then twon hall (%d)!", | 50 Warn($cityId, sprintf("Wall level (%d) is lower then town hall (%d)!", |
51 $cities->{$cityId}->{buildings}->{wall}, | 51 $cities->{$cityId}->{buildings}->{wall}, |
52 $cities->{$cityId}->{buildings}->{townHall} | 52 $cities->{$cityId}->{buildings}->{townHall} |
53 )); | 53 )); |
54 } | 54 } |
55 } | |
55 | 56 |
57 sub rule_space | |
58 { | |
59 my $cityId = shift; | |
60 | |
61 if($cities->{$cityId}->{space}->{total} == $cities->{$cityId}->{space}->{occupied}) | |
62 { | |
63 Warn($cityId, sprintf("your space is full, upgraded the hall")) if($cities->{$cityId}->{construction} != 1) | |
64 } | |
65 } | |
66 | |
67 sub rule_engagement | |
68 { | |
56 } | 69 } |
57 | 70 |
58 # 貪腐 | 71 # 貪腐 |
59 sub rule_corruption | 72 sub rule_corruption |
60 { | 73 { |
65 } | 78 } |
66 } | 79 } |
67 | 80 |
68 # space | 81 # space |
69 # Checking rules | 82 # Checking rules |
70 foreach my $procedure (qw/rule_happiness rule_corruption rule_building rule_resource/) { | 83 foreach my $procedure (qw/rule_happiness rule_corruption rule_building rule_space rule_resource/) { |
71 foreach my $id (keys(%$cities)) { | 84 foreach my $id (keys(%$cities)) { |
72 eval(sprintf("%s(%s);", $procedure, $id)); | 85 eval(sprintf("%s(%s);", $procedure, $id)); |
73 } | 86 } |
74 } | 87 } |