#	charsheet:equipment	1.6
#
#	Copyright 1991, Chris Seabrook
#
#	This work may be freely used. modified and distributed for non-commercial
#	purposes so long as it retains this notice.
#
# equipment(number)
# container(name, capacity, container weight, total weight)
# item(magic, name, weight)
.PS
cont_size=0
contwid=sheetwid/2
xoffset=0
yoffset=0
nslots=0
define draw_cont X
	[
		box invis wid contwid/4 "\f(HB\s+2Container\s0\fP"
		box invis wid contwid/4 "\f(HB\s-2Capacity\s0\fP"
		box invis wid contwid/4 "\f(HB\s-2Container" "Weight\s0\fP"
		box invis wid contwid/4 "\f(HB\s-2Total" "Weight\s0\fP"
		box wid contwid/4 ht boxht/2 with .nw at 4th last box.sw
		box wid contwid/4 ht boxht/2
		box wid contwid/4 ht boxht/2
		box wid contwid/4 ht boxht/2
		box invis wid contwid/8 ht boxht/2 "\f(HB\s-2Magic\s0\fP" \
			with .nw at 4th last box.sw
		box invis wid 5*contwid/8 ht boxht/2 "\f(HB\s-2Object\s0\fP"
		box invis wid 2*contwid/8 ht boxht/2 "\f(HB\s-2Weight\s0\fP"
		for ccount=1 to cont_size do Y
			box wid contwid/8 ht boxht/2 with .nw at 3rd last box.sw
			box wid 5*contwid/8 ht boxht/2
			box wid 2*contwid/8 ht boxht/2
		Y
	]
	box ht last [].ht wid last [].wid at last []
X
define container X
	if ncontainer>0 then Y
		ncontainer=ncontainer-1
		nslots=cont_size
		if (((ncount*2)-ncontainer) % 2) == 1 then Z xoffset=0 Z \
		else Z xoffset=(sheetwid/2) Z
		yoffset=-1*((cont_size/2+2)*boxht)
		yoffset=(int((((ncount*2)-ncontainer)-1)/2)*yoffset)-boxht
		[
			box invis wid contwid/4 ht boxht/2 "$1"
			box invis wid contwid/4 ht boxht/2 "$2#"
			box invis wid contwid/4 ht boxht/2 "$3#"
			box invis wid contwid/4 ht boxht/2 "$4#"
		] with .nw at Ncontainer.nw + (xoffset,yoffset)
	Y
X
define item X
	if nslots>0 then Y
		[
			box invis wid contwid/8 ht boxht/2 "$1"
			box invis wid 5*contwid/8 ht boxht/2 "$2"
			box invis wid 2*contwid/8 ht boxht/2 "$3#"
		] with .nw at Ncontainer.nw + \
			(xoffset,yoffset-((cont_size-nslots+2)*(boxht/2)))
		nslots=nslots-1
	Y
X
define equipment X
	ncount=int(($1+1)/2)
	ncontainer=2*ncount
	cont_size=$2
	Ncontainer: [
		draw_cont()
		draw_cont()
		if ncount>1 then Y
			for nncount=2 to ncount by 1 do Z
				[
					draw_cont()
				] with .ne at last box.sw
				draw_cont()
			Z
		Y
	] with .n at last box.s + 0,-1*border
	box ht last [].ht+border wid last [].wid+border at last []
X
.PE
