Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for plans and glyphs being called incorrectly in functions. #29

Merged
merged 1 commit into from Jul 19, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Lacuna/DB/Result/Building/Archaeology.pm
Expand Up @@ -662,7 +662,7 @@ sub make_plan {
# types
my %count;
if ( grep /\D/, @{$glyphs} ) {
$plan_class = Lacuna::DB::Result::Plans->check_glyph_recipe($glyphs);
$plan_class = Lacuna::DB::Result::Plan->check_glyph_recipe($glyphs);
if (not $plan_class) {
confess [1002, 'The glyphs specified do not fit together in that manner.'];
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Lacuna/DB/Result/Building/Permanent/TheDillonForge.pm
Expand Up @@ -64,7 +64,7 @@ sub split_plan {
if (not $plan) {
confess [1002, 'You cannot split a plan you do not have.'];
}
my $glyphs = Lacuna::DB::Result::Plans->get_glyph_recipe($class);
my $glyphs = Lacuna::DB::Result::Plan->get_glyph_recipe($class);
if (not $glyphs) {
confess [1002, 'You can only split plans that have a glyph recipe.'];
}
Expand Down Expand Up @@ -147,7 +147,7 @@ before finish_work => sub {
my $hall_type = $hall_types[randint(0,4)];
$plan_class .= " $hall_type";
}
my $glyphs = Lacuna::DB::Result::Plans->get_glyph_recipe($plan_class);
my $glyphs = Lacuna::DB::Result::Plan->get_glyph_recipe($plan_class);
my @many_glyphs = shuffle map { @$glyphs } (1..$halls);
my $glyphs_built;
my $total_glyphs = 0;
Expand Down
7 changes: 3 additions & 4 deletions lib/Lacuna/DB/Result/Spies.pm
Expand Up @@ -1903,7 +1903,7 @@ sub destroy_plan {

sub destroy_glyph {
my ($self, $defender) = @_;
my $glyph = $self->on_body->glyphs->search(undef, {rows => 1, order_by => 'rand()'})->single;
my $glyph = $self->on_body->glyph->search(undef, {rows => 1, order_by => 'rand()'})->single;
return $self->mission_objective_not_found('glyph')->id unless defined $glyph;
$self->things_destroyed( $self->things_destroyed + 1 );
my $stolen = $glyph->type.' glyph';
Expand Down Expand Up @@ -2116,7 +2116,7 @@ sub steal_glyph {
{ rows => 1, order_by => 'rand()' }
)->single;
return $self->ship_not_found->id unless defined $ship;
my $glyph = $on_body->glyphs->search(undef, {rows => 1, order_by => 'rand()'})->single;
my $glyph = $on_body->glyph->search(undef, {rows => 1, order_by => 'rand()'})->single;
return $self->mission_objective_not_found('glyph')->id unless defined $glyph;
$ship->body($self->from_body);
weaken($ship->{_relationship_data}{body});
Expand All @@ -2127,8 +2127,7 @@ sub steal_glyph {
spies => [ $self->id ],
glyphs => [ {
name => $glyph->type,
quantity => $glyph->quantity,
glyph_id => $glyph->id,
quantity => 1,
} ],
},
);
Expand Down