X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-live.git;a=blobdiff_plain;f=yarrg%2Fwhere-vessels;h=8d6de95900fcd15d64f480cac5d05238b78f2945;hp=ec4394b1e2aaef66b8b10c0fc1ecab1e6caa521e;hb=15a33b9bcca5a2932534c7ab5952961bf278faf8;hpb=c0e46c32d792391156c62358f3d92e630ffcd9ed diff --git a/yarrg/where-vessels b/yarrg/where-vessels index ec4394b..8d6de95 100755 --- a/yarrg/where-vessels +++ b/yarrg/where-vessels @@ -254,8 +254,8 @@ proc vesselclasses-init {} { merchbrig fm mb {Merchant Brig} warbrig gm wb {War Brig} xebec hm xe Xebec - warfrig im wf {War Frigate} merchgal jm mg {Merchant Galleon} + warfrig im wf {War Frigate} grandfrig km gf {Grand Frigate} } set vc_codes {} @@ -264,20 +264,33 @@ 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 atsea + 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} { manyset [split $lockown ""] lock notown - append abbrev [lindex {* + -} $lock] - append abbrev [lindex {= - ?} [regsub {\D} $notown 2]] + append abbrev [lindex {x u .} $lock] + append abbrev [lindex {m . ?} [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 +305,47 @@ proc code2canvas {code canvas x yvar qty qtylen bind} { set stackx $x incr stackx 2 + set imy [expr {$y+2}] - append qty [lindex {? {}} $inport] + if {!$inport} { incr qtylen -1 } + if {$qtylen<=0} { set qtylen {} } 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 + if {!$inport} { + canvas-horiz-stack stackx 0 $imy $bind \ + image -anchor nw -image icon/atsea + incr stackx + } + + canvas-horiz-stack stackx -1 $imy $bind \ + image -anchor nw -image icon/$vc_code2abbrev($class) + + if {[string length $subclass]} { + canvas-horiz-stack stackx 0 $y $bind \ + text -anchor nw -font fixed -text \ + $subclass + } - canvas-horiz-stack stackx $y $bind \ - text -anchor nw -font fixed -text \ - "$subclass[code2abbrev-lock $lockown]$xabbrev" + manyset [split $lockown ""] lock notown + incr stackx + canvas-horiz-stack stackx 0 $imy $bind \ + image -anchor nw -image icon/[lindex {battle borrow dot} $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 +399,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} {