Closed ghost closed 9 years ago
Pas faux, il faudra faire de même pour le min_height ^^
Attention, le projet est cosmopolite et l'anglais est de mise !
Terrain height can definitly be under 0.
I've seen it just after posting and made the changes
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 https://github.com/methusalah/OpenRTS/issues/65#issuecomment-102382832.
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;
}
}
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