Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hauteur maximale dans la classe HeightTool #65

Closed
ghost opened this issue May 14, 2015 · 5 comments
Closed

Hauteur maximale dans la classe HeightTool #65

ghost opened this issue May 14, 2015 · 5 comments

Comments

@ghost
Copy link

ghost commented May 14, 2015

N'ayant vu aucune sécurité sur la hauteur maximale du terrain avec l'outil height, j'en ai rajouté une.
Ma méthode est de définir une constante nommée MAX_HEIGHT et de tester si la hauteur est supérieure a cette constante, si oui, alors elle y est égale.
EDIT : personnellement, j'ai mis MAX_HEIGHT a 50

@methusalah
Copy link
Owner

Pas faux, il faudra faire de même pour le min_height ^^

Attention, le projet est cosmopolite et l'anglais est de mise !

@methusalah
Copy link
Owner

Terrain height can definitly be under 0.

@ghost
Copy link
Author

ghost commented May 15, 2015

I've seen it just after posting and made the changes

@methusalah
Copy link
Owner

Great ☺you may create a pull request, or paste the code change here and
I'll do the commit.

Thanks for the contribution!

Le ven. 15 mai 2015 14:10, Code Campus notifications@github.com a écrit :

I've seen it just after posting and made the changes


Reply to this email directly or view it on GitHub
#65 (comment).

@ghost
Copy link
Author

ghost commented May 15, 2015

here is the code

private static final int MAX_HEIGHT = 30, MIN_HEIGHT = -10;
private void raise(List<Tile> tiles){
    for(Tile t : tiles) {
        t.elevation += amplitude*pencil.strength*pencil.getApplicationRatio(t.getCoord());

        if(t.elevation > MAX_HEIGHT)
            t.elevation = MAX_HEIGHT;
    }
}

private void low(List<Tile> tiles){
    for(Tile t : tiles) {
        t.elevation -= amplitude*pencil.strength*pencil.getApplicationRatio(t.getCoord());

        if(t.elevation < MIN_HEIGHT)
            t.elevation = MIN_HEIGHT;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant