protected boolean setTerrain(int cellId, TerrainTypes terrain) {
        if ((cellId >= 0) && (cellId < countCells())) {
            if (this.terrain[cellId] != terrain) {
                this.terrain[cellId] = terrain;
                return true;
            }
        }
        return false;
    }