Skip to content

Commit

Permalink
retain the order of the materials
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilmari Karonen committed Nov 5, 2013
1 parent 17bd6c4 commit 79243ce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions utils/stone_colors_to_html.pl
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ ($)
}

# read raws (parsing rules based on http://dwarffortresswiki.org/index.php/DF2012:Material_definition_token)
my ($mat, %materials);
my ($mat, %materials, @materials);
while (<>) {
while (/\[([^\[\]]*)\]/g) {
my $tag = $1;
my ($name, @args) = split /:/, $tag;
$name = uc $name;
if ($name eq 'INORGANIC') {
$mat = $args[0];
push @materials, $mat;
$materials{$mat} = { # defaults
TILE_COLOR => [7,7,1],
BUILD_COLOR => [7,7,1],
Expand Down Expand Up @@ -139,7 +140,7 @@ ($)
return $text;
}

foreach my $mat (sort keys %materials) {
foreach my $mat (@materials) {
my $tile = $materials{$mat}{TILE};
$tile = "\x{2588}" unless defined $tile; # default = 219 = U+2588 (solid block)

Expand Down

0 comments on commit 79243ce

Please sign in to comment.