From b5a16c892f8893518849a76366da0176bc587b5d Mon Sep 17 00:00:00 2001 From: Matthew Musgrove Date: Wed, 6 Apr 2011 01:01:05 -0500 Subject: [PATCH] Fix: Only one excavator is allowed in a send_fleet call. --- lib/Lacuna/RPC/Building/SpacePort.pm | 7 +++++++ var/www/public/changes.txt | 1 + 2 files changed, 8 insertions(+) diff --git a/lib/Lacuna/RPC/Building/SpacePort.pm b/lib/Lacuna/RPC/Building/SpacePort.pm index f16fe179..efb5fe5f 100644 --- a/lib/Lacuna/RPC/Building/SpacePort.pm +++ b/lib/Lacuna/RPC/Building/SpacePort.pm @@ -160,6 +160,7 @@ sub send_fleet { } my @fleet; my $speed = 999999999; + my $excavator = 0; for my $ship_id (@$ship_ids) { my $ship = Lacuna->db->resultset('Lacuna::DB::Result::Ships')->find($ship_id); unless (defined $ship) { @@ -168,12 +169,18 @@ sub send_fleet { unless ($ship->body->empire_id == $empire->id) { confess [1010, 'You do not own that ship.']; } + if ($ship->type eq 'excavator') { + $excavator++; + } my $body = $ship->body; $body->empire($empire); $ship->can_send_to_target($target); push @fleet, $ship; $speed = $ship->speed if ( $speed > $ship->speed ); } + unless ($excavator <= 1) { + confess [1010, 'Only one Excavator may be sent to a body in a 30 day period']; + } my @ret; for my $ship (@fleet) { $ship->speed($speed); diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 1c95a76c..04d33d01 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -11,6 +11,7 @@ - Fix: view_ships_orbiting will now return the ships that are orbiting your planet instead of just the count. - Fix: Fighters will return home after defending (instead of doubling the travel time). - Fix: Fix defender's home field advantage. + - Fix: Only one excavator is allowed in a send_fleet call. 3.0402 - API: Changed parliament propositions and laws to use email formatting rules. -- 2.51.2