From 683da50e37fbbb2e3f70a4421a06dabd9bb912d8 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Sun, 1 Jan 2012 20:20:21 +0100 Subject: player_node -> local_player Reviewed-by: Ablu --- src/actorsprite.cpp | 6 ++-- src/actorspritemanager.cpp | 18 +++++------ src/being.cpp | 34 ++++++++++----------- src/client.cpp | 4 +-- src/commandhandler.cpp | 14 ++++----- src/emoteshortcut.cpp | 2 +- src/game.cpp | 62 +++++++++++++++++++------------------- src/gui/chat.cpp | 6 ++-- src/gui/equipmentwindow.cpp | 2 +- src/gui/minimap.cpp | 4 +-- src/gui/ministatus.cpp | 2 +- src/gui/popupmenu.cpp | 14 ++++----- src/gui/setup_interface.cpp | 8 ++--- src/gui/socialwindow.cpp | 6 ++-- src/gui/specialswindow.cpp | 2 +- src/gui/statuswindow.cpp | 2 +- src/gui/viewport.cpp | 40 ++++++++++++------------ src/gui/widgets/chattab.cpp | 2 +- src/gui/widgets/whispertab.cpp | 2 +- src/localplayer.cpp | 8 ++--- src/localplayer.h | 2 +- src/net/manaserv/beinghandler.cpp | 10 +++--- src/net/manaserv/charhandler.cpp | 2 +- src/net/manaserv/chathandler.cpp | 4 +-- src/net/manaserv/gamehandler.cpp | 2 +- src/net/manaserv/guildhandler.cpp | 10 +++--- src/net/manaserv/partyhandler.cpp | 8 ++--- src/net/manaserv/playerhandler.cpp | 14 ++++----- src/net/tmwa/beinghandler.cpp | 14 ++++----- src/net/tmwa/charserverhandler.cpp | 10 +++--- src/net/tmwa/chathandler.cpp | 6 ++-- src/net/tmwa/gamehandler.cpp | 6 ++-- src/net/tmwa/gui/partytab.cpp | 2 +- src/net/tmwa/guildhandler.cpp | 2 +- src/net/tmwa/inventoryhandler.cpp | 10 +++--- src/net/tmwa/npchandler.cpp | 4 +-- src/net/tmwa/partyhandler.cpp | 6 ++-- src/net/tmwa/playerhandler.cpp | 26 ++++++++-------- src/sound.cpp | 4 +-- 39 files changed, 190 insertions(+), 190 deletions(-) (limited to 'src') diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp index 17e6b3d2..b36f0d36 100644 --- a/src/actorsprite.cpp +++ b/src/actorsprite.cpp @@ -240,7 +240,7 @@ void ActorSprite::setStatusEffectBlock(int offset, uint16_t newEffects) void ActorSprite::internalTriggerEffect(int effectId, bool sfx, bool gfx) { logger->log("Special effect #%d on %s", effectId, - getId() == player_node->getId() ? "self" : "other"); + getId() == local_player->getId() ? "self" : "other"); EffectDescription *ed = getEffectDescription(effectId); @@ -264,7 +264,7 @@ void ActorSprite::internalTriggerEffect(int effectId, bool sfx, bool gfx) void ActorSprite::updateStunMode(int oldMode, int newMode) { - if (this == player_node) + if (this == local_player) { Event event(Event::Stun); event.setInt("oldMode", oldMode); @@ -278,7 +278,7 @@ void ActorSprite::updateStunMode(int oldMode, int newMode) void ActorSprite::updateStatusEffect(int index, bool newStatus) { - if (this == player_node) + if (this == local_player) { Event event(Event::UpdateStatusEffect); event.setInt("index", index); diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index fedf880c..82e14de0 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -112,13 +112,13 @@ void ActorSpriteManager::setMap(Map *map) { mMap = map; - if (player_node) - player_node->setMap(map); + if (local_player) + local_player->setMap(map); } void ActorSpriteManager::setPlayer(LocalPlayer *player) { - player_node = player; + local_player = player; mActors.insert(player); } @@ -140,7 +140,7 @@ FloorItem *ActorSpriteManager::createItem(int id, int itemId, const Vector &pos) void ActorSpriteManager::destroy(ActorSprite *actor) { - if (!actor || actor == player_node) + if (!actor || actor == local_player) return; mDeleteActors.insert(actor); @@ -184,7 +184,7 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y) const int uptol = being->getHeight(); if ((being->isAlive()) && - (being != player_node) && + (being != local_player) && (being->getPixelX() - xtol <= x) && (being->getPixelX() + xtol >= x) && (being->getPixelY() - uptol <= y) && @@ -261,16 +261,16 @@ void ActorSpriteManager::logic() void ActorSpriteManager::clear() { - if (player_node) - mActors.erase(player_node); + if (local_player) + mActors.erase(local_player); for_actors delete *it; mActors.clear(); mDeleteActors.clear(); - if (player_node) - mActors.insert(player_node); + if (local_player) + mActors.insert(local_player); } Being *ActorSpriteManager::findNearestLivingBeing(int x, int y, diff --git a/src/being.cpp b/src/being.cpp index 5af437de..887be37c 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -319,7 +319,7 @@ void Being::takeDamage(Being *attacker, int amount, // Selecting the right color if (type == CRITICAL || type == FLEE) { - if (attacker == player_node) + if (attacker == local_player) { color = &userPalette->getColor( UserPalette::HIT_LOCAL_PLAYER_CRITICAL); @@ -331,7 +331,7 @@ void Being::takeDamage(Being *attacker, int amount, } else if (!amount) { - if (attacker == player_node) + if (attacker == local_player) { // This is intended to be the wrong direction to visually // differentiate between hits and misses @@ -344,7 +344,7 @@ void Being::takeDamage(Being *attacker, int amount, } else if (getType() == MONSTER) { - if (attacker == player_node) + if (attacker == local_player) { color = &userPalette->getColor( UserPalette::HIT_LOCAL_PLAYER_MONSTER); @@ -426,7 +426,7 @@ void Being::handleAttack(Being *victim, int damage, int attackId) // TODO: Add attack type handling, see Attack struct and AttackType // and make use of it by grouping attacks per attack type and add random // attack use on tA, based on normal and critical attack types. - if (this != player_node) + if (this != local_player) setAction(Being::ATTACK, attackId); if (victim) @@ -493,7 +493,7 @@ void Being::addGuild(Guild *guild) mGuilds[guild->getId()] = guild; guild->addMember(mId, mName); - if (this == player_node && socialWindow) + if (this == local_player && socialWindow) { socialWindow->addTab(guild); } @@ -501,7 +501,7 @@ void Being::addGuild(Guild *guild) void Being::removeGuild(int id) { - if (this == player_node && socialWindow) + if (this == local_player && socialWindow) { socialWindow->removeTab(mGuilds[id]); } @@ -544,7 +544,7 @@ void Being::clearGuilds() { Guild *guild = itr->second; - if (this == player_node && socialWindow) + if (this == local_player && socialWindow) socialWindow->removeTab(guild); guild->removeMember(mId); @@ -568,7 +568,7 @@ void Being::setParty(Party *party) updateColors(); - if (this == player_node && socialWindow) + if (this == local_player && socialWindow) { if (old) socialWindow->removeTab(old); @@ -851,11 +851,11 @@ void Being::logic() // by LocalPlayer::startWalking(), we shouldn't get // in the way here for other cases. // Hence, we set the direction in Being::logic() only when: - // 1. It is not the localPlayer - // 2. When it is the localPlayer but only by mouse + // 1. It is not the local_player + // 2. When it is the local_player but only by mouse // (because in that case, the path can have more than one tile.) - if ((player_node == this && player_node->isPathSetByMouse()) - || player_node != this) + if ((local_player == this && local_player->isPathSetByMouse()) + || local_player != this) { int direction = 0; const float dx = std::abs(dir.x); @@ -984,8 +984,8 @@ void Being::showName() } // Display the IP when under tmw-Athena (GM only). - if (Net::getNetworkType() == ServerInfo::TMWATHENA && player_node - && player_node->getShowIp() && player->getIp()) + if (Net::getNetworkType() == ServerInfo::TMWATHENA && local_player + && local_player->getShowIp() && player->getIp()) { mDisplayName += strprintf(" %s", ipToString(player->getIp())); } @@ -1000,7 +1000,7 @@ void Being::showName() } gcn::Font *font = 0; - if (player_node && player_node->getTarget() == this + if (local_player && local_player->getTarget() == this && getType() != MONSTER) { font = boldFont; @@ -1024,7 +1024,7 @@ void Being::updateColors() mNameColor = &userPalette->getColor(UserPalette::NPC); mTextColor = &userPalette->getColor(UserPalette::NPC); } - else if (this == player_node) + else if (this == local_player) { mNameColor = &userPalette->getColor(UserPalette::SELF); mTextColor = &Theme::getThemeColor(Theme::PLAYER); @@ -1038,7 +1038,7 @@ void Being::updateColors() mTextColor = &userPalette->getColor(UserPalette::GM); mNameColor = &userPalette->getColor(UserPalette::GM); } - else if (mParty && mParty == player_node->getParty()) + else if (mParty && mParty == local_player->getParty()) { mNameColor = &userPalette->getColor(UserPalette::PARTY); } diff --git a/src/client.cpp b/src/client.cpp index 2d4ac8cc..aa3991c0 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -848,8 +848,8 @@ int Client::exec() case STATE_GAME: logger->log("Memorizing selected character %s", - player_node->getName().c_str()); - config.setValue("lastCharacter", player_node->getName()); + local_player->getName().c_str()); + config.setValue("lastCharacter", local_player->getName()); // Fade out logon-music here too to give the desired effect // of "flowing" into the game. diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 25067fca..33584ed4 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -339,8 +339,8 @@ void CommandHandler::handleWhere(const std::string &args, ChatTab *tab) { std::ostringstream where; where << Game::instance()->getCurrentMapName() << ", coordinates: " - << player_node->getTileX() << ", " - << player_node->getTileY(); + << local_player->getTileX() << ", " + << local_player->getTileY(); tab->chatLog(where.str(), BY_SERVER); } @@ -385,7 +385,7 @@ void CommandHandler::handleMsg(const std::string &args, ChatTab *tab) if (msg.length() > 0) { - std::string playerName = player_node->getName(); + std::string playerName = local_player->getName(); std::string tempNick = recvnick; toLower(playerName); @@ -501,7 +501,7 @@ void CommandHandler::handleShowIp(const std::string &args, ChatTab *tab) { if (args.empty()) { - tab->chatLog(player_node->getShowIp() ? + tab->chatLog(local_player->getShowIp() ? _("Show IP: On") : _("Show IP: Off")); return; } @@ -512,11 +512,11 @@ void CommandHandler::handleShowIp(const std::string &args, ChatTab *tab) { case 0: tab->chatLog(_("Show IP: Off")); - player_node->setShowIp(false); + local_player->setShowIp(false); break; case 1: tab->chatLog(_("Show IP: On")); - player_node->setShowIp(true); + local_player->setShowIp(true); break; case -1: tab->chatLog(strprintf(BOOLEAN_OPTIONS, "showip")); @@ -577,5 +577,5 @@ void CommandHandler::handleUnignore(const std::string &args, ChatTab *tab) void CommandHandler::handleAway(const std::string &args, ChatTab *tab) { - player_node->setAway(args); + local_player->setAway(args); } diff --git a/src/emoteshortcut.cpp b/src/emoteshortcut.cpp index 175b34c3..fe8c929c 100644 --- a/src/emoteshortcut.cpp +++ b/src/emoteshortcut.cpp @@ -63,7 +63,7 @@ void EmoteShortcut::useEmote(int index) { if (mEmotes[index - 1] > 0) { - player_node->emote(mEmotes[index - 1]); + local_player->emote(mEmotes[index - 1]); } } } diff --git a/src/game.cpp b/src/game.cpp index 226d275a..7a887fb2 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -232,7 +232,7 @@ Game::Game(): initEngines(); // Initialize beings - actorSpriteManager->setPlayer(player_node); + actorSpriteManager->setPlayer(local_player); Joystick::init(); // TODO: The user should be able to choose which one to use @@ -255,7 +255,7 @@ Game::~Game() del_0(actorSpriteManager) if (Client::getState() != STATE_CHANGE_MAP) - del_0(player_node) + del_0(local_player) del_0(channelManager) del_0(commandHandler) del_0(joystick) @@ -273,10 +273,10 @@ static bool saveScreenshot() static unsigned int screenshotCount = 0; // We don't want to show IP addresses in screenshots - const bool showip = player_node->getShowIp(); + const bool showip = local_player->getShowIp(); if (showip) { - player_node->setShowIp(false); + local_player->setShowIp(false); actorSpriteManager->updatePlayerNames(); gui->draw(); } @@ -285,7 +285,7 @@ static bool saveScreenshot() if (showip) { - player_node->setShowIp(true); + local_player->setShowIp(true); actorSpriteManager->updatePlayerNames(); } @@ -374,8 +374,8 @@ void Game::logic() */ static void handleItemPickUp() { - int x = player_node->getTileX(); - int y = player_node->getTileY(); + int x = local_player->getTileX(); + int y = local_player->getTileY(); // Let's look for items around until you find one. bool found = false; @@ -387,12 +387,12 @@ static void handleItemPickUp() if (item) { found = true; - player_node->pickUp(item); + local_player->pickUp(item); // We found it, so set the player // direction accordingly, - player_node->lookAt( - player_node->getMap()->getTileCenter(xX, yY)); + local_player->lookAt( + local_player->getMap()->getTileCenter(xX, yY)); // Get out of the loops break; @@ -652,7 +652,7 @@ void Game::handleInput() break; case KeyboardConfig::KEY_SIT: // Player sit action - player_node->toggleSit(); + local_player->toggleSit(); used = true; break; case KeyboardConfig::KEY_HIDE_WINDOWS: @@ -766,7 +766,7 @@ void Game::handleInput() return; // Moving player around - if (player_node->isAlive() && !PlayerInfo::isTalking() && + if (local_player->isAlive() && !PlayerInfo::isTalking() && !chatWindow->isInputFocused() && !quitDialog && !TextDialog::isActive()) { // Get the state of the keyboard keys @@ -808,24 +808,24 @@ void Game::handleInput() if (keyboard.isKeyActive(keyboard.KEY_EMOTE) && direction != 0) { - if (player_node->getDirection() != direction) + if (local_player->getDirection() != direction) { - player_node->setDirection(direction); + local_player->setDirection(direction); Net::getPlayerHandler()->setDirection(direction); } direction = 0; } else { - player_node->setWalkingDir(direction); + local_player->setWalkingDir(direction); } // Attacking monsters if (keyboard.isKeyActive(keyboard.KEY_ATTACK) || (joystick && joystick->buttonPressed(0))) { - if (player_node->getTarget()) - player_node->attack(player_node->getTarget(), true); + if (local_player->getTarget()) + local_player->attack(local_player->getTarget(), true); } if (keyboard.isKeyActive(keyboard.KEY_TARGET_ATTACK)) @@ -834,13 +834,13 @@ void Game::handleInput() bool newTarget = !keyboard.isKeyActive(keyboard.KEY_TARGET); // A set target has highest priority - if (!player_node->getTarget()) + if (!local_player->getTarget()) { // Only auto target Monsters - target = actorSpriteManager->findNearestLivingBeing(player_node, + target = actorSpriteManager->findNearestLivingBeing(local_player, 20, ActorSprite::MONSTER); } - player_node->attack(target, newTarget); + local_player->attack(target, newTarget); } // Target the nearest player/monster/npc @@ -859,13 +859,13 @@ void Game::handleInput() else if (keyboard.isKeyActive(keyboard.KEY_TARGET_NPC)) currentTarget = ActorSprite::NPC; - Being *target = actorSpriteManager->findNearestLivingBeing(player_node, + Being *target = actorSpriteManager->findNearestLivingBeing(local_player, 20, currentTarget); - if (target && (target != player_node->getTarget() || + if (target && (target != local_player->getTarget() || currentTarget != mLastTarget)) { - player_node->setTarget(target); + local_player->setTarget(target); mLastTarget = currentTarget; } } @@ -878,7 +878,7 @@ void Game::handleInput() if (event.type == SDL_KEYDOWN && keyboard.getKeyIndex(event.key.keysym.sym) == KeyboardConfig::KEY_TALK) { - Being *target = player_node->getTarget(); + Being *target = local_player->getTarget(); if (target) { @@ -891,24 +891,24 @@ void Game::handleInput() if (!keyboard.isKeyActive(keyboard.KEY_ATTACK) && keyboard.isKeyActive(keyboard.KEY_TARGET)) { - player_node->stopAttack(); + local_player->stopAttack(); } if (joystick) { if (joystick->buttonPressed(1)) { - const int x = player_node->getTileX(); - const int y = player_node->getTileY(); + const int x = local_player->getTileX(); + const int y = local_player->getTileY(); FloorItem *item = actorSpriteManager->findItem(x, y); if (item) - player_node->pickUp(item); + local_player->pickUp(item); } else if (joystick->buttonPressed(2)) { - player_node->toggleSit(); + local_player->toggleSit(); } } } @@ -929,8 +929,8 @@ void Game::changeMap(const std::string &mapPath) // Unset the map of the player so that its particles are cleared before // being deleted in the next step - if (player_node) - player_node->setMap(0); + if (local_player) + local_player->setMap(0); particleEngine->clear(); diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 0e75bda3..92386e76 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -472,7 +472,7 @@ void ChatWindow::whisper(const std::string &nick, if (mes.empty()) return; - std::string playerName = player_node->getName(); + std::string playerName = local_player->getName(); std::string tempNick = nick; toLower(playerName); @@ -502,7 +502,7 @@ void ChatWindow::whisper(const std::string &nick, else { tab->chatLog(nick, mes); - player_node->afkRespond(tab, nick); + local_player->afkRespond(tab, nick); } } else @@ -523,7 +523,7 @@ void ChatWindow::whisper(const std::string &nick, ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo) { - std::string playerName = player_node->getName(); + std::string playerName = local_player->getName(); std::string tempNick = nick; toLower(playerName); diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 4e8eae4d..df723fd4 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -63,7 +63,7 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment): // Control that shows the Player PlayerBox *playerBox = new PlayerBox; playerBox->setDimension(gcn::Rectangle(50, 80, 74, 123)); - playerBox->setPlayer(player_node); + playerBox->setPlayer(local_player); setWindowName("Equipment"); setCloseButton(true); diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 6ee416f5..ff282164 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -166,7 +166,7 @@ void Minimap::draw(gcn::Graphics *graphics) if (mMapImage->getWidth() > a.width || mMapImage->getHeight() > a.height) { - const Vector &p = player_node->getPosition(); + const Vector &p = local_player->getPosition(); mapOriginX = (int) (((a.width) / 2) - (int) (p.x * mWidthProportion) / mMap->getTileWidth()); mapOriginY = (int) (((a.height) / 2) @@ -203,7 +203,7 @@ void Minimap::draw(gcn::Graphics *graphics) int type = UserPalette::PC; - if (being == player_node) + if (being == local_player) { type = UserPalette::SELF; dotSize = 3; diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp index f3a8b807..2bdf79b4 100644 --- a/src/gui/ministatus.cpp +++ b/src/gui/ministatus.cpp @@ -207,7 +207,7 @@ void MiniStatusWindow::logic() if (config.getValue("xpBarMonsterCounterExp", 0)!=0) { updatedText << " | " - << (int)(((float)player_node->mXpForNextLevel - (float)player_node->mXp) + << (int)(((float)local_player->mXpForNextLevel - (float)local_player->mXp) / (float)config.getValue("xpBarMonsterCounterExp", 0)) << " " << config.getValue("xpBarMonsterCounterName", "Monsters") <<" left..."; diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index fbe3c739..742d480d 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -126,11 +126,11 @@ void PopupMenu::showPopup(int x, int y, Being *being) break; } - if (player_node->getNumberOfGuilds()) + if (local_player->getNumberOfGuilds()) mBrowserBox->addRow(strprintf("@@guild|%s@@", strprintf(_("Invite %s to join your guild"), name.c_str()).c_str())); - if (player_node->isInParty() || + if (local_player->isInParty() || Net::getNetworkType() == ServerInfo::MANASERV) { mBrowserBox->addRow(strprintf("@@party|%s@@", @@ -138,7 +138,7 @@ void PopupMenu::showPopup(int x, int y, Being *being) name.c_str()).c_str())); } - if (player_node->isGM()) + if (local_player->isGM()) { mBrowserBox->addRow("##3---"); mBrowserBox->addRow(strprintf("@@admin-kick|%s@@", @@ -162,7 +162,7 @@ void PopupMenu::showPopup(int x, int y, Being *being) strprintf(_("Attack %s"), name.c_str()).c_str())); - if (player_node->isGM()) + if (local_player->isGM()) mBrowserBox->addRow(strprintf("@@admin-kick|%s@@", _("Kick monster"))); } @@ -220,7 +220,7 @@ void PopupMenu::handleLink(const std::string &link) // Attack action else if (link == "attack" && being) { - player_node->attack(being, true); + local_player->attack(being, true); } else if (link == "whisper" && being) { @@ -253,13 +253,13 @@ void PopupMenu::handleLink(const std::string &link) else if (link == "guild" && being && being->getType() == ActorSprite::PLAYER) { - player_node->inviteToGuild(being); + local_player->inviteToGuild(being); } // Pick Up Floor Item action else if ((link == "pickup") && mFloorItem) { - player_node->pickUp(mFloorItem); + local_player->pickUp(mFloorItem); } // Look To action diff --git a/src/gui/setup_interface.cpp b/src/gui/setup_interface.cpp index 5eefe6d5..be69048d 100644 --- a/src/gui/setup_interface.cpp +++ b/src/gui/setup_interface.cpp @@ -230,8 +230,8 @@ void Setup_Interface::cancel() config.setValue("visiblenames", mVisibleNamesEnabled); config.setValue("speech", mSpeechMode); config.setValue("showownname", mNameEnabled); - if (player_node) - player_node->setCheckNameSetting(true); + if (local_player) + local_player->setCheckNameSetting(true); config.setValue("logNpcInGui", mNPCLogEnabled); config.setValue("guialpha", mOpacity); config.setValue("showpickupchat", mPickupChatEnabled); @@ -274,8 +274,8 @@ void Setup_Interface::action(const gcn::ActionEvent &event) { // Notify the local player that settings have changed for the name // and requires an update - if (player_node) - player_node->setCheckNameSetting(true); + if (local_player) + local_player->setCheckNameSetting(true); config.setValue("showownname", mNameCheckBox->isSelected()); } else if (id == "lognpc") diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index 1aa57f2f..2ed7c14c 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -341,9 +341,9 @@ SocialWindow::SocialWindow() : mCreatePopup = new CreatePopup(); - if (player_node->getParty()) + if (local_player->getParty()) { - addTab(player_node->getParty()); + addTab(local_player->getParty()); } else updateButtons(); @@ -614,7 +614,7 @@ void SocialWindow::showPartyInvite(const std::string &inviter, void SocialWindow::showPartyCreate() { - if (player_node->getParty()) + if (local_player->getParty()) { new OkDialog(_("Create Party"), _("Cannot create party. You are already in a party"), diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp index b511e4a3..0f146fa2 100644 --- a/src/gui/specialswindow.cpp +++ b/src/gui/specialswindow.cpp @@ -106,7 +106,7 @@ void SpecialsWindow::action(const gcn::ActionEvent &event) if (disp) { - /*Being *target = player_node->getTarget(); + /*Being *target = local_player->getTarget(); if (target) Net::getSpecialHandler()->use(disp->mInfo->id, 1, target->getId()); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 822dec3e..dbad01a7 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -94,7 +94,7 @@ class ChangeDisplay : public AttrDisplay, gcn::ActionListener }; StatusWindow::StatusWindow(): - Window(player_node->getName()) + Window(local_player->getName()) { listen(Event::AttributesChannel); diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 1fa60808..453f615e 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -97,7 +97,7 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) { static int lastTick = tick_time; - if (!mMap || !player_node) + if (!mMap || !local_player) { gcnGraphics->setColor(gcn::Color(64, 64, 64)); gcnGraphics->fillRectangle( @@ -117,7 +117,7 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) int midTileX = (graphics->getWidth() + mScrollCenterOffsetX) / 2; int midTileY = (graphics->getHeight() + mScrollCenterOffsetX) / 2; - const Vector &playerPos = player_node->getPosition(); + const Vector &playerPos = local_player->getPosition(); const int player_x = (int) playerPos.x - midTileX; const int player_y = (int) playerPos.y - midTileY; @@ -211,10 +211,10 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) } } - if (player_node->getCheckNameSetting()) + if (local_player->getCheckNameSetting()) { - player_node->setCheckNameSetting(false); - player_node->setName(player_node->getName()); + local_player->setCheckNameSetting(false); + local_player->setName(local_player->getName()); } // Draw text @@ -320,7 +320,7 @@ void Viewport::_drawDebugPath(Graphics *graphics) if (mouseDestination.x != lastMouseDestination.x || mouseDestination.y != lastMouseDestination.y) { - const Vector &playerPos = player_node->getPosition(); + const Vector &playerPos = local_player->getPosition(); // Adapt the path finding to the precision requested if (Net::getPlayerHandler()->usePixelPrecision()) @@ -329,7 +329,7 @@ void Viewport::_drawDebugPath(Graphics *graphics) (int) playerPos.y, mouseDestination.x, mouseDestination.y, - player_node->getCollisionRadius(), + local_player->getCollisionRadius(), walkMask); } else @@ -414,7 +414,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) return; // Check if we are alive and kickin' - if (!mMap || !player_node || !player_node->isAlive()) + if (!mMap || !local_player || !local_player->isAlive()) return; // Check if we are busy @@ -436,7 +436,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) // Right click might open a popup if (event.getButton() == gcn::MouseEvent::RIGHT) { - if (mHoverBeing && mHoverBeing != player_node) + if (mHoverBeing && mHoverBeing != local_player) { mPopupMenu->showPopup(event.getX(), event.getY(), mHoverBeing); return; @@ -468,28 +468,28 @@ void Viewport::mousePressed(gcn::MouseEvent &event) // Ignore it if its dead if (mHoverBeing->isAlive()) { - if (player_node->withinAttackRange(mHoverBeing) || + if (local_player->withinAttackRange(mHoverBeing) || keyboard.isKeyActive(keyboard.KEY_ATTACK)) - player_node->attack(mHoverBeing, + local_player->attack(mHoverBeing, !keyboard.isKeyActive(keyboard.KEY_TARGET)); else - player_node->setGotoTarget(mHoverBeing); + local_player->setGotoTarget(mHoverBeing); } } // Picks up a item if we clicked on one } else if (mHoverItem) { - player_node->pickUp(mHoverItem); + local_player->pickUp(mHoverItem); } - else if (player_node->getCurrentAction() == Being::SIT) + else if (local_player->getCurrentAction() == Being::SIT) { return; } // Just walk around else { - player_node->stopAttack(); + local_player->stopAttack(); mPlayerFollowMouse = true; // Make the player go to the mouse position @@ -503,13 +503,13 @@ void Viewport::mousePressed(gcn::MouseEvent &event) pixelX, pixelY, 20, ActorSprite::MONSTER); if (target) - player_node->setTarget(target); + local_player->setTarget(target); } } void Viewport::mouseDragged(gcn::MouseEvent &event) { - if (!mMap || !player_node) + if (!mMap || !local_player) return; if (mPlayerFollowMouse && !event.isShiftPressed()) @@ -517,9 +517,9 @@ void Viewport::mouseDragged(gcn::MouseEvent &event) if (get_elapsed_time(mLocalWalkTime) >= walkingMouseDelay) { mLocalWalkTime = tick_time; - player_node->setDestination(event.getX() + (int) mPixelViewX, + local_player->setDestination(event.getX() + (int) mPixelViewX, event.getY() + (int) mPixelViewY); - player_node->pathSetByMouse(); + local_player->pathSetByMouse(); } } } @@ -543,7 +543,7 @@ void Viewport::closePopupMenu() void Viewport::mouseMoved(gcn::MouseEvent &event) { // Check if we are on the map - if (!mMap || !player_node) + if (!mMap || !local_player) return; const int x = (event.getX() + (int) mPixelViewX); diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index bd4c5910..20aadfb7 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -246,7 +246,7 @@ void ChatTab::chatLog(std::string line, Own own, bool ignoreRecord) void ChatTab::chatLog(const std::string &nick, const std::string &msg) { chatLog(nick + " : " + msg, - nick == player_node->getName() ? BY_PLAYER : BY_OTHER, + nick == local_player->getName() ? BY_PLAYER : BY_OTHER, false); } diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index 864f1f51..c3674c54 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -56,7 +56,7 @@ void WhisperTab::handleInput(const std::string &msg) Net::getChatHandler()->privateMessage(mNick, msg); - chatLog(player_node->getName(), msg); + chatLog(local_player->getName(), msg); } void WhisperTab::handleCommand(const std::string &msg) diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 0ee35ebe..4bbb8dc5 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -60,7 +60,7 @@ #define AWAY_LIMIT_TIMER 60 -LocalPlayer *player_node = NULL; +LocalPlayer *local_player = NULL; LocalPlayer::LocalPlayer(int id, int subtype): Being(id, PLAYER, subtype, 0), @@ -727,7 +727,7 @@ void LocalPlayer::setWalkingDir(int dir) // been pressing, stop (do not send this stop to the server) and // start in the new direction if (dir && (dir != getWalkingDir())) - player_node->stopWalking(false); + local_player->stopWalking(false); // Else, he is not pressing a key, // and the current path hasn't been sent by mouse, @@ -1118,8 +1118,8 @@ void LocalPlayer::afkRespond(ChatTab *tab, const std::string &nick) void AwayListener::action(const gcn::ActionEvent &event) { - if (event.getId() == "ok" && player_node->getAwayMode()) + if (event.getId() == "ok" && local_player->getAwayMode()) { - player_node->changeAwayMode(); + local_player->changeAwayMode(); } } diff --git a/src/localplayer.h b/src/localplayer.h index ae27e51e..e3849126 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -275,6 +275,6 @@ class LocalPlayer : public Being bool mAwayMode; }; -extern LocalPlayer *player_node; +extern LocalPlayer *local_player; #endif // LOCALPLAYER_H diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp index 91c7d621..3e635d43 100644 --- a/src/net/manaserv/beinghandler.cpp +++ b/src/net/manaserv/beinghandler.cpp @@ -132,9 +132,9 @@ void BeingHandler::handleBeingEnterMessage(Net::MessageIn &msg) case OBJECT_CHARACTER: { std::string name = msg.readString(); - if (player_node->getName() == name) + if (local_player->getName() == name) { - being = player_node; + being = local_player; being->setId(id); } else @@ -222,7 +222,7 @@ void BeingHandler::handleBeingsMoveMessage(Net::MessageIn &msg) } // Ignore messages from the server for the local player - if (being == player_node) + if (being == local_player) continue; // If the position differs too much from the actual one, we resync @@ -294,7 +294,7 @@ void BeingHandler::handleBeingActionChangeMessage(Net::MessageIn &msg) being->setAction(action); - if (action == Being::DEAD && being == player_node) + if (action == Being::DEAD && being == local_player) { static char const *const deadMsg[] = { @@ -346,7 +346,7 @@ void BeingHandler::handleBeingDirChangeMessage(Net::MessageIn &msg) int data = msg.readInt8(); // The direction for the player's character is handled on client side. - if (being != player_node) + if (being != local_player) being->setDirection((BeingDirection) data); } diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp index 5017d6ea..8a072d26 100644 --- a/src/net/manaserv/charhandler.cpp +++ b/src/net/manaserv/charhandler.cpp @@ -252,7 +252,7 @@ void CharHandler::handleCharacterSelectResponse(Net::MessageIn &msg) chatServer.port); // Prevent the selected local player from being deleted - player_node = mSelectedCharacter->dummy; + local_player = mSelectedCharacter->dummy; PlayerInfo::setBackend(mSelectedCharacter->data); mSelectedCharacter->dummy = 0; diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp index b6749e7c..c3a9c964 100644 --- a/src/net/manaserv/chathandler.cpp +++ b/src/net/manaserv/chathandler.cpp @@ -43,7 +43,7 @@ #include #include -extern Being *player_node; +extern Being *local_player; extern Net::ChatHandler *chatHandler; @@ -165,7 +165,7 @@ void ChatHandler::handleGameChatMessage(Net::MessageIn &msg) std::string mes = being->getName() + " : " + chatMsg; - Event event(being == player_node ? Event::Player + Event event(being == local_player ? Event::Player : Event::Being); event.setString("message", mes); event.setString("text", chatMsg); diff --git a/src/net/manaserv/gamehandler.cpp b/src/net/manaserv/gamehandler.cpp index e9c2442a..99326be4 100644 --- a/src/net/manaserv/gamehandler.cpp +++ b/src/net/manaserv/gamehandler.cpp @@ -137,7 +137,7 @@ void GameHandler::gameLoading() // Attack range from item DB // TODO: Deharcode it through equipment handling - player_node->setAttackRange(48); + local_player->setAttackRange(48); } } // namespace ManaServ diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp index a2c571bc..1e656d87 100644 --- a/src/net/manaserv/guildhandler.cpp +++ b/src/net/manaserv/guildhandler.cpp @@ -119,7 +119,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) GuildMember *member; short guildId = msg.readInt16(); - guild = player_node->getGuild(guildId); + guild = local_player->getGuild(guildId); if (!guild) return; @@ -147,7 +147,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) char eventId = msg.readInt8(); GuildMember *member; - Guild *guild = player_node->getGuild(guildId); + Guild *guild = local_player->getGuild(guildId); if (guild) { switch(eventId) @@ -226,12 +226,12 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) // Must remove tab first, as it wont find the guild // name after its removed from the player int guildId = msg.readInt16(); - Guild *guild = player_node->getGuild(guildId); + Guild *guild = local_player->getGuild(guildId); if (guild) { Channel *channel = channelManager->findByName(guild->getName()); channelManager->removeChannel(channel); - player_node->removeGuild(guildId); + local_player->removeGuild(guildId); } } } break; @@ -250,7 +250,7 @@ void GuildHandler::joinedGuild(Net::MessageIn &msg) Guild *guild = Guild::getGuild(guildId); guild->setName(guildName); guild->setRights(permissions); - player_node->addGuild(guild); + local_player->addGuild(guild); Net::getGuildHandler()->memberList(guildId); // Automatically create the guild channel diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp index e1bcb624..ee2c7055 100644 --- a/src/net/manaserv/partyhandler.cpp +++ b/src/net/manaserv/partyhandler.cpp @@ -87,7 +87,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg) switch (msg.readInt8()) { case ERRMSG_OK: - player_node->setParty(mParty); + local_player->setParty(mParty); while (msg.getUnreadLength()) { std::string name = msg.readString(); @@ -113,7 +113,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg) if (msg.readInt8() == ERRMSG_OK) { mParty->clearMembers(); - player_node->setParty(NULL); + local_player->setParty(NULL); } } break; @@ -128,8 +128,8 @@ void PartyHandler::handleMessage(Net::MessageIn &msg) SERVER_NOTICE(strprintf(_("%s joined the party%s."), name.c_str(), s.c_str())); - if (name == player_node->getName()) - player_node->setParty(mParty); + if (name == local_player->getName()) + local_player->setParty(mParty); mParty->addMember(0, name); } break; diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp index d7c3dab6..43af40f5 100644 --- a/src/net/manaserv/playerhandler.cpp +++ b/src/net/manaserv/playerhandler.cpp @@ -105,7 +105,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) gameServerConnection->disconnect(); Client::setState(STATE_CHANGE_MAP); - player_node->setMap(0); + local_player->setMap(0); } break; case GPMSG_PLAYER_ATTRIBUTE_CHANGE: @@ -154,7 +154,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) paths.getStringValue("particles") + paths.getStringValue("levelUpEffectFile") ,0, 0); - player_node->controlParticle(effect); + local_player->controlParticle(effect); } break; @@ -291,7 +291,7 @@ void PlayerHandler::handleMapChangeMessage(Net::MessageIn &msg) // Switch the actual map, deleting the previous one game->changeMap(mapName); - const Vector &playerPos = player_node->getPosition(); + const Vector &playerPos = local_player->getPosition(); float scrollOffsetX = 0.0f; float scrollOffsetY = 0.0f; @@ -304,9 +304,9 @@ void PlayerHandler::handleMapChangeMessage(Net::MessageIn &msg) scrollOffsetY = y - (int) playerPos.y; } - player_node->setAction(Being::STAND); - player_node->setPosition(x, y); - player_node->setDestination(x, y); + local_player->setAction(Being::STAND); + local_player->setPosition(x, y); + local_player->setDestination(x, y); logger->log("Adjust scrolling by %d,%d", (int) scrollOffsetX, (int) scrollOffsetY); @@ -373,7 +373,7 @@ void PlayerHandler::setDestination(int x, int y, int /* direction */) void PlayerHandler::changeAction(Being::Action action) { - player_node->setAction(action); + local_player->setAction(action); MessageOut msg(PGMSG_ACTION_CHANGE); msg.writeInt8(action); diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 41345acb..e3e92a0b 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -318,8 +318,8 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) break; // If this is player's current target, clear it. - if (dstBeing == player_node->getTarget()) - player_node->stopAttack(); + if (dstBeing == local_player->getTarget()) + local_player->stopAttack(); if (msg.readInt8() == 1) dstBeing->setAction(Being::DEAD); @@ -336,8 +336,8 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) break; // If this is player's current target, clear it. - if (dstBeing == player_node->getTarget()) - player_node->stopAttack(); + if (dstBeing == local_player->getTarget()) + local_player->stopAttack(); if (msg.readInt8() == 1) dstBeing->setAction(Being::STAND); @@ -356,7 +356,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) msg.readInt16(); // Skill level msg.readInt16(); // Div msg.readInt8(); // Skill hit/type (?) - if (attackSpeed && srcBeing && srcBeing != player_node) + if (attackSpeed && srcBeing && srcBeing != local_player) srcBeing->setAttackSpeed(attackSpeed); if (dstBeing) dstBeing->takeDamage(srcBeing, param1, Being::HIT); // Perhaps a new skill attack type should be created and used? @@ -566,7 +566,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) break; } - if (Party *party = player_node->getParty()){ + if (Party *party = local_player->getParty()){ if (party->isMember(id)) { dstBeing->setParty(party); @@ -674,7 +674,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) */ id = msg.readInt32(); - if (mSync || id != player_node->getId()) + if (mSync || id != local_player->getId()) { dstBeing = actorSpriteManager->findBeing(id); if (dstBeing) diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 2b7d5381..83682efe 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -153,13 +153,13 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg) case SMSG_CHAR_MAP_INFO: { - msg.skip(4); // CharID, must be the same as player_node->charID + msg.skip(4); // CharID, must be the same as local_player->charID GameHandler *gh = static_cast(Net::getGameHandler()); gh->setMap(msg.readString(16)); mapServer.hostname = ipToString(msg.readInt32()); mapServer.port = msg.readInt16(); - player_node = mSelectedCharacter->dummy; + local_player = mSelectedCharacter->dummy; PlayerInfo::setBackend(mSelectedCharacter->data); // Prevent the selected local player from being deleted @@ -185,12 +185,12 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg) mNetwork->disconnect(); Client::setState(STATE_CHANGE_MAP); - Map *map = player_node->getMap(); + Map *map = local_player->getMap(); const int tileWidth = map->getTileWidth(); const int tileHeight = map->getTileHeight(); - player_node->setPosition(Vector(x * tileWidth + tileWidth / 2, + local_player->setPosition(Vector(x * tileWidth + tileWidth / 2, y * tileHeight + tileHeight / 2)); - player_node->setMap(0); + local_player->setMap(0); } break; } diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 97304c28..e1c6c6ea 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -208,8 +208,8 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) Event event(Event::Player); event.setString("message", mes); event.setString("text", chatMsg); - event.setString("nick", player_node->getName()); - event.setInt("beingId", player_node->getId()); + event.setString("nick", local_player->getName()); + event.setInt("beingId", local_player->getId()); event.setInt("permissions", player_relations.getDefault() & (PlayerRelation::SPEECH_LOG | PlayerRelation::SPEECH_FLOAT)); @@ -234,7 +234,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) void ChatHandler::talk(const std::string &text) { - std::string mes = player_node->getName() + " : " + text; + std::string mes = local_player->getName() + " : " + text; MessageOut outMsg(CMSG_CHAT_MESSAGE); // Added + 1 in order to let eAthena parse admin commands correctly diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 6430b476..9e2c6fa4 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -113,7 +113,7 @@ void GameHandler::event(Event::Channel channel, const Event &event) const int tileHeight = map->getTileHeight(); if (mTileX && mTileY) { - player_node->setPosition(Vector(mTileX * tileWidth + tileWidth / 2, + local_player->setPosition(Vector(mTileX * tileWidth + tileWidth / 2, mTileY * tileHeight + tileHeight / 2)); mTileX = mTileY = 0; } @@ -135,9 +135,9 @@ void GameHandler::connect() if (Client::getState() == STATE_CONNECT_GAME) { - mCharID = player_node->getId(); + mCharID = local_player->getId(); // Change the player's ID to the account ID to match what eAthena uses - player_node->setId(token.account_ID); + local_player->setId(token.account_ID); } // Send login infos diff --git a/src/net/tmwa/gui/partytab.cpp b/src/net/tmwa/gui/partytab.cpp index 6833831c..660a0a59 100644 --- a/src/net/tmwa/gui/partytab.cpp +++ b/src/net/tmwa/gui/partytab.cpp @@ -200,7 +200,7 @@ bool PartyTab::handleCommand(const std::string &type, const std::string &args) void PartyTab::getAutoCompleteList(std::vector &names) const { - Party *p = player_node->getParty(); + Party *p = local_player->getParty(); if (p) p->getNames(names); diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 00167d61..ade11c9a 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -425,7 +425,7 @@ void GuildHandler::leave(int guildId) MessageOut msg(CMSG_GUILD_LEAVE); msg.writeInt32(guildId); msg.writeInt32(0); // Account ID - msg.writeInt32(player_node->getId()); + msg.writeInt32(local_player->getId()); msg.writeString("", 30); // Message } diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 76eb85f5..191266bc 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -230,11 +230,11 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) unsigned char err = msg.readInt8(); if (err) { - player_node->pickedUp(itemInfo, 0, err); + local_player->pickedUp(itemInfo, 0, err); } else { - player_node->pickedUp(itemInfo, amount, PICKUP_OKAY); + local_player->pickedUp(itemInfo, amount, PICKUP_OKAY); Item *item = inventory->getItem(index); @@ -420,7 +420,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) { mEquips.setEquipment(getSlot(equipType), -1); // Reset the attack range to unarmed. - player_node->setAttackRange(ATTACK_RANGE_NOT_SET); + local_player->setAttackRange(ATTACK_RANGE_NOT_SET); } break; @@ -430,14 +430,14 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) Map *map = Game::instance()->getCurrentMap(); if (map) { - player_node->setAttackRange(msg.readInt16() + local_player->setAttackRange(msg.readInt16() * map->getTileWidth()); } else { logger->log("Couldn't set attacke range due to the lack" "of an initialized map."); - player_node->setAttackRange(ATTACK_RANGE_NOT_SET); + local_player->setAttackRange(ATTACK_RANGE_NOT_SET); } } break; diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 904fe388..3a50b6d4 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -125,8 +125,8 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) delete event; - if (player_node->getCurrentAction() != Being::SIT) - player_node->setAction(Being::STAND); + if (local_player->getCurrentAction() != Being::SIT) + local_player->setAction(Being::STAND); } void NpcHandler::startShopping(int beingId) diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index 2cfc2037..47182121 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -104,7 +104,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg) member->setOnline(online); } - player_node->setParty(taParty); + local_player->setParty(taParty); } break; case SMSG_PARTY_INVITE_RESPONSE: @@ -229,7 +229,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg) int id = msg.readInt32(); std::string nick = msg.readString(24); msg.readInt8(); // fail - if (id == player_node->getId()) + if (id == local_player->getId()) { taParty->removeFromMembers(); taParty->clearMembers(); @@ -344,7 +344,7 @@ void PartyHandler::invite(const std::string &name) void PartyHandler::inviteResponse(const std::string &inviter, bool accept) { MessageOut outMsg(CMSG_PARTY_INVITED); - outMsg.writeInt32(player_node->getId()); + outMsg.writeInt32(local_player->getId()); outMsg.writeInt32(accept ? 1 : 0); } diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index a6f80d0b..ad27a868 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -161,7 +161,7 @@ PlayerHandler::PlayerHandler() void PlayerHandler::handleMessage(Net::MessageIn &msg) { - if (!player_node) + if (!local_player) return; switch (msg.getId()) @@ -186,7 +186,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) * We must clear the local player's target *before* the call * to changeMap, as it deletes all beings. */ - player_node->stopAttack(); + local_player->stopAttack(); Game *game = Game::instance(); @@ -202,8 +202,8 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) /* Scroll if necessary */ Map *map = game->getCurrentMap(); - int tileX = player_node->getTileX(); - int tileY = player_node->getTileY(); + int tileX = local_player->getTileX(); + int tileY = local_player->getTileY(); if (!sameMap || (abs(x - tileX) > MAP_TELEPORT_SCROLL_DISTANCE) || (abs(y - tileY) > MAP_TELEPORT_SCROLL_DISTANCE)) @@ -212,11 +212,11 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) scrollOffsetY = (y - tileY) * map->getTileHeight(); } - player_node->setAction(Being::STAND); + local_player->setAction(Being::STAND); Vector pos = map->getTileCenter(x, y); - player_node->setPosition(pos); + local_player->setPosition(pos); // Stop movement - player_node->setDestination(pos.x, pos.y); + local_player->setDestination(pos.x, pos.y); logger->log("Adjust scrolling by %d:%d", (int) scrollOffsetX, (int) scrollOffsetY); @@ -227,7 +227,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) case SMSG_PLAYER_STAT_UPDATE_1: { - if (!player_node) + if (!local_player) break; int type = msg.readInt16(); int value = msg.readInt32(); @@ -235,7 +235,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) switch (type) { case 0x0000: - player_node->setMoveSpeed(Vector(value / 10, + local_player->setMoveSpeed(Vector(value / 10, value / 10, 0)); break; case 0x0004: break; // manner @@ -281,11 +281,11 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) case 0x0034: PlayerInfo::setStatBase(CRIT, value); break; - case 0x0035: player_node->setAttackSpeed(value); break; + case 0x0035: local_player->setAttackSpeed(value); break; case 0x0037: PlayerInfo::setStatBase(JOB, value); break; - case 500: player_node->setGMLevel(value); break; + case 500: local_player->setGMLevel(value); break; } if (PlayerInfo::getAttribute(HP) == 0 && !deathNotice) @@ -295,7 +295,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) randomDeathMessage(), false); deathNotice->addActionListener(&deathListener); - player_node->setAction(Being::DEAD); + local_player->setAction(Being::DEAD); } } @@ -329,7 +329,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) Units::formatCurrency(newMoney - oldMoney).c_str())) if (config.getBoolValue("showpickupparticle")) - player_node->addMessageToQueue(money, + local_player->addMessageToQueue(money, UserPalette::PICKUP_INFO); } } diff --git a/src/sound.cpp b/src/sound.cpp index 4216c8fa..6248d247 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -290,9 +290,9 @@ void Sound::playSfx(const std::string &path, int x, int y) { logger->log("Sound::playSfx() Playing: %s", path.c_str()); int vol = 120; - if (player_node && x > 0 && y > 0) + if (local_player && x > 0 && y > 0) { - Vector pos = player_node->getPosition(); + Vector pos = local_player->getPosition(); Map *map = Game::instance()->getCurrentMap(); int dx = ((int)pos.x - x) / map->getTileWidth(); int dy = ((int)pos.y - y) / map->getTileHeight(); -- cgit v1.2.3-70-g09d2