diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/engine.cpp | 13 |
2 files changed, 9 insertions, 6 deletions
@@ -1,5 +1,7 @@ 2005-10-15 Björn Steinbrink <B.Steinbrink@gmx.de> + * 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<PATH_NODE> debugPath = mCurrentMap->findPath( player_node->x, player_node->y, mouseTileX, mouseTileY); |