package org.sms.tetris3d;

import android.content.Context;

import java.util.ArrayList;
import org.sms.tetris3d.players.*;
/**
 * Created by hsh on 2016. 11. 16..
 */

public class GameStatus extends com.trippleit.android.tetris3d.GameStatus{
    protected static final  ArrayList<User> players = new ArrayList<User>(){
        @Override
        public User remove(int idx){
            if(idx>0){
                return super.remove(idx);
            }
            else{
                return get(0);
            }
        }
        @Override
        public void clear(){
            final User usr = get(0);
            super.clear();
            add(usr);
        }
        @Override
        public boolean remove(Object usr){
            if(usr instanceof  DeviceUser){
                return false;
            }else{
                return super.remove(usr);
            }
        }
        @Override
        public void removeRange(int start,int end){
            super.removeRange(start>0?start:1,end>0?end:1);
        }
    };
    public static ArrayList<User> getPlayers(){
        return players;
    }
    public static void init(Context _c) {
        players.add(new DeviceUser());
        gameHeight = 10;
        gridSize = 5;
        gStatus = GAME_STATUS.START;
        restartGameBoolMatrix();
        setCamera(-65, 10);
        start=true;
        end = false;
        startX = 2;
        startY = 2;
        dropFast = false;
    }
}

@@ -53,16 +53,64 @@
 ntext;%0A%0A
+import com.trippleit.android.tetris3d.users.*;%0A%0A
 import j
@@ -164,16 +164,99 @@
 yers.*;%0A
+import org.sms.tetris3d.players.DeviceUser;%0Aimport org.sms.tetris3d.players.User;%0A%0A
 /**%0A * C
@@ -1235,24 +1235,1318 @@
 yers;%0A    %7D%0A
+    public static int getAvailableZPos(final org.sms.tetris3d.players.User who)%7B%0A        int result=0;%0A        for (int i = 0; i %3C= who.getCurrentObjectZ(); i++) %7B%0A            boolean isExist = false;%0A            for(int j =0;!isExist&&j%3Cwho.getCurrentObject().getObjectMatrix().length;j++)%7B%0A                for(int k =0;!isExist&&k%3Cwho.getCurrentObject().getObjectMatrix()%5Bj%5D.length;k++) %7B%0A                    for (int l = 0;!isExist&&l%3Cwho.getCurrentObject().getObjectMatrix()%5Bj%5D%5Bk%5D.length;l++) %7B%0A                        final boolean isValid = (j + who.getCurrentObjectX()) %3C com.trippleit.android.tetris3d.GameStatus.getGameBoolMatrix().length && (k + who.getCurrentObjectY()) %3C com.trippleit.android.tetris3d.GameStatus.getGameBoolMatrix()%5B0%5D.length&&(l + i) %3C com.trippleit.android.tetris3d.GameStatus.getGameBoolMatrix()%5B0%5D%5B0%5D.length;%0A                        if (who.getCurrentObject().getObjectMatrix()%5Bj%5D%5Bk%5D%5Bl%5D && isValid && com.trippleit.android.tetris3d.GameStatus.getGameBoolMatrix()%5Bj + who.getCurrentObjectX()%5D%5Bk + who.getCurrentObjectY()%5D%5Bi+l%5D) %7B%0A                            isExist = true;%0A                        %7D%0A                    %7D%0A                %7D%0A            %7D%0A            if(isExist)%7B%0A                result = i+1;%0A            %7D%0A        %7D%0A        return result;%0A    %7D%0A
     public s

add moved function