diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-12 22:18:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-12 22:18:14 +0300 |
commit | 2c1dc81db735d0da2cf25afd34b93c2f228ebb2d (patch) | |
tree | a806fcea53f9f983a4bd5285b144faed42d6dac0 /src/actions | |
parent | 9337f74e87550070fdd2d1bf506a7283719b5c2d (diff) | |
download | manaverse-2c1dc81db735d0da2cf25afd34b93c2f228ebb2d.tar.gz manaverse-2c1dc81db735d0da2cf25afd34b93c2f228ebb2d.tar.bz2 manaverse-2c1dc81db735d0da2cf25afd34b93c2f228ebb2d.tar.xz manaverse-2c1dc81db735d0da2cf25afd34b93c2f228ebb2d.zip |
Add chat command for moving camera.
New chat command: /movecamera x y
Alias: /cameramove x y
Diffstat (limited to 'src/actions')
-rw-r--r-- | src/actions/commands.cpp | 14 | ||||
-rw-r--r-- | src/actions/commands.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index eb10e8a77..dd93da0e8 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -34,6 +34,7 @@ #include "being/playerrelations.h" #include "gui/chatconsts.h" +#include "gui/viewport.h" #include "gui/windows/chatwindow.h" #include "gui/windows/socialwindow.h" @@ -472,6 +473,19 @@ impHandler(navigateTo) return true; } +impHandler(moveCamera) +{ + int x = 0; + int y = 0; + + if (!viewport) + return false; + + if (parse2Int(event.args, x, y)) + viewport->moveCameraToPosition(x * mapTileSize, y * mapTileSize); + return true; +} + impHandler(imitation) { if (!localPlayer) diff --git a/src/actions/commands.h b/src/actions/commands.h index a8143275b..0aa226cb8 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -50,6 +50,7 @@ namespace Actions decHandler(follow); decHandler(navigate); decHandler(navigateTo); + decHandler(moveCamera); decHandler(imitation); decHandler(sendMail); decHandler(info); |