diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-10-16 00:07:29 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-10-16 00:07:29 +0000 |
commit | d205342bb908207f7921c444e539072e006be241 (patch) | |
tree | 02bcafdc716d2c4fbc7e62fc394f183a6c5fe83f | |
parent | afcfccc6f0f2f11ddbe0a4361d5f03d44a32757f (diff) | |
download | mana-d205342bb908207f7921c444e539072e006be241.tar.gz mana-d205342bb908207f7921c444e539072e006be241.tar.bz2 mana-d205342bb908207f7921c444e539072e006be241.tar.xz mana-d205342bb908207f7921c444e539072e006be241.zip |
Moved some variables into the block where they are used.
-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); |