X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fwhere-vessels;h=2e625c1e12e12815ec9ad13a3acf9ec51e0fc4d4;hb=27d9c020c52e2ad3d6e8ae5c4b113f062ec01251;hp=ec4394b1e2aaef66b8b10c0fc1ecab1e6caa521e;hpb=c0e46c32d792391156c62358f3d92e630ffcd9ed;p=ypp-sc-tools.db-test.git diff --git a/yarrg/where-vessels b/yarrg/where-vessels index ec4394b..2e625c1 100755 --- a/yarrg/where-vessels +++ b/yarrg/where-vessels @@ -264,8 +264,20 @@ proc vesselclasses-init {} { set vc_game2code($game) $code set vc_code2abbrev($code) $abbrev set vc_code2full($code) $full - image create bitmap ship-icon/$abbrev -file icons/$abbrev.xbm + load-icon $abbrev } + + load-icon unlocked + load-icon locked + load-icon battle + load-icon borrow + load-icon query + load-icon ours + load-icon dot +} + +proc load-icon {icon} { + image create bitmap icon/$icon -file icons/$icon.xbm } proc code2abbrev-lock {lockown} { @@ -274,10 +286,10 @@ proc code2abbrev-lock {lockown} { append abbrev [lindex {= - ?} [regsub {\D} $notown 2]] } -proc canvas-horiz-stack {xvar y bind type args} { +proc canvas-horiz-stack {xvar xoff y bind type args} { upvar 1 $xvar x upvar 1 canvas canvas - set id [eval $canvas create $type $x $y $args] + set id [eval $canvas create $type [expr {$x+$xoff}] $y $args] set bbox [$canvas bbox $id] set x [lindex $bbox 2] $canvas bind $id $bind @@ -292,22 +304,40 @@ proc code2canvas {code canvas x yvar qty qtylen bind} { set stackx $x incr stackx 2 + set imy [expr {$y+2}] append qty [lindex {? {}} $inport] set qty [format "%${qtylen}s" $qty] - set qtyid [canvas-horiz-stack stackx $y $bind \ + set qtyid [canvas-horiz-stack stackx 0 $y $bind \ text -anchor nw -font fixed -text $qty] - incr stackx -1 - canvas-horiz-stack stackx [expr {$y+2}] $bind \ - image -anchor nw -image ship-icon/$vc_code2abbrev($class) - incr stackx + canvas-horiz-stack stackx -1 $imy $bind \ + image -anchor nw -image icon/$vc_code2abbrev($class) - canvas-horiz-stack stackx $y $bind \ - text -anchor nw -font fixed -text \ - "$subclass[code2abbrev-lock $lockown]$xabbrev" + if {[string length $subclass]} { + canvas-horiz-stack stackx 0 $y $bind \ + text -anchor nw -font fixed -text \ + $subclass + } + + manyset [split $lockown ""] lock notown + incr stackx + canvas-horiz-stack stackx 0 $imy $bind \ + image -anchor nw -image icon/[lindex {battle dot locked} $lock] + incr stackx + canvas-horiz-stack stackx 0 $imy $bind \ + image -anchor nw -image icon/[lindex {ours dot query} \ + [regsub {\D} $notown 2]] + incr stackx + + if {[string length $xabbrev]} { + canvas-horiz-stack stackx 0 $y $bind \ + text -anchor nw -font fixed -text \ + $xabbrev + } + set bbox [$canvas bbox $qtyid] set ny [lindex $bbox 3] set bid [$canvas create rectangle \ @@ -361,7 +391,7 @@ set filters {} proc filter-values/size {} { global vc_codes; return $vc_codes } proc filter-icon/size {code} { upvar #0 vc_code2abbrev($code) abb - return ship-icon/$abb + return icon/$abb } proc filter-default/size {code} { return 1 } proc filter-says-yes/size {codel} {