sc: indicate specials cost and availability
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 12 Jun 2015 22:00:52 +0000 (00:00 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 12 Jun 2015 22:01:33 +0000 (00:01 +0200)
sc.plp

diff --git a/sc.plp b/sc.plp
index 0503a07a21ec6237a4f6fa61541c67c40f2c3267..b14e04f49a303dfb518bb7b8bf5f6492681e37f4 100644 (file)
--- a/sc.plp
+++ b/sc.plp
@@ -250,13 +250,15 @@ sub showrange {
                                join('',
                                        $_->{name},
                                        $_->{desc} ? ": $_->{desc}" : '',
-                                       $_->{range} ? sprintf(' (%s)', join ', ',
-                                               "range $_->{range}",
-#                                              sprintf('cost %.0f%%', 100 * $_->{cost} / $row->{energy}),
+                                       $_->{range} || $_->{cost} ? sprintf(' (%s)', join ', ',
+                                               $_->{range} ? "range $_->{range}" : (),
+                                               $_->{cost} ? sprintf('cost %.0f%%',
+                                                       100 * $_->{cost} / $row->{energy}
+                                               ) : (),
                                        ) : '',
                                ),
-                               $_->{abbr},
-               } @$specials;
+                               sprintf($_->{build} ? '(%s)' : '%s', $_->{abbr}),
+               } grep { defined $_->{abbr} } @{$specials};
        }
 
        sub showunitcols {