Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ksh
- . subr
- cd $DIAPERFURIX_HOME/share/map
- if [[ -z $1 ]];then
- r="12"
- else
- r="$1"
- fi
- i=0
- for j in *;do
- places[${i}]="${j}"
- ((i++))
- done
- a=$(($x-$r))
- b=$(($y-$r))
- while ((b<=$r+$y));do
- while ((a<=$r+$x));do
- if [[ "${x}" = "${a}" && "${y}" = "${b}" ]];then
- line="$line"'@'
- # would've used printf '@', but that seems to be slower
- # probably due to spawning a ton of processes and a shitload of calls to write(2)
- elif [[ -e "${DIAPERFURIX_HOME}/share/map/${a}x${b}x${z}/mapchar" ]];then
- line="${line}$(cat "${DIAPERFURIX_HOME}/share/map/${a}x${b}x${z}/mapchar")"
- elif [[ -e "${DIAPERFURIX_HOME}/share/map/${a}x${b}x${z}" ]];then
- line="$line"' '
- else
- line="$line"'#'
- fi
- ((a++))
- done
- printf "$line\n"
- line=
- ((b++))
- a=$(($x-$r))
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement