+ set notes($vid) [list $lno $vname $owner $note]
+ }
+}
+
+proc note-info {lno vid name description} {
+ global note_infos
+ lappend note_infos [list $lno $vid $name $description]
+}
+
+proc display-note-infos {} {
+ global note_infos note_missings notes
+
+ set nmissing [llength $note_missings]
+ debug "display-note-infos $nmissing [array size notes]"
+
+ if {[llength $note_infos]} {
+ set tiny "[llength $note_infos] warnings"
+ } elseif {$nmissing && [array size notes]} {
+ set tiny "$nmissing missing"
+ } else {
+ return
+ }
+
+ set infodata {}
+
+ foreach info $note_infos {
+ manyset $info lno vid name description
+ append infodata "vessel"
+ append infodata " $vid"
+ if {[string length $name]} { append infodata " $name" }
+ append infodata ": " $description "\n"
+ }
+
+ if {$nmissing} {
+ append infodata "$nmissing vessels not mentioned in notes:\n"
+ set last_island {}
+ foreach info [lsort $note_missings] {
+ manyset $info island name vid
+ if {[string compare $island $last_island]} {
+ append infodata "# $island:\n"
+ set last_island $island
+ }
+ append infodata [format "%-9d %-29s =\n" $vid $name]
+ }
+ }
+
+ parser-control-failed-core .ctrl.notes notes \
+ white blue 0 \
+ $tiny \
+ "[llength $note_infos] warnings;\
+ $nmissing vessels missing" \
+ "Full description of warnings and missing vessels:" \
+ $infodata
+}
+
+#---------- loading and parsing the clipboard (vessel locations) ----------
+
+proc vessel {vin} {
+ global pirate notes_used note_missings newnotes
+ upvar 1 $vin vi
+ switch -exact [errexpect-arrayget vi vesselClass] {
+ smsloop { set sz 00sl }
+ lgsloop { set sz 01ct }
+ dhow { set sz 02dh }
+ longship { set sz 03ls }
+ baghlah { set sz 04bg }
+ merchbrig { set sz 05mb }
+ warbrig { set sz 06wb }
+ xebec { set sz 07xe }
+ warfrig { set sz 08wf }
+ merchgal { set sz 09mg }
+ grandfrig { set sz 10gf }
+ default { errexpect-error "unknown class" }
+ }
+ set abbrev $sz
+ switch -exact [errexpect-arrayget vi vesselSubclass] {
+ null { }
+ icy { append abbrev F }
+ default { errexpect-error "unknown subclass ?" }
+ }
+ switch -exact [errexpect-arrayget vi isLocked]/[ \
+ errexpect-arrayget vi isBattleReady] {
+ true/false { append abbrev 2- }
+ false/false { append abbrev 1+ }
+ false/true { append abbrev 0* }
+ default { errexpect-error "unexpected isLocked/isBattleReady" }
+ }
+ switch -exact [errexpect-arrayget vi inPort] {
+ true { }
+ false { append abbrev ? }
+ default { errexpect-error "unexpected inPort" }
+ }
+ set vid [errexpect-arrayget vi vesselId]
+ upvar #0 notes($vid) note
+ set realname [errexpect-arrayget vi vesselName]
+ set island [errexpect-arrayget vi islandName]
+
+ set owner {}
+ set xabbrev {}
+ if {[info exists note]} {
+ manyset $note lno notename owner xabbrev
+ if {[string compare -nocase $realname $notename]} {
+ note-info $lno $vid $realname \
+ "notes say name is $notename - perhaps renamed"
+ }
+ if {[string length $owner]} {
+ if {![string compare $owner $pirate]} {
+ append abbrev =
+ } else {
+ append abbrev -
+ }