}
set f [open $info_cache/vessel-info]
- glset vessel_class_data [read $f]
+ glset vessel_size_data [read $f]
close $f
}
-proc vesselclasses-init {} {
+proc vesselinfo-init {} {
global vc_game2code vc_code2abbrev vc_code2full vc_codes
- global vessel_class_data
- manyset $vessel_class_data classinfos subclassinfos
+ global vessel_size_data
+ manyset $vessel_size_data sizeinfos subclassinfos
set vc_codes {}
- foreach {game code abbrev full} $classinfos {
+ foreach {game code abbrev full} $sizeinfos {
if {![regexp {^[a-z][a-z]$} $code code]} { error "bad code" }
if {![regexp {^[a-z][a-z]$} $abbrev abbrev]} { error "bad abbrev" }
lappend vc_codes $code
global vc_code2abbrev
upvar 1 $yvar y
- manyset [split $code _] inport class subclass lockown xabbrev
+ manyset [split $code _] inport size subclass lockown xabbrev
set stackx $x
incr stackx 2
incr stackx
}
- upvar #0 vc_code2abbrev($class) vcabb
+ upvar #0 vc_code2abbrev($size) vcabb
if {![info exists vcabb]} {
- set vcabb vc-$class
+ set vcabb vc-$size
image create bitmap icon/$vcabb -data \
- [exec pbmtext -builtin fixed $class | pnminvert | pnmcrop >t.pnm]
+ [exec pbmtext -builtin fixed $size | pnminvert | pnmcrop >t.pnm]
}
canvas-horiz-stack stackx -1 $imy $bind \
image -anchor nw -image icon/$vcabb
proc show-report-decode {code} {
global vc_code2full
- manyset [split $code _] inport classcode subclass lockown xabbrev
+ smash-prepare
+
+ manyset [split $code _] inport sizecode subclass lockown xabbrev
manyset [split $lockown ""] lock notown
report-set inport [lindex {{At Sea} {In port}} $inport]
- report-set class $vc_code2full($classcode)
+
+ upvar #0 vc_code2full($sizecode) sizefull
+ upvar #0 smash_sizeinexact($sizecode) sizeinexact
+ set size_report $sizefull
+ if {[info exists sizeinexact]} { set size_report "($sizefull+)" }
+ report-set size $size_report
global smash_subclass
if {$smash_subclass >= 2} {
- report-set subclass "(Any subclass)"
+ report-set subclass "(Any class)"
} elseif {[
upvar #0 vsc_code2report($subclass) subclass_report
info exists subclass_report
]} {
report-set subclass $subclass_report
} else {
- report-set subclass "Subclass \"$subclass\""
+ report-set subclass "Class \"$subclass\""
}
report-set lock [lindex {
default { report-set own "?? $notown" }
}
- if {[string length $xabbrev]} {
- report-set xabbrev "Notes flags: $xabbrev"
+ global smash_xabbrev_map
+ if {[llength $smash_xabbrev_map]} {
+ if {[string length $xabbrev]} {
+ report-set xabbrev "(Flags: $xabbrev)"
+ } else {
+ report-set xabbrev "(No flags)"
+ }
} else {
- report-set xabbrev "No flags in notes"
+ if {[string length $xabbrev]} {
+ report-set xabbrev "Notes flags: $xabbrev"
+ } else {
+ report-set xabbrev "No flags in notes"
+ }
}
}
return $cw
}
-proc make-control-grid-entry {cw kind ix ekind args} {
+proc make-control-grid-elem {cw kind ix ekind args} {
upvar #0 control_grid_properties($cw) props
manyset $props rows inrow
set ew $cw.$ix
- debug "MAKE-CONTROL-GRID-ENTRY $cw $kind $ix $ekind $rows $inrow $ew"
+ debug "MAKE-CONTROL-GRID-ELEM $cw $kind $ix $ekind $rows $inrow $ew"
eval [list $ekind $ew] $args
for {set ix 0} {$ix < $count} {incr ix} {
set val [lindex $values $ix]
set vars($val) [uplevel 1 $default_get]
- set ew [make-control-grid-entry $cw ix $ix checkbutton \
+ set ew [make-control-grid-elem $cw ix $ix checkbutton \
-variable ${varsvn}($val) \
-font fixed \
-command [list redraw-needed c.-g.-tickbox $cw $val]]
image { $ew configure -height 16 }
}
}
- [make-control-grid-entry $cw final invert button] \
+ [make-control-grid-elem $cw final invert button] \
configure \
-text flip -command [list control-tickbox-flip $varsvn $flipvalues] \
-padx 0 -pady 0
set smash_owner 0
proc smash-code {code} {
- manyset [split $code _] inport class subclass lockown xabbrev
+ manyset [split $code _] inport size subclass lockown xabbrev
- upvar #0 smash_sizemap($class) smclass
+ upvar #0 smash_sizemap($size) smsize
global smash_subclass
if {$smash_subclass > 1} {
4 { set lockown 33 }
}
- return [join [list $inport $smclass $subclass $lockown $xabbrev] _]
+ global smash_xabbrev_map
+ set xabbrev [string map $smash_xabbrev_map $xabbrev]
+
+ return [join [list $inport $smsize $subclass $lockown $xabbrev] _]
}
proc smash-prepare {} {
- global vc_codes smash_sizemap smash_size
+ global vc_codes smash_sizemap smash_size smash_sizeinexact
set mapto {}
+ catch { unset smash_sizeplus }
foreach size $vc_codes {
- if {!$smash_size($size)} { set mapto $size }
+ if {!$smash_size($size)} {
+ set mapto $size
+ } else {
+ set smash_sizeinexact($mapto) 1
+ }
set smash_sizemap($size) $mapto
}
+
+ global smash_xabbrev_a smash_xabbrev_b smash_xabbrev_map
+ set smash_xabbrev_map {}
+ foreach a [split $smash_xabbrev_a ""] b [split $smash_xabbrev_b ""] {
+ if {![string length $a]} continue
+ lappend smash_xabbrev_map $a $b
+ }
+ debug "SMASH-PREPAE xabbrev_map=[list $smash_xabbrev_map]"
}
proc make-smasher {sma label ekind} {
set w [make-smasher $sma $label frame]
begin-control-grid $w [llength $descs] $rows $inrow
for {set i 0} {$i < [llength $descs]} {incr i} {
- make-control-grid-entry $w ix $i \
+ make-control-grid-elem $w ix $i \
radiobutton \
-variable $variable -value $i -command redraw-needed \
-text [lindex $descs $i]
image val { expr 0 } { expr {"icon/$vc_code2abbrev($val)"} }
$cw.0 configure -state disabled
- make-radio-smasher subclass Subclass smash_subclass \
+ make-radio-smasher subclass Class smash_subclass \
{Show Normal/LE Hide} 1 0
make-radio-smasher owner Owner smash_owner \
{Show Yours? {For you} Lock Hide} 2 3
+
+ set cw [make-smasher xabbrev "Flags" frame]
+ foreach ix {1 3} ab {a b} width {14 12} {
+ set vn smash_xabbrev_$ab
+ global $vn
+ set $vn {}
+ entry $cw.$ix -textvariable $vn -width $width
+ trace add variable $vn write [list redraw-needed $vn]
+ }
+ set ix 0
+ foreach str {y/ / /d} { label $cw.$ix -text $str; incr ix 2 }
+ eval pack [lsort [winfo children $cw]] -side left
}
#---------- filtering ----------
set codel {}
lappend codel [errexpect-arrayget-boolean vi inPort]
- set gameclass [errexpect-arrayget vi vesselClass]
- upvar #0 vc_game2code($gameclass) class
- if {![info exists class]} {
- set class "($gameclass)"
- upvar #0 vc_code2abbrev($class) vcabb
- set vcabb vc-$class
- set data [exec pbmtext -builtin fixed " $gameclass " \
+ set gamesize [errexpect-arrayget vi vesselClass]
+ upvar #0 vc_game2code($gamesize) size
+ if {![info exists size]} {
+ set size "($gamesize)"
+ upvar #0 vc_code2abbrev($size) vcabb
+ set vcabb vc-$size
+ set data [exec pbmtext -builtin fixed " $gamesize " \
| pnminvert | pnmcrop | pbmtoxbm]
debug "INVENTED ICON $vcabb $data"
image create bitmap icon/$vcabb -data $data
global vc_code2full
- set vc_code2full($class) "Type \"$gameclass\""
+ set vc_code2full($size) "Type \"$gamesize\""
}
- lappend codel $class
+ lappend codel $size
set gamesubclass [errexpect-arrayget vi vesselSubclass]
upvar #0 vsc_game2code($gamesubclass) subclass
#pack .cp.report.code -side top
pack configure .cp.report.details -fill x
- foreach sw {inport class subclass lock own xabbrev} {
+ foreach sw {inport size subclass lock own xabbrev} {
label .cp.report.details.$sw -text { }
pack .cp.report.details.$sw -side top -anchor w
}
.cp.report.list delete 0 end
- foreach entry $k {
- manyset $entry vid name owner
+ foreach elem $k {
+ manyset $elem vid name owner
lappend owned($owner) $name
}
argdefaults
httpclientsetup where-vessels
info-cache-update
-vesselclasses-init
+vesselinfo-init
load-chart
widgets-setup
make-filters