_ufo2map()
{
	local cur prev opts
	COMPREPLY=()
	cur="${COMP_WORDS[COMP_CWORD]}"
	prev="${COMP_WORDS[COMP_CWORD-1]}"

	opts="--help -soft -extra -onlyents -onlynewer -nofootstep -material -info -check -fix -subdivide -nosubdiv -tracefile -debugtrace -nomerge -nodetails -nolighting"

	if [[ ${cur} == -* ]] ; then
		COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
		return 0
	else
		local names=$(for x in `find base/maps -name "*.map"`; do echo ${x/base\//} ; done )
		COMPREPLY=( $(compgen -W "${names}" -- ${cur}) )
		return 0
	fi
}
complete -F _ufo2map ufo2map
