From 5cdb14ed58c2b3cd1eed54744b3f18e788308162 Mon Sep 17 00:00:00 2001 From: Matthew Musgrove Date: Fri, 22 Apr 2011 01:28:30 -0500 Subject: [PATCH] Fix: Parliament's propose_fire_bfg and propose_rename_star no longer thrown an Internal Error. --- lib/Lacuna/DB/Result/Propositions/RenameStar.pm | 2 +- lib/Lacuna/RPC/Building/Parliament.pm | 4 ++-- t/Parliament.t | 2 +- var/www/public/changes.txt | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Lacuna/DB/Result/Propositions/RenameStar.pm b/lib/Lacuna/DB/Result/Propositions/RenameStar.pm index d5e15bc4..b7263636 100644 --- a/lib/Lacuna/DB/Result/Propositions/RenameStar.pm +++ b/lib/Lacuna/DB/Result/Propositions/RenameStar.pm @@ -10,7 +10,7 @@ before pass => sub { my $station = $self->station; my $star = $station->stars->find($self->scratch->{star_id}); my $name = $self->scratch->{name}; - if (Lacuna->db->resultset('Lacuna::DB::Result::Map::Star')->search({name=>$name, 'star_id'=>{'!='=>$star->id}})->count) { + if (Lacuna->db->resultset('Lacuna::DB::Result::Map::Star')->search({name=>$name, 'id'=>{'!='=>$star->id}})->count) { $self->pass_extra_message('Unfortunately, by the time the proposition passed, the name *'.$name.'* had already taken, effectively nullifying the vote.'); } elsif ($star->station_id = $station->id) { diff --git a/lib/Lacuna/RPC/Building/Parliament.pm b/lib/Lacuna/RPC/Building/Parliament.pm index f193801b..9622831d 100644 --- a/lib/Lacuna/RPC/Building/Parliament.pm +++ b/lib/Lacuna/RPC/Building/Parliament.pm @@ -176,7 +176,7 @@ sub propose_fire_bfg { unless ($body->isa('Lacuna::DB::Result::Map::Body::Planet')) { confess [1009, 'Target is not a planet.']; } - $self->body->in_jurisdiction($body); + $building->body->in_jurisdiction($body); my $name = $body->name.' ('.$body->x.','.$body->y.')'; my $proposition = Lacuna->db->resultset('Lacuna::DB::Result::Propositions')->new({ type => 'FireBfg', @@ -366,7 +366,7 @@ sub propose_rename_star { ->no_restricted_chars ->no_profanity ->no_padding - ->not_ok(Lacuna->db->resultset('Lacuna::DB::Result::Map::Star')->search({name=>$star_name, 'star_id'=>{'!='=>$star->id}})->count); # name available + ->not_ok(Lacuna->db->resultset('Lacuna::DB::Result::Map::Star')->search({name=>$star_name, 'id'=>{'!='=>$star->id}})->count); # name available my $proposition = Lacuna->db->resultset('Lacuna::DB::Result::Propositions')->new({ type => 'RenameStar', name => 'Rename '.$star->name, diff --git a/t/Parliament.t b/t/Parliament.t index dfbec2cf..f6cbb4ee 100644 --- a/t/Parliament.t +++ b/t/Parliament.t @@ -207,7 +207,7 @@ is($result->{error}{data}, 25, 'firing bfg requires level 25 parliament'); $par->level(25); $par->update; -$result = $tester->post('parliament', 'propose_fire_bfg', [$session_id, $par->id, 1, 'feel like it']); +$result = $tester->post('parliament', 'propose_fire_bfg', [$session_id, $par->id, 2, 'feel like it']); is($result->{error}{code}, 1009, 'planet is not within jurisdiction of the station'); $result = $tester->post('body', 'abandon', [$session_id, $station->id]); diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 60fd2f57..9a69d875 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -5,6 +5,7 @@ - Fix: Only pilotable ships with a hold size of 700 or greater can be used to transport abducted spies. - Fix: Planets belonging to an empire that are in an alliance will once again be tagged with an alignment of 'self' instead of 'ally'. - Fix: Updated documentation for Body and Embassy. + - Fix: Parliament's propose_fire_bfg and propose_rename_star no longer thrown an Internal Error. 3.0602 - Fix: Empire size in Universe Stats increased from 2,147,483,647 to 9,223,372,036,854,775,807. -- 2.54.0