summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-05-13 22:14:56 +0300
committerAndrei Karas <akaras@inbox.ru>2011-05-13 22:14:56 +0300
commit6b894220f3c029d256f7f15f41ecb2f635d25bde (patch)
treea8c9b891f3f0df44440def2ea755fcf7454ddb32
parentb4cd8029339cac3c577b67bd161b4dd3ab4f1530 (diff)
downloadManaVerse-6b894220f3c029d256f7f15f41ecb2f635d25bde.tar.gz
ManaVerse-6b894220f3c029d256f7f15f41ecb2f635d25bde.tar.bz2
ManaVerse-6b894220f3c029d256f7f15f41ecb2f635d25bde.tar.xz
ManaVerse-6b894220f3c029d256f7f15f41ecb2f635d25bde.zip
Add more MANASERV_SUPPORT defines to disable server type checks, if manaserv disabled.
Fix some compilation warnings.
-rw-r--r--src/being.cpp11
-rw-r--r--src/gui/serverdialog.cpp14
-rw-r--r--src/localplayer.cpp17
-rw-r--r--src/localplayer.h6
-rw-r--r--src/net/messagein.cpp2
-rw-r--r--src/net/net.cpp2
-rw-r--r--src/net/tmwa/playerhandler.cpp1
-rw-r--r--src/resources/monsterdb.cpp4
8 files changed, 50 insertions, 7 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 5e5fd3bdc..383d392f8 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -351,7 +351,9 @@ void Being::setPosition(const Vector &pos)
void Being::setDestination(int dstX, int dstY)
{
+#ifdef MANASERV_SUPPORT
if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+#endif
{
if (mMap)
setPath(mMap->findPath(mX, mY, dstX, dstY, getWalkMask()));
@@ -411,8 +413,12 @@ void Being::setPath(const Path &path)
if (mPath.empty())
return;
+#ifdef MANASERV_SUPPORT
if ((Net::getNetworkType() == ServerInfo::TMWATHENA) &&
mAction != MOVE && mAction != DEAD)
+#else
+ if (mAction != MOVE && mAction != DEAD)
+#endif
{
nextTile();
mActionTime = tick_time;
@@ -655,7 +661,9 @@ void Being::handleAttack(Being *victim, int damage,
else if (mInfo->getAttack(mAttackType))
fireMissile(victim, mInfo->getAttack(mAttackType)->missileParticle);
+#ifdef MANASERV_SUPPORT
if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+#endif
{
reset();
mActionTime = tick_time;
@@ -1194,8 +1202,8 @@ void Being::logic()
}
}
else
-#endif
if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+#endif
{
switch (mAction)
{
@@ -1203,6 +1211,7 @@ void Being::logic()
case SIT:
case DEAD:
case HURT:
+ case SPAWN:
default:
break;
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 48b364264..ca5711104 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -66,6 +66,8 @@ static std::string serverTypeToString(ServerInfo::Type type)
#ifdef MANASERV_SUPPORT
case ServerInfo::MANASERV:
return "ManaServ";
+#else
+ case ServerInfo::MANASERV:
#endif
default:
case ServerInfo::UNKNOWN:
@@ -80,10 +82,13 @@ static unsigned short defaultPortForServerType(ServerInfo::Type type)
default:
case ServerInfo::UNKNOWN:
case ServerInfo::TMWATHENA:
- return 6901;
#ifdef MANASERV_SUPPORT
+ return 6901;
case ServerInfo::MANASERV:
return 9601;
+#else
+ case ServerInfo::MANASERV:
+ return 6901;
#endif
}
}
@@ -481,13 +486,18 @@ void ServerDialog::valueChanged(const gcn::SelectionEvent &)
{
case ServerInfo::TMWATHENA:
case ServerInfo::UNKNOWN:
+#ifdef MANASERV_SUPPORT
default:
mTypeField->setSelected(0);
break;
-#ifdef MANASERV_SUPPORT
case ServerInfo::MANASERV:
mTypeField->setSelected(1);
break;
+#else
+ case ServerInfo::MANASERV:
+ default:
+ mTypeField->setSelected(0);
+ break;
#endif
}
}
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 0dea8ddac..ebd28e43c 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -769,9 +769,11 @@ Position LocalPlayer::getNextWalkPosition(unsigned char dir)
return Position(static_cast<int>(pos.x), static_cast<int>(pos.y));
}
-void LocalPlayer::nextTile(unsigned char dir = 0)
+void LocalPlayer::nextTile(unsigned char dir _UNUSED_ = 0)
{
+#ifdef MANASERV_SUPPORT
if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+#endif
{
// updatePos();
@@ -818,6 +820,7 @@ void LocalPlayer::nextTile(unsigned char dir = 0)
Being::nextTile();
}
+#ifdef MANASERV_SUPPORT
else
{
if (!mMap || !dir)
@@ -842,6 +845,7 @@ void LocalPlayer::nextTile(unsigned char dir = 0)
setDirection(dir);
}
}
+#endif
}
bool LocalPlayer::checkInviteRights(const std::string &guildName)
@@ -1118,7 +1122,9 @@ void LocalPlayer::startWalking(unsigned char dir)
if (dir & RIGHT)
dx++;
+#ifdef MANASERV_SUPPORT
if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+#endif
{
// Prevent skipping corners over colliding tiles
if (dx && !mMap->getWalk(getTileX() + dx, getTileY(), getWalkMask()))
@@ -1150,10 +1156,12 @@ void LocalPlayer::startWalking(unsigned char dir)
}
}
}
+#ifdef MANASERV_SUPPORT
else
{
nextTile(dir);
}
+#endif
}
void LocalPlayer::stopWalking(bool sendToServer)
@@ -1189,9 +1197,12 @@ bool LocalPlayer::toggleSit()
Being::Action newAction;
switch (mAction)
{
- case STAND: newAction = SIT;
+ case STAND:
+ case SPAWN:
+ newAction = SIT;
break;
- case SIT: newAction = STAND;
+ case SIT:
+ newAction = STAND;
break;
case MOVE:
case ATTACK:
diff --git a/src/localplayer.h b/src/localplayer.h
index 9cf0b9cfa..d3a166d85 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -36,6 +36,12 @@
#include <memory>
#include <vector>
+#ifdef __GNUC__
+#define _UNUSED_ __attribute__ ((unused))
+#else
+#define _UNUSED_
+#endif
+
class ChatTab;
class FloorItem;
class ImageSet;
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index 9ffc052f6..12d086207 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -115,7 +115,9 @@ void MessageIn::readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction)
direction = 9;
break;
case 8:
+#ifdef MANASERV_SUPPORT
if (Net::getNetworkType() == ServerInfo::TMWATHENA)
+#endif
{
direction = 8;
break;
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 7d530940a..052d65edc 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -160,8 +160,8 @@ void connectToServer(const ServerInfo &server)
switch (server.type)
{
-#ifdef MANASERV_SUPPORT
case ServerInfo::MANASERV:
+#ifdef MANASERV_SUPPORT
new ManaServ::GeneralHandler;
break;
#endif
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 5fb9d9508..4a9926cfd 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -731,6 +731,7 @@ void PlayerHandler::changeAction(Being::Action action)
case Being::ATTACK:
case Being::DEAD:
case Being::HURT:
+ case Being::SPAWN:
return;
}
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index 2f60cd307..75d268c43 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -59,8 +59,12 @@ void MonsterDB::load()
return;
}
+#ifdef MANASERV_SUPPORT
int offset = XML::getProperty(rootNode, "offset", Net::getNetworkType() ==
ServerInfo::TMWATHENA ? OLD_TMWATHENA_OFFSET : 0);
+#else
+ int offset = XML::getProperty(rootNode, "offset", OLD_TMWATHENA_OFFSET);
+#endif
//iterate <monster>s
for_each_xml_child_node(monsterNode, rootNode)