From d205342bb908207f7921c444e539072e006be241 Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Sun, 16 Oct 2005 00:07:29 +0000 Subject: Moved some variables into the block where they are used. --- ChangeLog | 2 ++ src/engine.cpp | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 41ae7c3a..0144ba3c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-10-15 Björn Steinbrink + * src/engine.cpp: Moved some variables into the conditional block + wehere they are used. * src/being.cpp: A few changes that make the code look nicer. * src/openglgraphics.cpp, src/resources/image.cpp, src/resources/image.h: Some small cleanups. diff --git a/src/engine.cpp b/src/engine.cpp index 5e175e32..706435d4 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -201,10 +201,6 @@ void Engine::logic() void Engine::draw() { - // Get the current mouse position - int mouseX, mouseY; - SDL_GetMouseState(&mouseX, &mouseY); - int midTileX = graphics->getWidth() / 32 / 2; int midTileY = graphics->getHeight() / 32 / 2; @@ -228,8 +224,6 @@ void Engine::draw() camera_x = map_x / 32; camera_y = map_y / 32; - int mouseTileX = mouseX / 32 + camera_x; - int mouseTileY = mouseY / 32 + camera_y; frame++; @@ -245,6 +239,13 @@ void Engine::draw() // purposes. if (displayPathToMouse && mCurrentMap != NULL) { + // Get the current mouse position + int mouseX, mouseY; + SDL_GetMouseState(&mouseX, &mouseY); + + int mouseTileX = mouseX / 32 + camera_x; + int mouseTileY = mouseY / 32 + camera_y; + std::list debugPath = mCurrentMap->findPath( player_node->x, player_node->y, mouseTileX, mouseTileY); -- cgit v1.2.3-70-g09d2