From d17b8d2b1475fe4a778e4a370f6d5b869cfd51e2 Mon Sep 17 00:00:00 2001 From: Mark Lemming Date: Sat, 27 Jul 2013 21:58:42 -0600 Subject: [PATCH] Fixed to check in transit starter zone ships. --- lib/Lacuna.pm | 2 +- lib/Lacuna/Role/Ship/Send/StarterZone.pm | 12 +++++++++++- var/www/public/changes.txt | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/Lacuna.pm b/lib/Lacuna.pm index 167270f8..b8b39e32 100644 --- a/lib/Lacuna.pm +++ b/lib/Lacuna.pm @@ -7,7 +7,7 @@ use Config::JSON; useall __PACKAGE__; -our $VERSION = 3.0892; +our $VERSION = 3.0893; my $config = Config::JSON->new('/data/Lacuna-Server/etc/lacuna.conf'); my $db = Lacuna::DB->connect($config->get('db/dsn'),$config->get('db/username'),$config->get('db/password'), { mysql_enable_utf8 => 1}); diff --git a/lib/Lacuna/Role/Ship/Send/StarterZone.pm b/lib/Lacuna/Role/Ship/Send/StarterZone.pm index 294c3525..a6310996 100644 --- a/lib/Lacuna/Role/Ship/Send/StarterZone.pm +++ b/lib/Lacuna/Role/Ship/Send/StarterZone.pm @@ -18,7 +18,17 @@ after can_send_to_target => sub { while (my $planet = $planets->next) { $sz_colonies++ if $planet->in_starter_zone; } - confess [1009, 'You already have the maximum allowed colonies in starter zones.'] if ($sz_colonies >= $sz_param->{max_colonies}); + my $in_transit = Lacuna->db->resultset('Ships')->search( + { type=> { in => [qw(colony_ship short_range_colony_ship space_station)]}, + task=>'travelling', direction=>'out', 'body.empire_id' => $self->body->empire->id}, + { join => 'body' } + ); + while (my $ship = $in_transit->next) { + $sz_colonies++ if $ship->foreign_body->in_starter_zone; + } + confess [1009, + sprintf("You either have the maximum allowed colonies (%s) in starter zones or will, when in transit colony ships arrive.", $sz_param->{max_colonies})] + if ($sz_colonies >= $sz_param->{max_colonies}); } } return 1; diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 91c0aa4f..a9750cf6 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -1,3 +1,6 @@ +3.0893: + - Fix: Closed starter zone loophole. + 3.0892: - Fix: Fix schedule to remove past jobs when rescheduling. -- 2.51.2