diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-04-25 18:38:52 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-04-25 18:38:52 +0300 |
commit | 3d447679df26179b7ffa781c34f5277e6a1aec29 (patch) | |
tree | 242365d32770a89448130684ad7ed2bf00c22561 /src | |
parent | 8c8f9f6cf53a6d5b8d9d72f4860921b3325a7696 (diff) | |
download | ManaVerse-3d447679df26179b7ffa781c34f5277e6a1aec29.tar.gz ManaVerse-3d447679df26179b7ffa781c34f5277e6a1aec29.tar.bz2 ManaVerse-3d447679df26179b7ffa781c34f5277e6a1aec29.tar.xz ManaVerse-3d447679df26179b7ffa781c34f5277e6a1aec29.zip |
Dont compile manaserv related code if manaserv support disabled.
Diffstat (limited to 'src')
-rw-r--r-- | src/actorsprite.cpp | 4 | ||||
-rw-r--r-- | src/being.cpp | 8 | ||||
-rw-r--r-- | src/flooritem.cpp | 4 | ||||
-rw-r--r-- | src/gui/charcreatedialog.cpp | 9 | ||||
-rw-r--r-- | src/gui/charselectdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/sell.cpp | 2 | ||||
-rw-r--r-- | src/gui/serverdialog.cpp | 8 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 7 | ||||
-rw-r--r-- | src/gui/windowmenu.cpp | 2 | ||||
-rw-r--r-- | src/localplayer.cpp | 24 |
10 files changed, 64 insertions, 6 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp index d87156285..aa288e377 100644 --- a/src/actorsprite.cpp +++ b/src/actorsprite.cpp @@ -79,8 +79,12 @@ bool ActorSprite::draw(Graphics *graphics, int offsetX, int offsetY) const // best where their base point should be. const int px = getPixelX() + offsetX - 16; // Temporary fix to the Y offset. +#ifdef MANASERV_SUPPORT const int py = getPixelY() + offsetY - ((Net::getNetworkType() == ServerInfo::MANASERV) ? 15 : 32); +#else + const int py = getPixelY() + offsetY - 32; +#endif if (mUsedTargetCursor) { diff --git a/src/being.cpp b/src/being.cpp index bfd06f2f0..3a7f08dda 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -893,6 +893,7 @@ void Being::setAction(Action action, int attackType _UNUSED_) currentAction = mInfo->getAttack(attackType)->action; reset(); +#ifdef MANASERV_SUPPORT if (Net::getNetworkType() == ServerInfo::MANASERV && mInfo->getAttack(attackType)) { @@ -920,6 +921,7 @@ void Being::setAction(Action action, int attackType _UNUSED_) } } } +#endif } break; @@ -1082,6 +1084,7 @@ void Being::logic() } int frameCount = static_cast<int>(getFrameCount()); +#ifdef MANASERV_SUPPORT if ((Net::getNetworkType() == ServerInfo::MANASERV) && (mAction != DEAD)) { const Vector dest = (mPath.empty()) ? @@ -1163,9 +1166,10 @@ void Being::logic() setAction(STAND); } } - else if (Net::getNetworkType() == ServerInfo::TMWATHENA) + else +#endif + if (Net::getNetworkType() == ServerInfo::TMWATHENA) { - switch (mAction) { case STAND: diff --git a/src/flooritem.cpp b/src/flooritem.cpp index 30458b579..150e020a9 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -63,8 +63,12 @@ FloorItem::FloorItem(int id, // these translations aren't necessary anymore. The sprites know // best where their base point should be. mPos.x = static_cast<float>(x * map->getTileWidth() + 16); +#ifdef MANASERV_SUPPORT mPos.y = static_cast<float>(y * map->getTileHeight() + ((Net::getNetworkType() == ServerInfo::MANASERV) ? 15 : 32)); +#else + mPos.y = static_cast<float>(y * map->getTileHeight() + 32); +#endif } else { diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 973273e95..914e29f3c 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -185,8 +185,11 @@ void CharCreateDialog::action(const gcn::ActionEvent &event) { if (event.getId() == "create") { - if (Net::getNetworkType() == ServerInfo::MANASERV - || getName().length() >= 4) + if ( +#ifdef MANASERV_SUPPORT + Net::getNetworkType() == ServerInfo::MANASERV || +#endif + getName().length() >= 4) { // Attempt to create the character mCreateButton->setEnabled(false); @@ -199,9 +202,11 @@ void CharCreateDialog::action(const gcn::ActionEvent &event) } int characterSlot = mSlot; +#ifdef MANASERV_SUPPORT // On Manaserv, the slots start at 1, so we offset them. if (Net::getNetworkType() == ServerInfo::MANASERV) ++characterSlot; +#endif Net::getCharHandler()->newCharacter(getName(), characterSlot, mFemale->isSelected(), mHairStyle, mHairColor, mRace, atts); diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 54638f793..3179085cc 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -295,8 +295,10 @@ void CharSelectDialog::setCharacters(const Net::Characters &characters) // Slots Number start at 1 for Manaserv, so we offset them by one. int characterSlot = character->slot; +#ifdef MANASERV_SUPPORT if (Net::getNetworkType() == ServerInfo::MANASERV && characterSlot > 0) --characterSlot; +#endif if (characterSlot >= static_cast<int>(mCharacterEntries.size())) { diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index de1da395c..1a1fa60e0 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -222,9 +222,11 @@ void SellDialog::action(const gcn::ActionEvent &event) itemIndex = item->getCurrentInvIndex(); sellCount = item->sellCurrentDuplicate(mAmountItems); +#ifdef MANASERV_SUPPORT // For Manaserv, the Item id is to be given as index. if ((Net::getNetworkType() == ServerInfo::MANASERV)) itemIndex = item->getId(); +#endif Net::getNpcHandler()->sellItem(mNpcId, itemIndex, sellCount); mAmountItems -= sellCount; diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 45ec907fb..e0d0a1e41 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -63,8 +63,10 @@ static std::string serverTypeToString(ServerInfo::Type type) { case ServerInfo::TMWATHENA: return "TmwAthena"; +#ifdef MANASERV_SUPPORT case ServerInfo::MANASERV: return "ManaServ"; +#endif default: case ServerInfo::UNKNOWN: return ""; @@ -79,8 +81,10 @@ static unsigned short defaultPortForServerType(ServerInfo::Type type) case ServerInfo::UNKNOWN: case ServerInfo::TMWATHENA: return 6901; +#ifdef MANASERV_SUPPORT case ServerInfo::MANASERV: return 9601; +#endif } } @@ -390,9 +394,11 @@ void ServerDialog::action(const gcn::ActionEvent &event) case 0: mServerInfo->type = ServerInfo::TMWATHENA; break; +#ifdef MANASERV_SUPPORT case 1: mServerInfo->type = ServerInfo::MANASERV; break; +#endif default: mServerInfo->type = ServerInfo::UNKNOWN; } @@ -478,9 +484,11 @@ void ServerDialog::valueChanged(const gcn::SelectionEvent &) default: mTypeField->setSelected(0); break; +#ifdef MANASERV_SUPPORT case ServerInfo::MANASERV: mTypeField->setSelected(1); break; +#endif } } setFieldsReadOnly(true); diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index e34dd658a..9688c818a 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -304,6 +304,7 @@ void Viewport::_drawDebugPath(Graphics *graphics) _drawPath(graphics, debugPath); } +#ifdef MANASERV_SUPPORT else if (Net::getNetworkType() == ServerInfo::MANASERV) { const Vector &playerPos = player_node->getPosition(); @@ -330,6 +331,7 @@ void Viewport::_drawDebugPath(Graphics *graphics) // But also the one currently walked on. _drawPath(graphics, player_node->getPath(), gcn::Color(0, 0, 255)); } +#endif } void Viewport::_drawPath(Graphics *graphics, const Path &path, @@ -353,6 +355,7 @@ void Viewport::_drawPath(Graphics *graphics, const Path &path, } } } +#ifdef MANASERV_SUPPORT else if (Net::getNetworkType() == ServerInfo::MANASERV) { for (Path::const_iterator i = path.begin(); i != path.end(); ++i) @@ -369,8 +372,8 @@ void Viewport::_drawPath(Graphics *graphics, const Path &path, squareX + 4, squareY + 12, gcn::Graphics::CENTER); } } - } +#endif } void Viewport::mousePressed(gcn::MouseEvent &event) @@ -505,6 +508,7 @@ void Viewport::mouseDragged(gcn::MouseEvent &event) if (mPlayerFollowMouse && !event.isShiftPressed()) { +#ifdef MANASERV_SUPPORT if (Net::getNetworkType() == ServerInfo::MANASERV) { if (get_elapsed_time(mLocalWalkTime) >= walkingMouseDelay) @@ -519,6 +523,7 @@ void Viewport::mouseDragged(gcn::MouseEvent &event) } } else +#endif { if (mLocalWalkTime != player_node->getActionTime()) { diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 2947779c7..5a7b700d7 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -79,11 +79,13 @@ WindowMenu::WindowMenu(): KeyboardConfig::KEY_WINDOW_SKILL); } +#ifdef MANASERV_SUPPORT if (Net::getNetworkType() == ServerInfo::MANASERV) { addButton(N_("SPE"), _("Specials"), x, h, KeyboardConfig::KEY_NO_VALUE); } +#endif addButton(N_("SOC"), _("Social"), x, h, KeyboardConfig::KEY_WINDOW_SOCIAL); addButton(N_("SH"), _("Shortcuts"), x, h, diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 803101243..de6eef334 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -298,6 +298,7 @@ void LocalPlayer::logic() { // Find whether target is in range // TODO: Make this nicer, probably using getPosition() only +#ifdef MANASERV_SUPPORT const int rangeX = (Net::getNetworkType() == ServerInfo::MANASERV) ? static_cast<int>(abs(static_cast<int>(mTarget->getPosition().x @@ -308,7 +309,12 @@ void LocalPlayer::logic() static_cast<int>(abs(static_cast<int>(mTarget->getPosition().y - getPosition().y))) : static_cast<int>(abs(mTarget->getTileY() - getTileY())); - +#else + const int rangeX = static_cast<int>( + abs(mTarget->getTileX() - getTileX())); + const int rangeY = static_cast<int>( + abs(mTarget->getTileY() - getTileY())); +#endif const int attackRange = getAttackRange(); const TargetCursorType targetType = rangeX > attackRange || rangeY > attackRange ? @@ -889,6 +895,7 @@ bool LocalPlayer::pickUp(FloorItem *item) } else if (mPickUpType >= 4 && mPickUpType <= 6) { +#ifdef MANASERV_SUPPORT if (Net::getNetworkType() == ServerInfo::MANASERV) { setDestination(item->getPixelX() + 16, item->getPixelY() + 16); @@ -896,6 +903,7 @@ bool LocalPlayer::pickUp(FloorItem *item) mPickUpTarget->addActorSpriteListener(this); } else +#endif { const Vector &playerPos = getPosition(); Path debugPath = mMap->findPath( @@ -1028,6 +1036,7 @@ void LocalPlayer::setWalkingDir(unsigned char dir) { // This function is called by Game::handleInput() +#ifdef MANASERV_SUPPORT if (Net::getNetworkType() == ServerInfo::MANASERV) { // First if player is pressing key for the direction he is already @@ -1054,6 +1063,7 @@ void LocalPlayer::setWalkingDir(unsigned char dir) if (get_elapsed_time(mLocalWalkTime) < walkingKeyboardDelay) return; } +#endif mWalkingDir = dir; @@ -1062,11 +1072,13 @@ void LocalPlayer::setWalkingDir(unsigned char dir) { startWalking(dir); } +#ifdef MANASERV_SUPPORT else if (mAction == MOVE && (Net::getNetworkType() == ServerInfo::MANASERV)) { nextTile(dir); } +#endif } void LocalPlayer::startWalking(unsigned char dir) @@ -1080,6 +1092,7 @@ void LocalPlayer::startWalking(unsigned char dir) if (mAction == MOVE && !mPath.empty()) { // Just finish the current action, otherwise we get out of sync +#ifdef MANASERV_SUPPORT if (Net::getNetworkType() == ServerInfo::MANASERV) { const Vector &pos = getPosition(); @@ -1087,6 +1100,7 @@ void LocalPlayer::startWalking(unsigned char dir) static_cast<int>(pos.y)); } else +#endif { Being::setDestination(getTileX(), getTileY()); } @@ -1210,6 +1224,7 @@ bool LocalPlayer::emote(Uint8 emotion) void LocalPlayer::attack(Being *target, bool keep, bool dontChangeEquipment) { +#ifdef MANASERV_SUPPORT if (Net::getNetworkType() == ServerInfo::MANASERV) { if (mLastAction != -1) @@ -1219,6 +1234,7 @@ void LocalPlayer::attack(Being *target, bool keep, bool dontChangeEquipment) if (mAction != STAND && mAction != ATTACK) return; } +#endif mKeepAttacking = keep; @@ -1231,6 +1247,7 @@ void LocalPlayer::attack(Being *target, bool keep, bool dontChangeEquipment) setTarget(target); } +#ifdef MANASERV_SUPPORT if (Net::getNetworkType() == ServerInfo::MANASERV) { Vector plaPos = this->getPosition(); @@ -1256,6 +1273,7 @@ void LocalPlayer::attack(Being *target, bool keep, bool dontChangeEquipment) mLastAction = tick_time; } else +#endif { int dist_x = target->getTileX() - getTileX(); int dist_y = target->getTileY() - getTileY(); @@ -1435,6 +1453,7 @@ bool LocalPlayer::withinAttackRange(Being *target, bool fixDistance, if (fixDistance && range == 1) range = 2; +#ifdef MANASERV_SUPPORT if (Net::getNetworkType() == ServerInfo::MANASERV) { const Vector &targetPos = target->getPosition(); @@ -1444,6 +1463,7 @@ bool LocalPlayer::withinAttackRange(Being *target, bool fixDistance, } else +#endif { dx = static_cast<int>(abs(target->getTileX() - getTileX())); dy = static_cast<int>(abs(target->getTileY() - getTileY())); @@ -1459,6 +1479,7 @@ void LocalPlayer::setGotoTarget(Being *target) return; mPickUpTarget = 0; +#ifdef MANASERV_SUPPORT if (Net::getNetworkType() == ServerInfo::MANASERV) { mTarget = target; @@ -1468,6 +1489,7 @@ void LocalPlayer::setGotoTarget(Being *target) static_cast<int>(targetPos.y)); } else +#endif { setTarget(target); mGoingToTarget = true; |