+ sprintf($_->{build} ? '(%s)' : '%s', $_->{abbr}),
+ } grep { defined $_->{abbr} } @{$specials};
+ }
+
+ sub showunitcols {
+ my ($row) = @_;
+ local $_ = $row;
+ $_->{hp} += $_->{shield} if $_->{shield};
+ my $suitchar = '';
+ if ($_->{attr}->{structure}) {
+ $suitchar = 'b';
+ }
+ elsif ($_->{suit}) {
+ $suitchar = [qw/? s m l/]->[$_->{suit}];
+ }
+ elsif ($_->{cargo} > 0) {
+ $suitchar = [qw/? s m l l h h h h/]->[abs $_->{cargo}];
+ }
+ elsif ($_->{size}) {
+ $suitchar = [qw/s m l h h h/]->[$_->{size}];
+ }
+ elsif ($_->{attr} and $_->{attr}->{light}) {
+ $suitchar = 's';
+ }
+ elsif ($_->{attr} and $_->{attr}->{armored}) {
+ $suitchar = 'l';
+ }
+
+ return (
+ '<td class="val min">' . ($_->{min} // ''),
+ '<td class="val gas">' . ($_->{gas} || ''),
+ !defined $_->{build} ? '<td>' : sprintf('<td class="val time">%s%.0f',
+ !!$_->{base} && '<span class="unit-composed">+</span>',
+ $_->{build} || '0',
+ ),
+ !$suitchar ? '<td>' : sprintf('<td class="unit unit-%s">%s%s',
+ $suitchar, ucfirst $suitchar,
+ $_->{attr}->{massive}
+ && '<span class="unit-massive" title="massive">⚓</span>',
+ ),
+ '<td class="val unit">' . (
+ defined $_->{pop} && $_->{pop} == .5 ? '½' : $_->{pop}
+ ),
+ '<td class="unit unit-type">' . join('', grep { $_ }
+ (defined $_->{organic} ? !$_->{organic} : $_->{attr}->{mech})
+ && '<span class="unit-u" title="mechanic">m</span>',
+ ($_->{organic} || $_->{attr}->{organic})
+ && '<span class="unit-o" title="organic">o</span>',
+ $_->{attr}->{psionic}
+ && '<span class="unit-p" title="psionic">ψ</span>',
+ ),
+ '<td class="unit unit-attr">' . join('', grep { $_ }
+ $_->{attr}->{armored}
+ && '<span class="unit unit-l" title="armored">A</span>',
+ $_->{attr}->{light}
+ && '<span class="unit unit-s" title="light">L</span>',
+ ),
+ '<td class="val unit-hp">' . $_->{hp} // '',
+ $_->{shield} ? sprintf('<td class="val unit-shield">%.0f%%<td',
+ 100 * $_->{shield} / $_->{hp}
+ ) : '<td colspan=2',
+ ' class="val unit-armor">' .
+ showrange($_->{armor}, $_->{upgraded}->{armor}),
+ showattack($_, 0),
+ '<td class="val unit-sight">' . sprintf(
+ $_->{detect} ? '<strong class="unit-detect">%s</strong>' : '%s',
+ showrange($_->{sight}, $_->{upgraded}->{sight})
+ ),
+ '<td class="val unit-speed">' .
+ showrange($_->{speed}, $_->{upgraded}->{speed}),
+ $_->{attr}->{jump}
+ && qq'<span class="unit unit-jump" title="$_->{attr}->{jump}">↕</span>',
+ $_->{attr}->{flying}
+ && qq'<span class="unit unit-jump" title="flying">↑</span>',
+ '<td class="unit-magic">' . showmagic($_),
+ !$_->{attack}->[1] ? () : (
+ '<tr><td colspan=12>', showattack($_, 1), '<td colspan=3>'
+ ),
+ !$_->{attack}->[2] ? () : (
+ '<tr><td colspan=12>', showattack($_, 2), '<td colspan=3>'
+ ),
+ "\n"
+ );