summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-27 13:25:41 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-27 13:25:41 +0300
commitc61f1b6abe8e68995f00ae3a939afe5049e5cdb3 (patch)
treec50613a2c7722fba4aba9d5a67949b118a279b33 /src/gui
parentb481cd74dfd1629ca7b045cde57562e752c49638 (diff)
downloadmv-c61f1b6abe8e68995f00ae3a939afe5049e5cdb3.tar.gz
mv-c61f1b6abe8e68995f00ae3a939afe5049e5cdb3.tar.bz2
mv-c61f1b6abe8e68995f00ae3a939afe5049e5cdb3.tar.xz
mv-c61f1b6abe8e68995f00ae3a939afe5049e5cdb3.zip
Remove manaserv ifdefs code.
ManaServ was already depricated long ago.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/models/typelistmodel.h17
-rw-r--r--src/gui/viewport.cpp242
-rw-r--r--src/gui/windowmenu.cpp12
-rw-r--r--src/gui/windows/charcreatedialog.cpp13
-rw-r--r--src/gui/windows/charselectdialog.cpp7
-rw-r--r--src/gui/windows/editserverdialog.cpp23
-rw-r--r--src/gui/windows/selldialog.cpp10
-rw-r--r--src/gui/windows/serverdialog.cpp20
8 files changed, 104 insertions, 240 deletions
diff --git a/src/gui/models/typelistmodel.h b/src/gui/models/typelistmodel.h
index d7b6226b0..f9c005f8f 100644
--- a/src/gui/models/typelistmodel.h
+++ b/src/gui/models/typelistmodel.h
@@ -38,18 +38,10 @@ class TypeListModel : public ListModel
*/
int getNumberOfElements() override final A_WARN_UNUSED
#ifdef EATHENA_SUPPORT
-#ifdef MANASERV_SUPPORT
- { return 4; }
-#else
- { return 3; }
-#endif
-#else
-#ifdef MANASERV_SUPPORT
{ return 3; }
#else
{ return 2; }
#endif
-#endif
/**
* Used to get an element from the list
@@ -64,15 +56,6 @@ class TypeListModel : public ListModel
#ifdef EATHENA_SUPPORT
else if (elementIndex == 2)
return "eAthena";
-#ifdef MANASERV_SUPPORT
- else if (elementIndex == 3)
- return "ManaServ";
-#endif
-#else
-#ifdef MANASERV_SUPPORT
- else if (elementIndex == 2)
- return "ManaServ";
-#endif
#endif
else
return "Unknown";
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 500378628..96760f8c7 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -343,46 +343,21 @@ void Viewport::_drawPath(Graphics *const graphics, const Path &path,
graphics->setColor(color);
Font *const font = getFont();
-#ifdef MANASERV_SUPPORT
- if (Net::getNetworkType() != ServerInfo::MANASERV)
-#endif
+ int cnt = 1;
+ FOR_EACH (Path::const_iterator, i, path)
{
- int cnt = 1;
- FOR_EACH (Path::const_iterator, i, path)
- {
- const int squareX = i->x * mapTileSize - mPixelViewX + 12;
- const int squareY = i->y * mapTileSize - mPixelViewY + 12;
+ const int squareX = i->x * mapTileSize - mPixelViewX + 12;
+ const int squareY = i->y * mapTileSize - mPixelViewY + 12;
- graphics->fillRectangle(Rect(squareX, squareY, 8, 8));
- if (mMap)
- {
- const std::string str = toString(cnt);
- font->drawString(graphics, str, squareX + 4
- - font->getWidth(str) / 2, squareY + 12);
- }
- cnt ++;
- }
- }
-#ifdef MANASERV_SUPPORT
- else if (Net::getNetworkType() == ServerInfo::MANASERV)
- {
- FOR_EACH (Path::const_iterator, i, path)
+ graphics->fillRectangle(Rect(squareX, squareY, 8, 8));
+ if (mMap)
{
- const int squareX = i->x - mPixelViewX;
- const int squareY = i->y - mPixelViewY;
-
- graphics->fillRectangle(Rect(
- squareX - 4, squareY - 4, 8, 8));
- if (mMap)
- {
- const std::string str = toString(mMap->getMetaTile(
- i->x / mapTileSize, i->y / mapTileSize)->Gcost);
- font->drawString(graphics, str,
- squareX + 4 - font->getWidth(text) / 2, squareY + 12);
- }
+ const std::string str = toString(cnt);
+ font->drawString(graphics, str, squareX + 4
+ - font->getWidth(str) / 2, squareY + 12);
}
+ cnt ++;
}
-#endif
}
void Viewport::mousePressed(MouseEvent &event)
@@ -557,127 +532,111 @@ void Viewport::mouseDragged(MouseEvent &event)
Input::KEY_STOP_ATTACK) && !inputManager.isActionActive(
Input::KEY_UNTARGET))
{
-#ifdef MANASERV_SUPPORT
- if (Net::getNetworkType() == ServerInfo::MANASERV)
- {
- if (get_elapsed_time(mLocalWalkTime) >= walkingMouseDelay)
- {
- mLocalWalkTime = tick_time;
- player_node->unSetPickUpTarget();
- player_node->setDestination(event.getX() + mPixelViewX,
- event.getY() + mPixelViewY);
- player_node->pathSetByMouse();
- }
- }
- else
-#endif
+ if (mLocalWalkTime != player_node->getActionTime())
{
- if (mLocalWalkTime != player_node->getActionTime())
+ mLocalWalkTime = cur_time;
+ player_node->unSetPickUpTarget();
+ int playerX = player_node->getTileX();
+ int playerY = player_node->getTileY();
+ if (mMouseDirectionMove)
{
- mLocalWalkTime = cur_time;
- player_node->unSetPickUpTarget();
- int playerX = player_node->getTileX();
- int playerY = player_node->getTileY();
- if (mMouseDirectionMove)
+ const int width = mainGraphics->mWidth / 2;
+ const int height = mainGraphics->mHeight / 2;
+ const float wh = static_cast<float>(width)
+ / static_cast<float>(height);
+ int x = event.getX() - width;
+ int y = event.getY() - height;
+ if (!x && !y)
+ return;
+ const int x2 = abs(x);
+ const int y2 = abs(y);
+ const float diff = 2;
+ int dx = 0;
+ int dy = 0;
+ if (x2 > y2)
{
- const int width = mainGraphics->mWidth / 2;
- const int height = mainGraphics->mHeight / 2;
- const float wh = static_cast<float>(width)
- / static_cast<float>(height);
- int x = event.getX() - width;
- int y = event.getY() - height;
- if (!x && !y)
- return;
- const int x2 = abs(x);
- const int y2 = abs(y);
- const float diff = 2;
- int dx = 0;
- int dy = 0;
- if (x2 > y2)
- {
- if (y2 && x2 / y2 / wh > diff)
- y = 0;
- }
- else
- {
- if (x2 && y2 * wh / x2 > diff)
- x = 0;
- }
- if (x > 0)
- dx = 1;
- else if (x < 0)
- dx = -1;
- if (y > 0)
- dy = 1;
- else if (y < 0)
- dy = -1;
-
- if (mMap->getWalk(playerX + dx, playerY + dy))
+ if (y2 && x2 / y2 / wh > diff)
+ y = 0;
+ }
+ else
+ {
+ if (x2 && y2 * wh / x2 > diff)
+ x = 0;
+ }
+ if (x > 0)
+ dx = 1;
+ else if (x < 0)
+ dx = -1;
+ if (y > 0)
+ dy = 1;
+ else if (y < 0)
+ dy = -1;
+
+ if (mMap->getWalk(playerX + dx, playerY + dy))
+ {
+ player_node->navigateTo(playerX + dx, playerY + dy);
+ }
+ else
+ {
+ if (dx && dy)
{
- player_node->navigateTo(playerX + dx, playerY + dy);
+ // try avoid diagonal collision
+ if (x2 > y2)
+ {
+ if (mMap->getWalk(playerX + dx, playerY))
+ dy = 0;
+ else
+ dx = 0;
+ }
+ else
+ {
+ if (mMap->getWalk(playerX, playerY + dy))
+ dx = 0;
+ else
+ dy = 0;
+ }
}
else
{
- if (dx && dy)
+ // try avoid vertical or horisontal collision
+ if (!dx)
{
- // try avoid diagonal collision
- if (x2 > y2)
- {
- if (mMap->getWalk(playerX + dx, playerY))
- dy = 0;
- else
- dx = 0;
- }
- else
- {
- if (mMap->getWalk(playerX, playerY + dy))
- dx = 0;
- else
- dy = 0;
- }
+ if (mMap->getWalk(playerX + 1, playerY + dy))
+ dx = 1;
+ if (mMap->getWalk(playerX - 1, playerY + dy))
+ dx = -1;
}
- else
+ if (!dy)
{
- // try avoid vertical or horisontal collision
- if (!dx)
- {
- if (mMap->getWalk(playerX + 1, playerY + dy))
- dx = 1;
- if (mMap->getWalk(playerX - 1, playerY + dy))
- dx = -1;
- }
- if (!dy)
- {
- if (mMap->getWalk(playerX + dx, playerY + 1))
- dy = 1;
- if (mMap->getWalk(playerX + dx, playerY - 1))
- dy = -1;
- }
+ if (mMap->getWalk(playerX + dx, playerY + 1))
+ dy = 1;
+ if (mMap->getWalk(playerX + dx, playerY - 1))
+ dy = -1;
}
- player_node->navigateTo(playerX + dx, playerY + dy);
}
+ player_node->navigateTo(playerX + dx, playerY + dy);
}
- else
+ }
+ else
+ {
+ const int destX = (event.getX() + mPixelViewX)
+ / static_cast<float>(mMap->getTileWidth());
+ const int destY = (event.getY() + mPixelViewY)
+ / static_cast<float>(mMap->getTileHeight());
+ if (playerX != destX || playerY != destY)
{
- const int destX = (event.getX() + mPixelViewX)
- / static_cast<float>(mMap->getTileWidth());
- const int destY = (event.getY() + mPixelViewY)
- / static_cast<float>(mMap->getTileHeight());
- if (playerX != destX || playerY != destY)
+ if (!player_node->navigateTo(destX, destY))
{
- if (!player_node->navigateTo(destX, destY))
- {
- if (playerX > destX)
- playerX --;
- else if (playerX < destX)
- playerX ++;
- if (playerY > destY)
- playerY --;
- else if (playerY < destY)
- playerY ++;
- if (mMap->getWalk(playerX, playerY, 0))
- player_node->navigateTo(playerX, playerY);
- }
+ if (playerX > destX)
+ playerX --;
+ else if (playerX < destX)
+ playerX ++;
+ if (playerY > destY)
+ playerY --;
+ else if (playerY < destY)
+ playerY ++;
+ if (mMap->getWalk(playerX, playerY, 0))
+ player_node->navigateTo(playerX, playerY);
}
}
}
@@ -688,7 +647,6 @@ void Viewport::mouseDragged(MouseEvent &event)
void Viewport::mouseReleased(MouseEvent &event A_UNUSED)
{
mPlayerFollowMouse = false;
- // Only useful for eAthena but doesn't hurt under ManaServ
mLocalWalkTime = -1;
}
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 40a5445ca..795f2ad5a 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -31,9 +31,6 @@
#include "gui/popups/textpopup.h"
#include "gui/windows/skilldialog.h"
-#ifdef MANASERV_SUPPORT
-#include "gui/specialswindow.h"
-#endif
#include "gui/widgets/button.h"
@@ -111,15 +108,6 @@ WindowMenu::WindowMenu(const Widget2 *const widget) :
_("Skills"), x, h, Input::KEY_WINDOW_SKILL);
}
-#ifdef MANASERV_SUPPORT
- if (Net::getNetworkType() == ServerInfo::MANASERV)
- {
- // TRANSLATORS: short button name for specials window.
- addButton(N_("SPE"),
- _("Specials"), x, h, Input::KEY_NO_VALUE);
- }
-#endif
-
// TRANSLATORS: short button name for social window.
addButton(N_("SOC"),
// TRANSLATORS: full button name
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index 4f98cb931..a877f45e0 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -325,11 +325,7 @@ void CharCreateDialog::action(const ActionEvent &event)
const std::string id = event.getId();
if (id == "create")
{
- if (
-#ifdef MANASERV_SUPPORT
- Net::getNetworkType() == ServerInfo::MANASERV ||
-#endif
- getName().length() >= 4)
+ if (getName().length() >= 4)
{
// Attempt to create the character
mCreateButton->setEnabled(false);
@@ -341,14 +337,7 @@ void CharCreateDialog::action(const ActionEvent &event)
mAttributeSlider[i]->getValue()));
}
-#ifdef MANASERV_SUPPORT
- int characterSlot = mSlot;
- // On Manaserv, the slots start at 1, so we offset them.
- if (Net::getNetworkType() == ServerInfo::MANASERV)
- ++characterSlot;
-#else
const int characterSlot = mSlot;
-#endif
Net::getCharServerHandler()->newCharacter(getName(), characterSlot,
mFemale->isSelected(), mHairStyle, mHairColor,
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index d67c15bf0..3ef378aa0 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -474,14 +474,7 @@ void CharSelectDialog::setCharacters(const Net::Characters &characters)
Net::Character *const character = *i;
// Slots Number start at 1 for Manaserv, so we offset them by one.
-#ifdef MANASERV_SUPPORT
- int characterSlot = character->slot;
- if (Net::getNetworkType() == ServerInfo::MANASERV && characterSlot > 0)
- --characterSlot;
-#else
const int characterSlot = character->slot;
-#endif
-
if (characterSlot >= static_cast<int>(mCharacterEntries.size()))
{
logger->log("Warning: slot out of range: %d", character->slot);
diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp
index e236841a5..c4e490091 100644
--- a/src/gui/windows/editserverdialog.cpp
+++ b/src/gui/windows/editserverdialog.cpp
@@ -139,21 +139,11 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent,
case ServerInfo::EATHENA:
mTypeField->setSelected(2);
break;
- case ServerInfo::MANASERV:
-#ifdef MANASERV_SUPPORT
- mTypeField->setSelected(3);
- break;
-#endif
-#else
- case ServerInfo::MANASERV:
-#ifdef MANASERV_SUPPORT
- mTypeField->setSelected(2);
- break;
-#endif
#endif
default:
case ServerInfo::UNKNOWN:
case ServerInfo::TMWATHENA:
+ case ServerInfo::MANASERV:
#ifndef EATHENA_SUPPORT
case ServerInfo::EATHENA:
#endif
@@ -226,17 +216,6 @@ void EditServerDialog::action(const ActionEvent &event)
case 2:
mServer.type = ServerInfo::EATHENA;
break;
-#ifdef MANASERV_SUPPORT
- case 3:
- mServer.type = ServerInfo::MANASERV;
- break;
-#endif
-#else
-#ifdef MANASERV_SUPPORT
- case 2:
- mServer.type = ServerInfo::MANASERV;
- break;
-#endif
#endif
default:
mServer.type = ServerInfo::UNKNOWN;
diff --git a/src/gui/windows/selldialog.cpp b/src/gui/windows/selldialog.cpp
index 524c77366..8bfcc6728 100644
--- a/src/gui/windows/selldialog.cpp
+++ b/src/gui/windows/selldialog.cpp
@@ -258,20 +258,10 @@ void SellDialog::action(const ActionEvent &event)
mMaxItems -= mAmountItems;
while (mAmountItems > 0)
{
-#ifdef MANASERV_SUPPORT
- // This order is important, item->getCurrentInvIndex() would
- // return the inventory index of the next Duplicate otherwise.
- int itemIndex = item->getCurrentInvIndex();
- const int sellCount = item->sellCurrentDuplicate(mAmountItems);
- // For Manaserv, the Item id is to be given as index.
- if ((Net::getNetworkType() == ServerInfo::MANASERV))
- itemIndex = item->getId();
-#else
// This order is important, item->getCurrentInvIndex() would
// return the inventory index of the next Duplicate otherwise.
const int itemIndex = item->getCurrentInvIndex();
const int sellCount = item->sellCurrentDuplicate(mAmountItems);
-#endif
Net::getNpcHandler()->sellItem(mNpcId, itemIndex, sellCount);
mAmountItems -= sellCount;
}
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index 579e9ad18..faae75ab3 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -63,20 +63,12 @@ static std::string serverTypeToString(const ServerInfo::Type type)
return "TmwAthena";
case ServerInfo::EVOL:
return "Evol";
-#ifdef EATHENA_SUPPORT
case ServerInfo::EATHENA:
+#ifdef EATHENA_SUPPORT
return "eAthena";
#endif
-#ifdef MANASERV_SUPPORT
- case ServerInfo::MANASERV:
- return "ManaServ";
-#else
- case ServerInfo::MANASERV:
-#endif
-#ifndef EATHENA_SUPPORT
- case ServerInfo::EATHENA:
-#endif
default:
+ case ServerInfo::MANASERV:
case ServerInfo::UNKNOWN:
return "";
}
@@ -90,20 +82,12 @@ static uint16_t defaultPortForServerType(const ServerInfo::Type type)
case ServerInfo::EATHENA:
#ifdef EATHENA_SUPPORT
return 6900;
-#else
- return 6901;
#endif
case ServerInfo::UNKNOWN:
case ServerInfo::TMWATHENA:
case ServerInfo::EVOL:
-#ifdef MANASERV_SUPPORT
- return 6901;
- case ServerInfo::MANASERV:
- return 9601;
-#else
case ServerInfo::MANASERV:
return 6901;
-#endif
}
}