From 45f8bd755cd6d741f6c342272e01ce1af6464ea7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 12 Jun 2014 01:18:10 +0200 Subject: CGE2: Fix code computing distance --- engines/cge2/hero.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/cge2/hero.cpp') diff --git a/engines/cge2/hero.cpp b/engines/cge2/hero.cpp index 5efb24e88d..d6dab6d3f0 100644 --- a/engines/cge2/hero.cpp +++ b/engines/cge2/hero.cpp @@ -245,7 +245,7 @@ int Hero::distance(V3D pos) { V3D di = _pos3D - pos; long x = V2D::round(di._x); long z = V2D::round(di._z); - return ((x * x + z * z) * (x * x + z * z)); + return (int)sqrt((long double)(x * x + z * z)); } int Hero::distance(Sprite *spr) { -- cgit v1.2.3