From: Ian Jackson Date: Mon, 14 Dec 2009 02:47:17 +0000 (+0000) Subject: where-vessels: icons for lock state too X-Git-Tag: 6.3.4~4 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.web-live.git;a=commitdiff_plain;h=27d9c020c52e2ad3d6e8ae5c4b113f062ec01251 where-vessels: icons for lock state too --- diff --git a/yarrg/icons/battle.xbm b/yarrg/icons/battle.xbm index c9b20cc..a180c3c 100644 --- a/yarrg/icons/battle.xbm +++ b/yarrg/icons/battle.xbm @@ -1,4 +1,4 @@ #define battle_width 5 #define battle_height 9 static unsigned char battle_bits[] = { - 0x0e, 0x0a, 0x0e, 0x04, 0x11, 0x0a, 0x04, 0x0a, 0x11}; + 0x00, 0x0e, 0x0e, 0x0e, 0x15, 0x1b, 0x0e, 0x1b, 0x11}; diff --git a/yarrg/icons/borrow.xbm b/yarrg/icons/borrow.xbm new file mode 100644 index 0000000..598f76c --- /dev/null +++ b/yarrg/icons/borrow.xbm @@ -0,0 +1,4 @@ +#define borrow_width 5 +#define borrow_height 9 +static unsigned char borrow_bits[] = { + 0x00, 0x00, 0x00, 0x04, 0x0a, 0x04, 0x00, 0x00, 0x00}; diff --git a/yarrg/icons/dot.xbm b/yarrg/icons/dot.xbm new file mode 100644 index 0000000..c551fca --- /dev/null +++ b/yarrg/icons/dot.xbm @@ -0,0 +1,4 @@ +#define unlocked_width 5 +#define unlocked_height 9 +static unsigned char unlocked_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}; diff --git a/yarrg/icons/ours.xbm b/yarrg/icons/ours.xbm index 6471fca..1c4aa86 100644 --- a/yarrg/icons/ours.xbm +++ b/yarrg/icons/ours.xbm @@ -1,4 +1,4 @@ #define ours_width 5 #define ours_height 9 static unsigned char ours_bits[] = { - 0x07, 0x04, 0x07, 0x04, 0x04, 0x0e, 0x11, 0x11, 0x0e}; + 0x00, 0x00, 0x0f, 0x09, 0x09, 0x09, 0x0f, 0x04, 0x00}; diff --git a/yarrg/icons/query.xbm b/yarrg/icons/query.xbm index 1281460..42d73de 100644 --- a/yarrg/icons/query.xbm +++ b/yarrg/icons/query.xbm @@ -1,4 +1,4 @@ -#define no-owner_width 5 -#define no-owner_height 9 -static unsigned char no-owner_bits[] = { - 0x0e, 0x11, 0x10, 0x10, 0x08, 0x04, 0x04, 0x00, 0x04}; +#define query_width 5 +#define query_height 9 +static unsigned char query_bits[] = { + 0x0e, 0x11, 0x11, 0x10, 0x08, 0x04, 0x04, 0x00, 0x04}; diff --git a/yarrg/icons/sl.xbm b/yarrg/icons/sl.xbm index 64a8b65..3b6c118 100644 --- a/yarrg/icons/sl.xbm +++ b/yarrg/icons/sl.xbm @@ -1,5 +1,5 @@ #define sl_width 12 #define sl_height 10 static unsigned char sl_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, - 0x60, 0x00, 0x40, 0x00, 0xf8, 0x03, 0x00, 0x00}; + 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, + 0x40, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00}; diff --git a/yarrg/icons/unlocked.xbm b/yarrg/icons/unlocked.xbm index b98cc07..c551fca 100644 --- a/yarrg/icons/unlocked.xbm +++ b/yarrg/icons/unlocked.xbm @@ -1,4 +1,4 @@ #define unlocked_width 5 #define unlocked_height 9 static unsigned char unlocked_bits[] = { - 0x06, 0x09, 0x10, 0x10, 0x08, 0x1f, 0x11, 0x11, 0x1f}; + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}; 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} {