+ sub showcost {
+ my ($row, $unit) = @_;
+ my $minmult = 100 / $unit->{energy}; # cost multiplier
+ my $maxmult = $unit->{upgraded}->{energy} &&
+ 100 / $unit->{upgraded}->{energy};
+
+ return join(' ',
+ sprintf('cost %s%%',
+ showrange($row->{cost} * $minmult, $row->{cost} * $maxmult),
+ ),
+ !defined $row->{maint} ? () : sprintf('+%.1f%s%%/s',
+ $row->{maint} * $minmult,
+ !!$maxmult && sprintf('-%.1f', $row->{maint} * $maxmult),
+ ),
+ );
+ }
+