void designateTask(int i, int i0, TaskEnum type) {
        if(this.getTile(i, i0).getDesignate()==type)
        {
           this.getTile(i, i0).setDesignate(null);
            this.getTaskmanager().undesignateTask(this.getMap().getTile(i, i0).getActualTask(), this.getBeastcollection());
           return;
           
        }
        
        switch(type)
        {
            case digging:
       this.getTile(i, i0).designateMine();
       break;
            case walling: 
       this.getTile(i, i0).designateWall();  
        }
        
       if(this.getTile(i, i0).getDesignate()==type)//if successfully designated
       {
           
           if(this.getTile(i, i0).getDesignate()==TaskEnum.digging && this.getTile(i, i0).isWalkable()) return;
           
            if(this.getTile(i, i0).getDesignate()==TaskEnum.walling && this.getTile(i, i0).isExplored()==false) return;
           
           Task ntask = TaskFactory.newCompositeTask(-1, i, i0, type);
           this.getMap().getTile(i, i0).setActualTask(ntask.getTaskid());
            this.getTaskmanager().addTask(ntask);
       }
      }