From fe97e90bb05bca87d2df81bf3a2d7ded964fd42c Mon Sep 17 00:00:00 2001 From: Darshan Shaligram Date: Tue, 29 Dec 2009 17:55:13 +0530 Subject: Fix warnings for double->int implicit conversion (Napkin). --- crawl-ref/source/dgn-shoals.cc | 9 +++++---- crawl-ref/source/dungeon.cc | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/dgn-shoals.cc b/crawl-ref/source/dgn-shoals.cc index c72cd41bf6..b88873d5b5 100644 --- a/crawl-ref/source/dgn-shoals.cc +++ b/crawl-ref/source/dgn-shoals.cc @@ -203,8 +203,9 @@ static void _shoals_build_cliff() for (int i = 0; i < length; i += 3) { int distance = i - length / 2; - coord_def place = cliffc + coord_def(distance * cos(angle), - distance * sin(angle)); + coord_def place = + cliffc + coord_def(static_cast(distance * cos(angle)), + static_cast(distance * sin(angle))); coord_def fuzz = coord_def(random_range(-2, 2), random_range(-2, 2)); place += fuzz; @@ -512,7 +513,7 @@ static coord_def _shoals_region_center( } } - const coord_def cgravity(cx, cy); + const coord_def cgravity(static_cast(cx), static_cast(cy)); coord_def closest_to_center; int closest_distance = 0; for (int i = 0, size = visit.size(); i < size; ++i) @@ -663,7 +664,7 @@ struct coord_dbl static coord_def _int_coord(const coord_dbl &c) { - return coord_def(c.x, c.y); + return coord_def(static_cast(c.x), static_cast(c.y)); } static std::vector _shoals_windshadows(grid_bool &windy) diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 1c1d27f642..93e5086ef6 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -7632,8 +7632,9 @@ coord_def dgn_random_point_from(const coord_def &c, int radius, int margin) while (attempts-- > 0) { const double angle = dgn_degrees_to_radians(random2(360)); - const coord_def res = c + coord_def(radius * cos(angle), - radius * sin(angle)); + const coord_def res = + c + coord_def(static_cast(radius * cos(angle)), + static_cast(radius * sin(angle))); if (res.x >= margin && res.x < GXM - margin && res.y >= margin && res.y < GYM - margin) { -- cgit v1.2.3-54-g00ecf