From 7d75a2f2e4aac21a6be3222ecba80c04b249086b Mon Sep 17 00:00:00 2001 From: Mark Lemming Date: Tue, 26 May 2015 18:55:24 -0600 Subject: [PATCH] Stick! --- bin/check_starter_zones.pl | 3 +++ lib/Lacuna/DB/Result/Building.pm | 2 ++ var/messages/zoning_board_warning.txt | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/check_starter_zones.pl b/bin/check_starter_zones.pl index 6a86560e..4433e942 100644 --- a/bin/check_starter_zones.pl +++ b/bin/check_starter_zones.pl @@ -41,6 +41,7 @@ sub check_sz { my $empires = $db->resultset('Empire')->search({ id => { '>' => 1 }}); + my $cache = Lacuna->cache; EMP: while (my $empire = $empires->next) { my $bodies = $empire->planets; @@ -55,6 +56,8 @@ EMP: while (my $empire = $empires->next) ); out(sprintf("%s:%d has more than %d colonies in the starter zones.", $empire->name, $empire->id, $sz_param->{max_colonies})); + + $cache->set('sz_exceeded', $empire->id, 1, 60*60*24); next EMP; } } diff --git a/lib/Lacuna/DB/Result/Building.pm b/lib/Lacuna/DB/Result/Building.pm index 8848e6bc..41734d4b 100755 --- a/lib/Lacuna/DB/Result/Building.pm +++ b/lib/Lacuna/DB/Result/Building.pm @@ -508,6 +508,8 @@ sub happiness_production_bonus { sub happiness_production_hour { my ($self) = @_; my $base = $self->happiness_production * $self->production_hour; + return 0 unless $self->body->empire; + return 0 if Lacuna->cache->get('sz_exceeded', $self->body->empire->id); return 0 if $base == 0; return sprintf('%.0f', $base * $self->happiness_production_bonus); } diff --git a/var/messages/zoning_board_warning.txt b/var/messages/zoning_board_warning.txt index d98d96ef..55d233ad 100644 --- a/var/messages/zoning_board_warning.txt +++ b/var/messages/zoning_board_warning.txt @@ -2,7 +2,7 @@ Overcrowding ~~~ It has come to our attention that you have more than the allowed number of colonies in the starting area. This can not be allowed to continue, since we want to be sure new empires have an area to start off in. -Please address this as soon as possible so that you only have %s number of colonies in the starting areas. +Please address this as soon as possible so that you only have %s number of colonies in the starting areas. Your population will get happier once you do so. Regards, -- 2.51.2