Permalink
Browse files

When leaving a Halls standing, prefer the one being used

  • Loading branch information...
1 parent 5fc57a5 commit 56f72bf30596490183d1f1cc1410433f4d3e1bc5 @ysth ysth committed with lemming552 Mar 10, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/Lacuna/RPC/Building/HallsOfVrbansk.pm
@@ -95,7 +95,11 @@ sub sacrifice_to_upgrade {
if ($total < $needed) {
confess [1009, 'The Halls of Vrbansk do not have the knowledge necessary to upgrade the '.$upgrade->name];
}
- shift @halls if ($total > $needed); # Leave one hall standing if not needed for upgrade.
+ # Leave one hall standing if not needed for upgrade.
+ if ($total > $needed) {
+ @halls = sort { ($a->id != $building_id) <=> ($b->id != $building_id) } @halls;
+ shift(@halls);
+ }
while ($needed) {
my $hall = shift(@halls);
if ($hall) {

0 comments on commit 56f72bf

Please sign in to comment.