# (C) Ingvar Mattsson, 2000
# funcs  -- A test system shell-function support library

PLAYGROUND="$HOME/src/dribble/playground"
MAPDIR="actions"

locked ()
{
  if [ $# -gt 0 ]
  then
    for action
    do
	if [ -d $PLAYGROUND/$MAPDIR/$action/LOCKED ]
	then
		ls -ld $PLAYGROUND/$MAPDIR/$action/LOCKED
	fi
    done
  else
    ls -ld $PLAYGROUND/$MAPDIR/*/LOCKED
  fi
}

unlock ()
{
  if [ $# -gt 0 ]
  then
    for action
    do
	if [ -d $PLAYGROUND/$MAPDIR/$action/LOCKED ]
	then
		rmdir $PLAYGROUND/$MAPDIR/$action/LOCKED
	fi
    done
  else
    rmdir $PLAYGROUND/$MAPDIR/*/LOCKED
  fi
}

items ()
{
  if [ $# -gt 0 ]
  then
    for action
    do
      for item in $PLAYGROUND/$MAPDIR/$action/items/*
      do
      if [ -f $item ]
      then
        echo $item
      fi
      done
    done
  else
    for item in $PLAYGROUND/$MAPDIR/*/items/*
    do
      if [ -f $item ]
      then
        echo $item
      fi
    done
  fi
}

setmap ()
{
  MAPDIR=$1
  echo "Map is $MAPDIR"
}
