From f3f007b3e33cb1db535a0b787a7a9be4a842fb7e Mon Sep 17 00:00:00 2001 From: Mark Lemming Date: Tue, 3 Sep 2013 16:54:52 -0600 Subject: [PATCH] bug fixes --- lib/Lacuna/DB/Result/Mission.pm | 15 +++++++++++---- var/www/public/changes.txt | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/Lacuna/DB/Result/Mission.pm b/lib/Lacuna/DB/Result/Mission.pm index 1f5a5c10..31a96189 100644 --- a/lib/Lacuna/DB/Result/Mission.pm +++ b/lib/Lacuna/DB/Result/Mission.pm @@ -296,7 +296,7 @@ sub check_objectives { if (exists $objectives->{ships}) { my $ship_ref = get_ship_list($body, $objectives->{ships}); unless ($ship_ref->{pass}) { - confess [1002, sprintf('%s', $ship_ref->{message})]; + confess [1002, sprintf('%s', join("\n", @{$ship_ref->{message}}))]; } } @@ -354,7 +354,6 @@ sub get_ship_list { my ($body, $ship_obj_arr) = @_; my $ships = Lacuna->db->resultset('Lacuna::DB::Result::Ships'); -# confess [1013, 'You do not have the '.$ship->type_formatted.' needed to complete this mission.']; my @error_msgs; my $pass = 1; @@ -389,14 +388,15 @@ sub get_ship_list { task => 'Docked', }, { rows => $total_needed, - order_by => 'name', + order_by => [ 'name', 'id' ], }); if (scalar @ship_q < $ship_obj_hash{$skey}->{quantity}) { $pass = 0; + my $ship = $ships->new({type=> $ship_obj_hash{$skey}->{type} }); push @error_msgs, sprintf("Need %d of %s (speed >= %s, stealth >= %s, hold size >= %s, combat >= %s, berth >= %s)", $ship_obj_hash{$skey}->{quantity}, - $ship_obj_hash{$skey}->{type}, + $ship->type_formatted, $ship_obj_hash{$skey}->{speed} || 0, $ship_obj_hash{$skey}->{stealth} || 0, $ship_obj_hash{$skey}->{hold_size} || 0, @@ -422,6 +422,13 @@ sub get_ship_list { } delete $ship_obj_hash{$skey}; push @id_list, @temp_id; + for my $lkey (keys %ship_obj_hash) { + my @new_ship_q; + for my $elem (@{$ship_obj_hash{$lkey}->{ship_ref}}) { + push @new_ship_q, $elem unless (grep { $elem->id == $_} @temp_id); + } + $ship_obj_hash{$lkey}->{ship_ref} = \@new_ship_q; + } last unless (%ship_obj_hash); } if ($total_needed > scalar @id_list) { diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 1f787ca9..64ecd3f7 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -6,7 +6,8 @@ - Add: Spies report on Supply Chains via Resource intelligence. - Mod: Mission files now use a quantity field instead of listed multiples. - Fix: Berth Levels added to missions. - - Mod: Missions take ship in name, combat, hold_size, speed, stealth, id order + - Mod: Missions take qualifying ship in name, then id order. + - Mod: Fissure explosions not a threat after 200 units. 3.0893: - Fix: Closed starter zone loophole. -- 2.51.2