sc: read version number from data include
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 13 Jun 2015 02:46:23 +0000 (04:46 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 13 Jun 2015 02:46:23 +0000 (04:46 +0200)
Variable with other data unlike other metadata.

sc-units-bw.inc.pl
sc-units-hots.inc.pl
sc.plp

index 47658d109a65b65763d8ae84bea1f4daaa96453b..2d46ae50c3de80d616710dd15486f7c0e9640d1e 100644 (file)
@@ -1,8 +1,13 @@
+use utf8;
+use strict;
+
 # time in fastest game seconds
 my $FPS = 24;  # frames per second
 # toss shield += .65 per second
 # zerg regen  += .37 per second
+
 [
+'<span title="no known changes as of v1.16.1">versionā‰„1.08</span>',
 
 # protoss
 
index c1d84ce476e6035096f5bf8cc066fd23a1b09b72..3ba370aed7a065547d87584f6839143c4d18cf42 100644 (file)
@@ -1,4 +1,7 @@
+use utf8;
+
 [
+'patch 2.1.3 BU',
 # http://wiki.teamliquid.net/starcraft2/Unit_Statistics
 # http://wiki.teamliquid.net/starcraft2/User:Roemy/Unit_Statistics_(detailed)
 # http://starcraft.wikia.com/wiki/List_of_StarCraft_II_units
diff --git a/sc.plp b/sc.plp
index 3252cf3e3cb1f3965765417ad728e03df3dd0524..13248fbb256afea92f25b287db48f48b14e01bd5 100644 (file)
--- a/sc.plp
+++ b/sc.plp
@@ -3,7 +3,6 @@
 my %scver = (
        id => 'bw',
        name => 'Brood War',
-       patch => '<span title="no known changes as of v1.16.1">versionā‰„1.08</span>',
        title => 'starcraft',
        game => 'StarCraft',
        major => 1,
@@ -13,7 +12,6 @@ if ($ENV{PATH_INFO} and $ENV{PATH_INFO} eq '/2') {
        %scver = (
                id => 'hots',
                name => 'Heart of the Swarm',
-               patch => 'patch 2.1.3 BU',
                title => 'starcraft2',
                game => 'StarCraft II',
                major => 2,
@@ -42,7 +40,13 @@ Html({
 });
 
 print "<h1>$scver{game} units</h1>\n\n";
-print "<p>Unit properties as seen or measured in $scver{name}\n$scver{patch}.\n</p>\n\n";
+
+my $units = do $datafile;
+die "Cannot open unit data: $_\n" for $@ || $! || ();
+my $patch = shift @{$units}
+       or die "Cannot open unit data: metadata not found\n";
+
+print "<p>Unit properties as seen or measured in $scver{name}\n$patch.\n</p>\n\n";
 
 sub coltoggle {
        my ($name, $id) = @_;
@@ -213,8 +217,6 @@ sub showval {
                );
        }
 
-       my $units = do $datafile;
-       die "Cannot open unit data: $_\n" for $@ || $! || ();
        my $grouped = 1;  # race headers
        if (exists $get{order}) {
                $grouped = 0;