summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-05-19 02:24:20 +0300
committerAndrei Karas <akaras@inbox.ru>2011-05-19 02:24:20 +0300
commit886522371299b45254b7dc72e6de3070703d7c10 (patch)
tree738745eab76eb5f55a9adc08bfac10077b07efac /src
parent7cd309e7c9e0200cedb45edfeeba5a601d3fb446 (diff)
downloadplus-886522371299b45254b7dc72e6de3070703d7c10.tar.gz
plus-886522371299b45254b7dc72e6de3070703d7c10.tar.bz2
plus-886522371299b45254b7dc72e6de3070703d7c10.tar.xz
plus-886522371299b45254b7dc72e6de3070703d7c10.zip
Enable server type selection again. Add evol server type. Now working same as tmweathena.
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp8
-rw-r--r--src/client.cpp2
-rw-r--r--src/gui/serverdialog.cpp43
-rw-r--r--src/gui/skilldialog.cpp2
-rw-r--r--src/gui/viewport.cpp2
-rw-r--r--src/localplayer.cpp12
-rw-r--r--src/net/messagein.cpp2
-rw-r--r--src/net/net.cpp3
-rw-r--r--src/net/serverinfo.h5
-rw-r--r--src/resources/monsterdb.cpp4
10 files changed, 55 insertions, 28 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 688e838ee..6c0d3d679 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -352,7 +352,7 @@ void Being::setPosition(const Vector &pos)
void Being::setDestination(int dstX, int dstY)
{
#ifdef MANASERV_SUPPORT
- if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+ if (Net::getNetworkType() != ServerInfo::MANASERV)
#endif
{
if (mMap)
@@ -414,7 +414,7 @@ void Being::setPath(const Path &path)
return;
#ifdef MANASERV_SUPPORT
- if ((Net::getNetworkType() == ServerInfo::TMWATHENA) &&
+ if ((Net::getNetworkType() != ServerInfo::MANASERV) &&
mAction != MOVE && mAction != DEAD)
#else
if (mAction != MOVE && mAction != DEAD)
@@ -654,7 +654,7 @@ void Being::handleAttack(Being *victim, int damage,
fireMissile(victim, mInfo->getAttack(mAttackType)->missileParticle);
#ifdef MANASERV_SUPPORT
- if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+ if (Net::getNetworkType() != ServerInfo::MANASERV)
#endif
{
reset();
@@ -1194,7 +1194,7 @@ void Being::logic()
}
}
else
- if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+ if (Net::getNetworkType() != ServerInfo::MANASERV)
#endif
{
switch (mAction)
diff --git a/src/client.cpp b/src/client.cpp
index 2e44b94b3..a5028f790 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1019,7 +1019,7 @@ int Client::exec()
Net::getGameHandler()->connect();
mCurrentDialog = new ConnectionDialog(
_("Connecting to the game server"),
- Net::getNetworkType() == ServerInfo::TMWATHENA ?
+ Net::getNetworkType() != ServerInfo::MANASERV ?
STATE_CHOOSE_SERVER : STATE_SWITCH_CHARACTER);
break;
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index ca5711104..fca10c3c8 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -63,6 +63,8 @@ static std::string serverTypeToString(ServerInfo::Type type)
{
case ServerInfo::TMWATHENA:
return "TmwAthena";
+ case ServerInfo::EVOL:
+ return "Evol";
#ifdef MANASERV_SUPPORT
case ServerInfo::MANASERV:
return "ManaServ";
@@ -82,6 +84,7 @@ static unsigned short defaultPortForServerType(ServerInfo::Type type)
default:
case ServerInfo::UNKNOWN:
case ServerInfo::TMWATHENA:
+ case ServerInfo::EVOL:
#ifdef MANASERV_SUPPORT
return 6901;
case ServerInfo::MANASERV:
@@ -134,8 +137,10 @@ std::string TypeListModel::getElementAt(int elementIndex)
{
if (elementIndex == 0)
return "TmwAthena";
-#ifdef MANASERV_SUPPORT
else if (elementIndex == 1)
+ return "Evol";
+#ifdef MANASERV_SUPPORT
+ else if (elementIndex == 2)
return "ManaServ";
#endif
else
@@ -251,18 +256,26 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir):
ScrollArea *usedScroll = new ScrollArea(mServersList);
usedScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
-#ifdef MANASERV_SUPPORT
Label *typeLabel = new Label(_("Server type:"));
mTypeListModel = new TypeListModel();
mTypeField = new DropDown(mTypeListModel);
- mTypeField->setSelected((serverInfo->type == ServerInfo::MANASERV) ?
- 1 : 0);
- int n = 1;
-#else
- mTypeListModel = 0;
- mTypeField = 0;
- int n = 0;
+ switch (serverInfo->type)
+ {
+ case ServerInfo::MANASERV:
+#ifdef MANASERV_SUPPORT
+ mTypeField->setSelected(2);
+ break;
#endif
+ default:
+ case ServerInfo::UNKNOWN:
+ case ServerInfo::TMWATHENA:
+ mTypeField->setSelected(0);
+ break;
+ case ServerInfo::EVOL:
+ mTypeField->setSelected(1);
+ break;
+ }
+ int n = 1;
mDescription = new Label(std::string());
@@ -285,10 +298,8 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir):
place(1, 0, mServerNameField, 5).setPadding(3);
place(0, 1, portLabel);
place(1, 1, mPortField, 5).setPadding(3);
-#ifdef MANASERV_SUPPORT
place(0, 2, typeLabel);
place(1, 2, mTypeField, 5).setPadding(3);
-#endif
place(0, 2 + n, usedScroll, 6, 5).setPadding(3);
place(0, 7 + n, mDescription, 6);
place(0, 8 + n, mPersistentIPCheckBox, 6);
@@ -399,8 +410,11 @@ void ServerDialog::action(const gcn::ActionEvent &event)
case 0:
mServerInfo->type = ServerInfo::TMWATHENA;
break;
-#ifdef MANASERV_SUPPORT
case 1:
+ mServerInfo->type = ServerInfo::EVOL;
+ break;
+#ifdef MANASERV_SUPPORT
+ case 2:
mServerInfo->type = ServerInfo::MANASERV;
break;
#endif
@@ -491,7 +505,7 @@ void ServerDialog::valueChanged(const gcn::SelectionEvent &)
mTypeField->setSelected(0);
break;
case ServerInfo::MANASERV:
- mTypeField->setSelected(1);
+ mTypeField->setSelected(2);
break;
#else
case ServerInfo::MANASERV:
@@ -499,6 +513,9 @@ void ServerDialog::valueChanged(const gcn::SelectionEvent &)
mTypeField->setSelected(0);
break;
#endif
+ case ServerInfo::EVOL:
+ mTypeField->setSelected(1);
+ break;
}
}
setFieldsReadOnly(true);
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index fe2325ab8..a58a3e169 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -335,7 +335,7 @@ void SkillDialog::loadSkills(const std::string &file)
{
logger->log("Error loading skills file: %s", file.c_str());
- if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+ if (Net::getNetworkType() != ServerInfo::MANASERV)
{
SkillModel *model = new SkillModel();
if (!mDefaultModel)
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 1298a9744..e399d96ce 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -337,7 +337,7 @@ void Viewport::_drawPath(Graphics *graphics, const Path &path,
graphics->setColor(color);
#ifdef MANASERV_SUPPORT
- if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+ if (Net::getNetworkType() != ServerInfo::MANASERV)
#endif
{
for (Path::const_iterator i = path.begin(); i != path.end(); ++i)
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index ebd28e43c..2a3048a3d 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -772,7 +772,7 @@ Position LocalPlayer::getNextWalkPosition(unsigned char dir)
void LocalPlayer::nextTile(unsigned char dir _UNUSED_ = 0)
{
#ifdef MANASERV_SUPPORT
- if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+ if (Net::getNetworkType() != ServerInfo::MANASERV)
#endif
{
// updatePos();
@@ -1028,7 +1028,7 @@ void LocalPlayer::setDestination(int x, int y)
// If the destination given to being class is accepted,
// we inform the Server.
if ((x == mDest.x && y == mDest.y)
- || Net::getNetworkType() == ServerInfo::TMWATHENA)
+ || Net::getNetworkType() != ServerInfo::MANASERV)
#endif
{
Net::getPlayerHandler()->setDestination(x, y, mDirection);
@@ -1123,7 +1123,7 @@ void LocalPlayer::startWalking(unsigned char dir)
dx++;
#ifdef MANASERV_SUPPORT
- if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+ if (Net::getNetworkType() != ServerInfo::MANASERV)
#endif
{
// Prevent skipping corners over colliding tiles
@@ -1333,7 +1333,11 @@ void LocalPlayer::attack(Being *target, bool keep, bool dontChangeEquipment)
changeEquipmentBeforeAttack(target);
Net::getPlayerHandler()->attack(target->getId(), mServerAttack);
- if ((Net::getNetworkType() == ServerInfo::TMWATHENA) && !keep)
+#ifdef MANASERV_SUPPORT
+ if ((Net::getNetworkType() != ServerInfo::MANASERV) && !keep)
+#else
+ if (!keep)
+#endif
stopAttack();
}
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index 12d086207..9b76c76fa 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -116,7 +116,7 @@ void MessageIn::readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction)
break;
case 8:
#ifdef MANASERV_SUPPORT
- if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+ if (Net::getNetworkType() != ServerInfo::MANASERV)
#endif
{
direction = 8;
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 052d65edc..ca26415a6 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -160,6 +160,9 @@ void connectToServer(const ServerInfo &server)
switch (server.type)
{
+ case ServerInfo::EVOL:
+ new TmwAthena::GeneralHandler;
+ break;
case ServerInfo::MANASERV:
#ifdef MANASERV_SUPPORT
new ManaServ::GeneralHandler;
diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h
index 2e8d63a6e..eb07f766e 100644
--- a/src/net/serverinfo.h
+++ b/src/net/serverinfo.h
@@ -35,7 +35,8 @@ public:
{
UNKNOWN = 0,
MANASERV,
- TMWATHENA
+ TMWATHENA,
+ EVOL
};
typedef std::pair<int, std::string> VersionString;
@@ -103,6 +104,8 @@ public:
{
if (compareStrI(type, "tmwathena") == 0)
return TMWATHENA;
+ if (compareStrI(type, "evol") == 0)
+ return EVOL;
// Used for backward compatibility
else if (compareStrI(type, "eathena") == 0)
return TMWATHENA;
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index 75d268c43..fbd7d10ad 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -60,8 +60,8 @@ void MonsterDB::load()
}
#ifdef MANASERV_SUPPORT
- int offset = XML::getProperty(rootNode, "offset", Net::getNetworkType() ==
- ServerInfo::TMWATHENA ? OLD_TMWATHENA_OFFSET : 0);
+ int offset = XML::getProperty(rootNode, "offset", Net::getNetworkType() !=
+ ServerInfo::MANASERV ? OLD_TMWATHENA_OFFSET : 0);
#else
int offset = XML::getProperty(rootNode, "offset", OLD_TMWATHENA_OFFSET);
#endif