# cumarrput
!{
	ARGS[0]: name
	ARGS[1]: 
	ARGS[2]: max potential
	ARGS[3]: current potential
	ARGS[4]: knowledge of person (-2 not known sex act; -1 not known deposit (precum); 0 unknown/nameless person; 1 known person)
	ARGS[5]: [not necessary to set] age of cum deposit
}
argc = arrsize('ARGS')
if argc < 5:
	'ERROR: cumarrput called incorrectly. report this to the maintainers'
end

!{'cumarr boy <<$ARGS[0]>> con <<ARGS[1]>> ppt <<ARGS[2]>> cpt <<ARGS[3]>> know <<ARGS[4]>> age <<ARGS[5]>>'}

cacon = ARGS[1]

i = arrsize('$cumarrnam')

!{Check for existing non-protected deposit by same guy}
i2 = 0
:cumarrputloop
if i2 < i:
	if $cumarrnam[i2] = $ARGS[0] and cumarrdel[i2] = 0:
		!{The following little horror lets us not override a "higher priority" contraceptive method with a lower-priority one. So if PC has unprotected sex with a guy once and then uses a condom next time and the condom breaks, the list will still show the cum deposit as being from unprotected sex.}
		!{In brief, we create an array of contraceptive methods in order of decreasting priority, and set effcontra to the first value matched by either sexcontra or the relevant cumarrcon entry.}
		cacon = func('sexcontraprio', ARGS[1], cumarrcon[i2])
		i = i2
	else
		i2 += 1
		jump 'cumarrputloop'
	end
end

$cumarrnam[i] = $ARGS[0]
cumarrcon[i] = cacon
if cumarrppt[i] < ARGS[2] or ARGS[2] = -1:
	cumarrppt[i] = ARGS[2]
end
if ARGS[3] < cumarrppt[i] or cumarrcpt[i] = 0:
	c = ARGS[3]
	if c < 0: c *= -1
	cumarrcpt[i] += ARGS[3]
end
if ARGS[4]:
	cumarrkno[i] = ARGS[4]
end
if argc > 5:
	if cumarrage[i] < ARGS[5]: cumarrage[i] = ARGS[5]
else
	cumarrage[i] = 0
end

RESULT = i

--- cumarrput ---------------------------------

