changeset 139:3bbb1e559e21

we are happy when the city level is more then 20
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Fri, 31 Oct 2008 10:11:00 +0800
parents 454657d0308f
children 124fc7abda39
files agent.pl
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/agent.pl	Fri Oct 31 02:21:49 2008 +0800
+++ b/agent.pl	Fri Oct 31 10:11:00 2008 +0800
@@ -51,17 +51,16 @@
 
 sub is_happiness {
     my ($self, $city) = @_;
-    # TODO 以 fuzzy 取出合理 happiness 值
+    # FIXME.
+    # we should update the tavern setting.
 
     # we should update the travl
-    # return ($city->{growth} >= 5 ?  1 : 0) 
-    #    if($city->{buildings}->{townHall} <= 10);
+    return ($city->{growth} >= 5 ?  1 : 0) 
+        if($city->{buildings}->{townHall} <= 10);
 
-    return 0;
+    return 1 if($city->{buildings}->{townHall} >= 20);
  
-    # FIXME.
-    # we should update the tavern setting.
-    # return ($city->{happiness} >= 2 ?  1 : 0);
+    return ($city->{happiness} >= 2 ?  1 : 0);
 }
 
 sub is_warehouse_enough {