summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-10-16 00:07:29 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-10-16 00:07:29 +0000
commitd205342bb908207f7921c444e539072e006be241 (patch)
tree02bcafdc716d2c4fbc7e62fc394f183a6c5fe83f /src
parentafcfccc6f0f2f11ddbe0a4361d5f03d44a32757f (diff)
downloadmana-d205342bb908207f7921c444e539072e006be241.tar.gz
mana-d205342bb908207f7921c444e539072e006be241.tar.bz2
mana-d205342bb908207f7921c444e539072e006be241.tar.xz
mana-d205342bb908207f7921c444e539072e006be241.zip
Moved some variables into the block where they are used.
Diffstat (limited to 'src')
-rw-r--r--src/engine.cpp13
1 files changed, 7 insertions, 6 deletions
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);