function decreaseGridSlot(myEvent) {
    myEvent.preventDefault();
    let clickedOn = myEvent.target;

    if(hGridArray[clickedOn.myRow][clickedOn.myCol] == 0) return;

    if(hGridArray[clickedOn.myRow][clickedOn.myCol] == 1) {
        numSquaresSelected--;
        if(numSquaresSelected == 0) buildingPlaced = false;
    }

    if(hGridArray[clickedOn.myRow][clickedOn.myCol] - 1 == 1 && numElevated != 0) {
        numElevated--;
    }

    let myResultsFromChange = changeRequirements(clickedOn, false);
    if(myResultsFromChange == -1) {
        numSquaresSelected++;
        return;
    }

    hGridArray[clickedOn.myRow][clickedOn.myCol]--;

    if(hGridArray[clickedOn.myRow][clickedOn.myCol] != 0) {
        clickedOn.innerHTML = hGridArray[clickedOn.myRow][clickedOn.myCol];
    } else {
        clickedOn.innerHTML = "";
    }
    clickedOn.style.backgroundColor = getElevatedColor(hGridArray[clickedOn.myRow][clickedOn.myCol]);
}
//the reduction of a level. Right click is assumed for the event.
the reduction of a level. Right click is assumed for the event.
the reduction of a level . Right click is assumed for the event .
function decreaseGridSlot(myEvent) {
    myEvent.preventDefault();
    let clickedOn = myEvent.target;
    if(hGridArray[clickedOn.myRow][clickedOn.myCol] == 0) return;
    if(hGridArray[clickedOn.myRow][clickedOn.myCol] == 1) {
        numSquaresSelected--;
        if(numSquaresSelected == 0) buildingPlaced = false;
    }
    if(hGridArray[clickedOn.myRow][clickedOn.myCol] - 1 == 1 && numElevated != 0) {
        numElevated--;
    }
    let myResultsFromChange = changeRequirements(clickedOn, false);
    if(myResultsFromChange == -1) {
        numSquaresSelected++;
        return;
    }
    hGridArray[clickedOn.myRow][clickedOn.myCol]--;
    if(hGridArray[clickedOn.myRow][clickedOn.myCol] != 0) {
        clickedOn.innerHTML = hGridArray[clickedOn.myRow][clickedOn.myCol];
    } else {
        clickedOn.innerHTML = "";
    }
    clickedOn.style.backgroundColor = getElevatedColor(hGridArray[clickedOn.myRow][clickedOn.myCol]);
}
function decreaseGridSlot ( myEvent ) { myEvent . preventDefault ( ) ; let clickedOn = myEvent . target ; if ( hGridArray [ clickedOn . myRow ] [ clickedOn . myCol ] == 0 ) return ; if ( hGridArray [ clickedOn . myRow ] [ clickedOn . myCol ] == 1 ) { numSquaresSelected -- ; if ( numSquaresSelected == 0 ) buildingPlaced = false ; } if ( hGridArray [ clickedOn . myRow ] [ clickedOn . myCol ] - 1 == 1 && numElevated != 0 ) { numElevated -- ; } let myResultsFromChange = changeRequirements ( clickedOn , false ) ; if ( myResultsFromChange == - 1 ) { numSquaresSelected ++ ; return ; } hGridArray [ clickedOn . myRow ] [ clickedOn . myCol ] -- ; if ( hGridArray [ clickedOn . myRow ] [ clickedOn . myCol ] != 0 ) { clickedOn . innerHTML = hGridArray [ clickedOn . myRow ] [ clickedOn . myCol ] ; } else { clickedOn . innerHTML = "" ; } clickedOn . style . backgroundColor = getElevatedColor ( hGridArray [ clickedOn . myRow ] [ clickedOn . myCol ] ) ; }
the reduction of a level.
the reduction of a level .