From ff70533ca94e94c71ab9692b4c6bf46312b192ab Mon Sep 17 00:00:00 2001 From: JT Smith Date: Wed, 20 Oct 2010 19:54:19 -0500 Subject: [PATCH] fixed my fix --- lib/Lacuna/DB/Result/Map/Body/Planet.pm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/Lacuna/DB/Result/Map/Body/Planet.pm b/lib/Lacuna/DB/Result/Map/Body/Planet.pm index 06e9705d..55d54892 100644 --- a/lib/Lacuna/DB/Result/Map/Body/Planet.pm +++ b/lib/Lacuna/DB/Result/Map/Body/Planet.pm @@ -621,18 +621,18 @@ sub recalc_stats { foreach my $type (ORE_TYPES) { my $method = $type.'_hour'; my $planet_side = sprintf('%.0f',$self->$type * $stats{ore_hour} / 10000); # calculate local spend/prod -# if (abs($planet_side) > $stats{$method}) { # local spend might be more than local production -# $overage += abs($planet_side) - $stats{$method}; # make up the difference with an overage -# $stats{$method} = 0; -# } -# else { + if ($planet_side < 0 && abs($planet_side) > $stats{$method}) { # local spend might be more than local production + $overage += abs($planet_side) - $stats{$method}; # make up the difference with an overage + $stats{$method} = 0; + } + else { $stats{$method} += $planet_side; -# } + } } $stats{ore_hour} += $mining_ministry_ore_hour - $overage; # adjust the total ore hour to reflect mining ministry and overage -# if ($stats{ore_hour} < 0) { # if there's not enough total ore production to go around -# $stats{gold_hour} = $stats{ore_hour}; # arbitrarily assign it to one type -# } + if ($stats{ore_hour} < 0) { # if there's not enough total ore production to go around + $stats{gold_hour} = $stats{ore_hour}; # arbitrarily assign it to one type + } $self->update(\%stats); return $self; } -- 2.51.2