From: Ian Jackson Date: Sat, 7 Aug 2010 11:21:37 +0000 (+0100) Subject: where-vessels shows uncolonised islands differently X-Git-Tag: 6.6.1~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=commitdiff_plain;h=84e330af6dabd818db6e87e0ff57db45fdf176ca;hp=686285532be6809aade725d6b4c01f9d56826f7e where-vessels shows uncolonised islands differently --- diff --git a/yarrg/CommodsScrape.pm b/yarrg/CommodsScrape.pm index 2b1d4a9..d6951cf 100644 --- a/yarrg/CommodsScrape.pm +++ b/yarrg/CommodsScrape.pm @@ -46,7 +46,7 @@ sub yppedia_chart_parse ($$ $$$$ $) { $conv_nxy, $on_archlabel, $on_island, $on_league, $on_incomprehensible) = @_; - my ($x,$y, $arch,$island,$solid,$dirn); + my ($x,$y, $arch,$island,$sizecol,$solid,$dirn); my $nn= sub { return $conv_nxy->($x,$y) }; # We don't even bother with tag soup; instead we do line-oriented parsing. @@ -68,12 +68,12 @@ sub yppedia_chart_parse ($$ $$$$ $) { $on_archlabel->($x,$y,$arch); } elsif (m/^\{\{ chart\ label \|\d+\|\d+\| \ \'+ \[\[ .* \b ocean \]\]/xi) { - } elsif (($x,$y,$island) = + } elsif (($x,$y,$island,$sizecol) = m/^\{\{ chart\ island\ icon \|(\d+)\|(\d+)\| - ([^| ][^|]*[^| ]) \| .*\}\}$/xi) { + ([^| ][^|]*[^| ]) \| [^|]* \| (\w+) \| .*\}\}$/xi) { my $n= $nn->(); printf $debugfh "%2d,%-2d island %s\n", $x,$y,$island; - $on_island->($n, $island); + $on_island->($n, $island, $sizecol); } elsif (($solid,$x,$y,$dirn) = m/^\{\{ chart\ league((?:\ solid)?) \|(\d+)\|(\d+)\| \.?([-\/\\o])\.? \| .*\}\}$/xi) { diff --git a/yarrg/where-vessels b/yarrg/where-vessels index 33df7f8..7e64cce 100755 --- a/yarrg/where-vessels +++ b/yarrg/where-vessels @@ -744,7 +744,7 @@ proc load-chart {} { yppedia_chart_parse(\*STDIN, (new IO::File ">/dev/null"), sub { sprintf "%d %d", @_; }, sub { printf "archlabel %d %d %s\n", @_; }, - sub { printf "island %s %s\n", @_; }, + sub { printf "island %s {%s} %s\n", @_; }, sub { printf "league %s %s %s.\n", @_; }, sub { printf STDERR "warning: %s: incomprehensible: %s", @_; } ); @@ -761,17 +761,19 @@ proc coord {c} { } proc chart-got/archlabel {args} { } -proc chart-got/island {x y args} { -# debug "ISLE $x $y $args" +proc chart-got/island {x y isle sizecol} { + debug "ISLE $x $y $isle $sizecol" global canvas isleloc - set isleloc($args) [list $x $y] + set isleloc($isle) [list $x $y] set sz 5 # $canvas create oval \ # [expr {[coord $x] - $sz}] [expr {[coord $y] - $sz}] \ # [expr {[coord $x] + $sz}] [expr {[coord $y] + $sz}] \ # -fill blue + set colour "#888" + if {[string match *_col $sizecol]} { set colour black } $canvas create text [coord $x] [coord $y] \ - -text $args -anchor s + -text $isle -anchor s -fill $colour } proc chart-got/league {x1 y1 x2 y2 kind} { # debug "LEAGUE $x1 $y1 $x2 $y2 $kind"