diff agent.pl @ 206:b7af307a222d

added build safehouse
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Mon, 03 Nov 2008 17:52:28 +0800
parents 60f4ce7e1f63
children 48ea8222782a
line wrap: on
line diff
--- a/agent.pl	Mon Nov 03 17:20:51 2008 +0800
+++ b/agent.pl	Mon Nov 03 17:52:28 2008 +0800
@@ -45,6 +45,12 @@
     return ($city->{space}->{total} <= ($city->{space}->{occupied} + ($city->{growth}*8)) ?  0 : 1)
 }
 
+sub is_safehouse_enough {
+    my ($self, $city) = @_;
+    return 0 if(!defined($city->{building}->{safehouse}));
+    return (($city->{building}->{townHall} <= ($city->{building}->{safehouse} + 4)) ? 0 : 1);
+}
+
 sub is_warehouse_enough {
     my ($self, $city) = @_;
     my @warehouse = (qw/undef undef 0 4 9 16 18 19 20 21 22 23 24 25/);