diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-30 12:25:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-30 12:25:16 +0300 |
commit | 1680d159ecbf75591d2dab1416ff8144c27d4de5 (patch) | |
tree | cd34ad27487036265f08d7aa63476c160280d899 /src/gui | |
parent | 9913b4b481ddcaf0fa8499f3554c85bb588be7f0 (diff) | |
download | ManaVerse-1680d159ecbf75591d2dab1416ff8144c27d4de5.tar.gz ManaVerse-1680d159ecbf75591d2dab1416ff8144c27d4de5.tar.bz2 ManaVerse-1680d159ecbf75591d2dab1416ff8144c27d4de5.tar.xz ManaVerse-1680d159ecbf75591d2dab1416ff8144c27d4de5.zip |
Rename player_node variable into localPlayer.
Diffstat (limited to 'src/gui')
27 files changed, 212 insertions, 212 deletions
diff --git a/src/gui/models/userstablemodel.h b/src/gui/models/userstablemodel.h index 5219a7363..e84333087 100644 --- a/src/gui/models/userstablemodel.h +++ b/src/gui/models/userstablemodel.h @@ -108,7 +108,7 @@ class UsersTableModel final : public TableModel, Being *const being = dynamic_cast<Being*>(*i); if (being && being->getType() == ActorType::PLAYER - && being != player_node && !being->getName().empty()) + && being != localPlayer && !being->getName().empty()) { mPlayers.push_back(being); } diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 50b725a5d..bd8ed9206 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -138,7 +138,7 @@ void PopupMenu::postInit() void PopupMenu::showPopup(const int x, const int y, const Being *const being) { - if (!being || !player_node || !actorManager) + if (!being || !localPlayer || !actorManager) return; mBeingId = being->getId(); @@ -179,7 +179,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) addParty(being->getPartyName()); const Guild *const guild1 = being->getGuild(); - const Guild *const guild2 = player_node->getGuild(); + const Guild *const guild2 = localPlayer->getGuild(); if (guild2) { if (guild1) @@ -354,7 +354,7 @@ void PopupMenu::showPopup(const int x, const int y, void PopupMenu::showPlayerPopup(const int x, const int y, const std::string &nick) { - if (nick.empty() || !player_node) + if (nick.empty() || !localPlayer) return; mNick = nick; @@ -382,9 +382,9 @@ void PopupMenu::showPlayerPopup(const int x, const int y, // TRANSLATORS: add comment to player mBrowserBox->addRow("addcomment", _("Add comment")); - if (player_node->isInParty()) + if (localPlayer->isInParty()) { - const Party *const party = player_node->getParty(); + const Party *const party = localPlayer->getParty(); if (party) { const PartyMember *const member = party->getMember(mNick); @@ -395,7 +395,7 @@ void PopupMenu::showPlayerPopup(const int x, const int y, mBrowserBox->addRow("kick party", _("Kick from party")); mBrowserBox->addRow("##3---"); const PartyMember *const o = party->getMember( - player_node->getName()); + localPlayer->getName()); if (o && member->getMap() == o->getMap()) { // TRANSLATORS: popup menu item @@ -406,7 +406,7 @@ void PopupMenu::showPlayerPopup(const int x, const int y, } } - const Guild *const guild2 = player_node->getGuild(); + const Guild *const guild2 = localPlayer->getGuild(); if (guild2) { if (guild2->getMember(mNick)) @@ -517,7 +517,7 @@ void PopupMenu::showPopup(const int x, const int y, MapItem *const mapItem) // TRANSLATORS: remove map item mBrowserBox->addRow("remove map", _("Remove")); - if (player_node && player_node->isGM()) + if (localPlayer && localPlayer->isGM()) { mBrowserBox->addRow("##3---"); // TRANSLATORS: popup menu item @@ -543,7 +543,7 @@ void PopupMenu::showMapPopup(const int x, const int y, // TRANSLATORS: popup menu header mBrowserBox->addRow(_("Map Item")); - if (player_node && player_node->isGM()) + if (localPlayer && localPlayer->isGM()) { // TRANSLATORS: popup menu item // TRANSLATORS: warp to map item @@ -610,7 +610,7 @@ void PopupMenu::showSpellPopup(const int x, const int y, void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) { - if (!tab || !actorManager || !player_node) + if (!tab || !actorManager || !localPlayer) return; mTab = tab; @@ -715,9 +715,9 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) addBuySell(being); mBrowserBox->addRow("##3---"); - if (player_node->isInParty()) + if (localPlayer->isInParty()) { - const Party *const party = player_node->getParty(); + const Party *const party = localPlayer->getParty(); if (party) { if (!party->isMember(wTab->getNick())) @@ -737,7 +737,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) } } const Guild *const guild1 = being->getGuild(); - const Guild *const guild2 = player_node->getGuild(); + const Guild *const guild2 = localPlayer->getGuild(); if (guild2) { if (guild1) @@ -781,9 +781,9 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) mBrowserBox->addRow("##3---"); addFollow(); - if (player_node->isInParty()) + if (localPlayer->isInParty()) { - const Party *const party = player_node->getParty(); + const Party *const party = localPlayer->getParty(); if (party) { const PartyMember *const m = party->getMember(mNick); @@ -813,12 +813,12 @@ void PopupMenu::showChangePos(const int x, const int y) // TRANSLATORS: popup menu header mBrowserBox->addRow(_("Change guild position")); - if (!player_node) + if (!localPlayer) return; mX = x; mY = y; - const Guild *const guild = player_node->getGuild(); + const Guild *const guild = localPlayer->getGuild(); if (guild) { const PositionsMap &map = guild->getPositions(); @@ -933,8 +933,8 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "attack" && being) { - if (player_node) - player_node->attack(being, true); + if (localPlayer) + localPlayer->attack(being, true); } else if (link == "heal" && being && being->getType() != ActorType::MONSTER) { @@ -1014,9 +1014,9 @@ void PopupMenu::handleLink(const std::string &link, // Guild action else if (link == "guild" && !mNick.empty()) { - if (player_node) + if (localPlayer) { - const Guild *const guild = player_node->getGuild(); + const Guild *const guild = localPlayer->getGuild(); if (guild) { if (guild->getServerGuild()) @@ -1038,23 +1038,23 @@ void PopupMenu::handleLink(const std::string &link, // Follow Player action else if (link == "follow" && !mNick.empty()) { - if (player_node) - player_node->setFollow(mNick); + if (localPlayer) + localPlayer->setFollow(mNick); } else if (link == "imitation" && !mNick.empty()) { - if (player_node) - player_node->setImitate(mNick); + if (localPlayer) + localPlayer->setImitate(mNick); } // Pick Up Floor Item action else if ((link == "pickup") && mFloorItemId) { - if (player_node && actorManager) + if (localPlayer && actorManager) { FloorItem *const item = actorManager->findItem( mFloorItemId); if (item) - player_node->pickUp(item); + localPlayer->pickUp(item); } } else if (link == "use" && mItemId) @@ -1130,30 +1130,30 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "move" && !mNick.empty()) { - if (player_node) + if (localPlayer) { if (being) { - player_node->navigateTo(being->getTileX(), being->getTileY()); + localPlayer->navigateTo(being->getTileX(), being->getTileY()); } - else if (player_node->isInParty()) + else if (localPlayer->isInParty()) { - const Party *const party = player_node->getParty(); + const Party *const party = localPlayer->getParty(); if (party) { const PartyMember *const m = party->getMember(mNick); const PartyMember *const o = party->getMember( - player_node->getName()); + localPlayer->getName()); if (m && o && m->getMap() == o->getMap()) - player_node->navigateTo(m->getX(), m->getY()); + localPlayer->navigateTo(m->getX(), m->getY()); } } } } else if (link == "move" && (mX || mY)) { - if (player_node) - player_node->navigateTo(mX, mY); + if (localPlayer) + localPlayer->navigateTo(mX, mY); } else if (link == "movecamera" && (mX || mY)) { @@ -1297,9 +1297,9 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "kick party" && !mNick.empty()) { - if (player_node && player_node->getParty()) + if (localPlayer && localPlayer->getParty()) { - const PartyMember *const member = player_node-> + const PartyMember *const member = localPlayer-> getParty()->getMember(mNick); if (member) Net::getPartyHandler()->kick(mNick); @@ -1365,10 +1365,10 @@ void PopupMenu::handleLink(const std::string &link, static_cast<int>(MapItemType::EMPTY)); if (socialWindow) socialWindow->removePortal(x, y); - if (isHome && player_node) + if (isHome && localPlayer) { - player_node->removeHome(); - player_node->saveHomes(); + localPlayer->removeHome(); + localPlayer->saveHomes(); } } } @@ -1426,9 +1426,9 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "guild-kick" && !mNick.empty()) { - if (player_node) + if (localPlayer) { - const Guild *const guild = player_node->getGuild(); + const Guild *const guild = localPlayer->getGuild(); if (guild) { if (guild->getServerGuild()) @@ -1637,7 +1637,7 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "priority movedown") { - if (player_node) + if (localPlayer) { const int idx = actorManager ->getPriorityAttackMobIndex(mNick); @@ -1731,7 +1731,7 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "items" && being) { - if (being == player_node) + if (being == localPlayer) { if (equipmentWindow && !equipmentWindow->isWindowVisible()) equipmentWindow->setVisible(true); @@ -1815,10 +1815,10 @@ void PopupMenu::handleLink(const std::string &link, } else if (!link.compare(0, 10, "guild-pos-")) { - if (player_node) + if (localPlayer) { const int num = atoi(link.substr(10).c_str()); - const Guild *const guild = player_node->getGuild(); + const Guild *const guild = localPlayer->getGuild(); if (guild) { Net::getGuildHandler()->changeMemberPostion( @@ -2264,7 +2264,7 @@ void PopupMenu::showPopup(const int x, const int y, const ProgressBar *const b) void PopupMenu::showAttackMonsterPopup(const int x, const int y, const std::string &name, const int type) { - if (!player_node || !actorManager) + if (!localPlayer || !actorManager) return; mNick = name; @@ -2342,7 +2342,7 @@ void PopupMenu::showAttackMonsterPopup(const int x, const int y, void PopupMenu::showPickupItemPopup(const int x, const int y, const std::string &name) { - if (!player_node || !actorManager) + if (!localPlayer || !actorManager) return; mNick = name; @@ -2686,11 +2686,11 @@ void PopupMenu::addBuySellDefault() void PopupMenu::addParty(const std::string &partyName) { - if (player_node->isInParty()) + if (localPlayer->isInParty()) { - if (player_node->getParty()) + if (localPlayer->getParty()) { - if (player_node->getParty()->getName() != partyName) + if (localPlayer->getParty()->getName() != partyName) { // TRANSLATORS: popup menu item // TRANSLATORS: invite player to party @@ -2842,7 +2842,7 @@ void PopupMenu::addUseDrop(const Item *const item, const bool isProtected) void PopupMenu::addGmCommands() { - if (player_node->isGM()) + if (localPlayer->isGM()) { // TRANSLATORS: popup menu item // TRANSLATORS: gm commands @@ -2855,7 +2855,7 @@ void PopupMenu::showGMPopup() mBrowserBox->clearRows(); // TRANSLATORS: popup menu header mBrowserBox->addRow(_("GM commands")); - if (player_node->isGM()) + if (localPlayer->isGM()) { // TRANSLATORS: popup menu item // TRANSLATORS: check player ip diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 8acc19ca6..d0ea8236a 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -130,7 +130,7 @@ void Viewport::draw(Graphics *graphics) BLOCK_START("Viewport::draw 1") static int lastTick = tick_time; - if (!mMap || !player_node) + if (!mMap || !localPlayer) { graphics->setColor(Color(64, 64, 64)); graphics->fillRectangle( @@ -147,7 +147,7 @@ void Viewport::draw(Graphics *graphics) const int midTileX = (graphics->mWidth + mScrollCenterOffsetX) / 2; const int midTileY = (graphics->mHeight + mScrollCenterOffsetY) / 2; - const Vector &playerPos = player_node->getPosition(); + const Vector &playerPos = localPlayer->getPosition(); const int player_x = static_cast<int>(playerPos.x) - midTileX + mCameraRelativeX; const int player_y = static_cast<int>(playerPos.y) @@ -206,10 +206,10 @@ void Viewport::draw(Graphics *graphics) { logger->log("incorrect player position: %d, %d, %d, %d", player_x, player_y, mPixelViewX, mPixelViewY); - if (player_node) + if (localPlayer) { logger->log("tile position: %d, %d", - player_node->getTileX(), player_node->getTileY()); + localPlayer->getTileX(), localPlayer->getTileY()); } } mPixelViewX = player_x; @@ -252,10 +252,10 @@ void Viewport::draw(Graphics *graphics) drawDebugPath(graphics); } - if (player_node->getCheckNameSetting()) + if (localPlayer->getCheckNameSetting()) { - player_node->setCheckNameSetting(false); - player_node->setName(player_node->getName()); + localPlayer->setCheckNameSetting(false); + localPlayer->setName(localPlayer->getName()); } // Draw text @@ -312,7 +312,7 @@ void Viewport::followMouse() void Viewport::drawDebugPath(Graphics *const graphics) { - if (!player_node || !userPalette || !actorManager || !mMap || !gui) + if (!localPlayer || !userPalette || !actorManager || !mMap || !gui) return; Gui::getMouseState(&mMouseX, &mMouseY); @@ -326,13 +326,13 @@ void Viewport::drawDebugPath(Graphics *const graphics) if (mouseDestination.x != lastMouseDestination.x || mouseDestination.y != lastMouseDestination.y) { - const Vector &playerPos = player_node->getPosition(); + const Vector &playerPos = localPlayer->getPosition(); debugPath = mMap->findPath( static_cast<int>(playerPos.x - mapTileSize / 2) / mapTileSize, static_cast<int>(playerPos.y - mapTileSize) / mapTileSize, mousePosX / mapTileSize, mousePosY / mapTileSize, - player_node->getWalkMask(), + localPlayer->getWalkMask(), 500); lastMouseDestination = mouseDestination; } @@ -343,7 +343,7 @@ void Viewport::drawDebugPath(Graphics *const graphics) FOR_EACH (ActorSpritesConstIterator, it, actors) { const Being *const being = dynamic_cast<const Being*>(*it); - if (being && being != player_node) + if (being && being != localPlayer) { const Path &beingPath = being->getPath(); drawPath(graphics, beingPath, userPalette->getColorWithAlpha( @@ -443,23 +443,23 @@ bool Viewport::leftMouseAction() validateSpeed(); if (actorManager) { - if (player_node != mHoverBeing || mSelfMouseHeal) + if (localPlayer != mHoverBeing || mSelfMouseHeal) actorManager->heal(mHoverBeing); - if (player_node == mHoverBeing && mHoverItem) - player_node->pickUp(mHoverItem); + if (localPlayer == mHoverBeing && mHoverItem) + localPlayer->pickUp(mHoverItem); return true; } } else if (type == ActorType::MONSTER || type == ActorType::NPC) { - if (player_node->withinAttackRange(mHoverBeing) || + if (localPlayer->withinAttackRange(mHoverBeing) || inputManager.isActionActive(static_cast<int>( InputAction::ATTACK))) { validateSpeed(); - if (!mStatsReUpdated && player_node != mHoverBeing) + if (!mStatsReUpdated && localPlayer != mHoverBeing) { - player_node->attack(mHoverBeing, + localPlayer->attack(mHoverBeing, !inputManager.isActionActive( static_cast<int>(InputAction::STOP_ATTACK))); return true; @@ -469,9 +469,9 @@ bool Viewport::leftMouseAction() InputAction::ATTACK))) { validateSpeed(); - if (!mStatsReUpdated && player_node != mHoverBeing) + if (!mStatsReUpdated && localPlayer != mHoverBeing) { - player_node->setGotoTarget(mHoverBeing); + localPlayer->setGotoTarget(mHoverBeing); return true; } } @@ -482,15 +482,15 @@ bool Viewport::leftMouseAction() if (mHoverItem) { validateSpeed(); - player_node->pickUp(mHoverItem); + localPlayer->pickUp(mHoverItem); } // Just walk around else if (!inputManager.isActionActive(static_cast<int>( InputAction::ATTACK))) { validateSpeed(); - player_node->stopAttack(); - player_node->cancelFollow(); + localPlayer->stopAttack(); + localPlayer->cancelFollow(); mPlayerFollowMouse = true; // Make the player go to the mouse position @@ -506,7 +506,7 @@ void Viewport::mousePressed(MouseEvent &event) mMouseClicked = true; // Check if we are alive and kickin' - if (!mMap || !player_node) + if (!mMap || !localPlayer) return; // Check if we are busy @@ -555,14 +555,14 @@ void Viewport::mousePressed(MouseEvent &event) pixelX, pixelY, 20, ActorType::MONSTER, nullptr); if (target) - player_node->setTarget(target); + localPlayer->setTarget(target); } } } void Viewport::walkByMouse(const MouseEvent &event) { - if (!mMap || !player_node) + if (!mMap || !localPlayer) return; if (mPlayerFollowMouse && !inputManager.isActionActive(InputAction::STOP_ATTACK) @@ -570,12 +570,12 @@ void Viewport::walkByMouse(const MouseEvent &event) { if (!mMouseDirectionMove) mPlayerFollowMouse = false; - if (mLocalWalkTime != player_node->getActionTime()) + if (mLocalWalkTime != localPlayer->getActionTime()) { mLocalWalkTime = cur_time; - player_node->unSetPickUpTarget(); - int playerX = player_node->getTileX(); - int playerY = player_node->getTileY(); + localPlayer->unSetPickUpTarget(); + int playerX = localPlayer->getTileX(); + int playerY = localPlayer->getTileY(); if (mMouseDirectionMove) { const int width = mainGraphics->mWidth / 2; @@ -615,7 +615,7 @@ void Viewport::walkByMouse(const MouseEvent &event) if (mMap->getWalk(playerX + dx, playerY + dy)) { - player_node->navigateTo(playerX + dx, playerY + dy); + localPlayer->navigateTo(playerX + dx, playerY + dy); } else { @@ -655,7 +655,7 @@ void Viewport::walkByMouse(const MouseEvent &event) dy = -1; } } - player_node->navigateTo(playerX + dx, playerY + dy); + localPlayer->navigateTo(playerX + dx, playerY + dy); } } else @@ -666,7 +666,7 @@ void Viewport::walkByMouse(const MouseEvent &event) / static_cast<float>(mMap->getTileHeight())); if (playerX != destX || playerY != destY) { - if (!player_node->navigateTo(destX, destY)) + if (!localPlayer->navigateTo(destX, destY)) { if (playerX > destX) playerX --; @@ -677,7 +677,7 @@ void Viewport::walkByMouse(const MouseEvent &event) else if (playerY < destY) playerY ++; if (mMap->getWalk(playerX, playerY, 0)) - player_node->navigateTo(playerX, playerY); + localPlayer->navigateTo(playerX, playerY); } } } @@ -900,7 +900,7 @@ void Viewport::optionChanged(const std::string &name) void Viewport::mouseMoved(MouseEvent &event A_UNUSED) { // Check if we are on the map - if (!mMap || !player_node || !actorManager) + if (!mMap || !localPlayer || !actorManager) return; if (mMouseDirectionMove) @@ -1060,14 +1060,14 @@ bool Viewport::isPopupMenuVisible() const void Viewport::moveCameraToActor(const int actorId, const int x, const int y) { - if (!player_node || !actorManager) + if (!localPlayer || !actorManager) return; const Actor *const actor = actorManager->findBeing(actorId); if (!actor) return; const Vector &actorPos = actor->getPosition(); - const Vector &playerPos = player_node->getPosition(); + const Vector &playerPos = localPlayer->getPosition(); settings.cameraMode = 1; mCameraRelativeX = static_cast<int>(actorPos.x - playerPos.x) + x; mCameraRelativeY = static_cast<int>(actorPos.y - playerPos.y) + y; @@ -1075,10 +1075,10 @@ void Viewport::moveCameraToActor(const int actorId, void Viewport::moveCameraToPosition(const int x, const int y) { - if (!player_node) + if (!localPlayer) return; - const Vector &playerPos = player_node->getPosition(); + const Vector &playerPos = localPlayer->getPosition(); settings.cameraMode = 1; mCameraRelativeX = x - static_cast<int>(playerPos.x); diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 285a4f246..80bcba94c 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -97,7 +97,7 @@ AvatarListBox::~AvatarListBox() void AvatarListBox::draw(Graphics *graphics) { BLOCK_START("AvatarListBox::draw") - if (!mListModel || !player_node) + if (!mListModel || !localPlayer) { BLOCK_END("AvatarListBox::draw") return; @@ -113,7 +113,7 @@ void AvatarListBox::draw(Graphics *graphics) Font *const font = getFont(); const int fontHeight = getFont()->getHeight(); - const std::string &name = player_node->getName(); + const std::string &name = localPlayer->getName(); // Draw the list elements graphics->setColorAll(mForegroundColor, mForegroundColor2); @@ -335,7 +335,7 @@ void AvatarListBox::draw(Graphics *graphics) void AvatarListBox::mousePressed(MouseEvent &event) { - if (!actorManager || !player_node || !viewport + if (!actorManager || !localPlayer || !viewport || !getFont()->getHeight()) { return; @@ -369,7 +369,7 @@ void AvatarListBox::mousePressed(MouseEvent &event) } else { - player_node->navigateTo(ava->getX(), ava->getY()); + localPlayer->navigateTo(ava->getX(), ava->getY()); } } else if (eventButton == MouseButton::RIGHT) diff --git a/src/gui/widgets/tabs/chattab.cpp b/src/gui/widgets/tabs/chattab.cpp index 684b9d4d5..f9a6e960f 100644 --- a/src/gui/widgets/tabs/chattab.cpp +++ b/src/gui/widgets/tabs/chattab.cpp @@ -344,10 +344,10 @@ void ChatTab::chatLog(std::string line, ChatMsgType::Type own, void ChatTab::chatLog(const std::string &nick, std::string msg) { - if (!player_node) + if (!localPlayer) return; - const ChatMsgType::Type byWho = (nick == player_node->getName() + const ChatMsgType::Type byWho = (nick == localPlayer->getName() ? ChatMsgType::BY_PLAYER : ChatMsgType::BY_OTHER); if (byWho == ChatMsgType::BY_OTHER && config.getBoolValue("removeColors")) msg = removeColors(msg); diff --git a/src/gui/widgets/tabs/debugwindowtabs.cpp b/src/gui/widgets/tabs/debugwindowtabs.cpp index d538ba91a..b50baac78 100644 --- a/src/gui/widgets/tabs/debugwindowtabs.cpp +++ b/src/gui/widgets/tabs/debugwindowtabs.cpp @@ -160,11 +160,11 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : void MapDebugTab::logic() { BLOCK_START("MapDebugTab::logic") - if (player_node) + if (localPlayer) { // TRANSLATORS: debug window label mXYLabel->setCaption(strprintf("%s (%d, %d)", _("Player Position:"), - player_node->getTileX(), player_node->getTileY())); + localPlayer->getTileX(), localPlayer->getTileY())); } else { @@ -305,9 +305,9 @@ TargetDebugTab::TargetDebugTab(const Widget2 *const widget) : void TargetDebugTab::logic() { BLOCK_START("TargetDebugTab::logic") - if (player_node && player_node->getTarget()) + if (localPlayer && localPlayer->getTarget()) { - const Being *const target = player_node->getTarget(); + const Being *const target = localPlayer->getTarget(); // TRANSLATORS: debug window label mTargetLabel->setCaption(strprintf("%s %s (%d, %d)", _("Target:"), @@ -424,11 +424,11 @@ NetDebugTab::NetDebugTab(const Widget2 *const widget) : void NetDebugTab::logic() { BLOCK_START("NetDebugTab::logic") - if (player_node) + if (localPlayer) { // TRANSLATORS: debug window label mPingLabel->setCaption(strprintf(_("Ping: %s ms"), - player_node->getPingTime().c_str())); + localPlayer->getPingTime().c_str())); } else { diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp index b14208c3b..7ebf81017 100644 --- a/src/gui/widgets/tabs/setup_relations.cpp +++ b/src/gui/widgets/tabs/setup_relations.cpp @@ -179,8 +179,8 @@ void Setup_Relations::apply() if (actorManager) actorManager->updatePlayerNames(); - if (player_node) - player_node->setCheckNameSetting(true); + if (localPlayer) + localPlayer->setCheckNameSetting(true); } void Setup_Relations::cancel() @@ -231,8 +231,8 @@ void Setup_Relations::updatedPlayer(const std::string &name A_UNUSED) player_relations.getDefault() & PlayerRelation::TRADE); mDefaultWhisper->setSelected( player_relations.getDefault() & PlayerRelation::WHISPER); - if (player_node) - player_node->updateName(); + if (localPlayer) + localPlayer->updateName(); } void Setup_Relations::updateAll() diff --git a/src/gui/widgets/tabs/socialguildtab.h b/src/gui/widgets/tabs/socialguildtab.h index 0347087b7..ba9127418 100644 --- a/src/gui/widgets/tabs/socialguildtab.h +++ b/src/gui/widgets/tabs/socialguildtab.h @@ -145,10 +145,10 @@ class SocialGuildTab final : public SocialTab, } else { - if (!player_node) + if (!localPlayer) return; - const Guild *const guild = player_node->getGuild(); + const Guild *const guild = localPlayer->getGuild(); if (!guild) return; diff --git a/src/gui/widgets/tabs/socialguildtab2.h b/src/gui/widgets/tabs/socialguildtab2.h index ba40d7c4f..cf7086708 100644 --- a/src/gui/widgets/tabs/socialguildtab2.h +++ b/src/gui/widgets/tabs/socialguildtab2.h @@ -74,10 +74,10 @@ class SocialGuildTab2 final : public SocialTab, void buildCounter(const int online0 A_UNUSED, const int total0 A_UNUSED) { - if (!player_node) + if (!localPlayer) return; - const Guild *const guild = player_node->getGuild(); + const Guild *const guild = localPlayer->getGuild(); if (!guild) return; diff --git a/src/gui/widgets/tabs/socialnavigationtab.h b/src/gui/widgets/tabs/socialnavigationtab.h index 4344e1251..cee569e86 100644 --- a/src/gui/widgets/tabs/socialnavigationtab.h +++ b/src/gui/widgets/tabs/socialnavigationtab.h @@ -71,7 +71,7 @@ class SocialNavigationTab final : public SocialTab void updateList() override final { - if (!socialWindow || !player_node) + if (!socialWindow || !localPlayer) return; const Map *const map = socialWindow->getMap(); @@ -114,8 +114,8 @@ class SocialNavigationTab final : public SocialTab portal->getComment().c_str(), x, y); Avatar *const ava = new Avatar(name); - if (player_node) - ava->setOnline(player_node->isReachable(x, y, true)); + if (localPlayer) + ava->setOnline(localPlayer->isReachable(x, y, true)); else ava->setOnline(false); ava->setLevel(-1); @@ -166,7 +166,7 @@ class SocialNavigationTab final : public SocialTab void selectIndex(const unsigned num) override final { - if (!player_node) + if (!localPlayer) return; std::vector<Avatar*> *const avatars = mBeings->getMembers(); @@ -174,8 +174,8 @@ class SocialNavigationTab final : public SocialTab return; const Avatar *const ava = avatars->at(num); - if (ava && player_node) - player_node->navigateTo(ava->getX(), ava->getY()); + if (ava && localPlayer) + localPlayer->navigateTo(ava->getX(), ava->getY()); } void updateNames() @@ -247,7 +247,7 @@ class SocialNavigationTab final : public SocialTab void addPortal(const int x, const int y) { - if (!socialWindow || !player_node) + if (!socialWindow || !localPlayer) return; const Map *const map = socialWindow->getMap(); @@ -267,8 +267,8 @@ class SocialNavigationTab final : public SocialTab portal->getComment().c_str(), x, y); Avatar *const ava = new Avatar(name); - if (player_node) - ava->setOnline(player_node->isReachable(x, y, true)); + if (localPlayer) + ava->setOnline(localPlayer->isReachable(x, y, true)); else ava->setOnline(false); ava->setLevel(-1); @@ -280,7 +280,7 @@ class SocialNavigationTab final : public SocialTab void removePortal(const int x, const int y) { - if (!socialWindow || !player_node) + if (!socialWindow || !localPlayer) return; const Map *const map = socialWindow->getMap(); diff --git a/src/gui/widgets/tabs/socialpartytab.h b/src/gui/widgets/tabs/socialpartytab.h index 847a43d42..9aea998d2 100644 --- a/src/gui/widgets/tabs/socialpartytab.h +++ b/src/gui/widgets/tabs/socialpartytab.h @@ -137,10 +137,10 @@ class SocialPartyTab final : public SocialTab, void buildCounter(const int online0 A_UNUSED, const int total0 A_UNUSED) { - if (!player_node) + if (!localPlayer) return; - const Party *const party = player_node->getParty(); + const Party *const party = localPlayer->getParty(); if (!party) return; diff --git a/src/gui/widgets/tabs/socialtabbase.h b/src/gui/widgets/tabs/socialtabbase.h index d15f39a6c..715d63370 100644 --- a/src/gui/widgets/tabs/socialtabbase.h +++ b/src/gui/widgets/tabs/socialtabbase.h @@ -64,7 +64,7 @@ } #define updateAtkListStart() \ - if (!socialWindow || !player_node || !actorManager)\ + if (!socialWindow || !localPlayer || !actorManager)\ return;\ std::vector<Avatar*> *const avatars = mBeings->getMembers();\ std::vector<Avatar*>::iterator ia = avatars->begin();\ diff --git a/src/gui/widgets/tabs/whispertab.cpp b/src/gui/widgets/tabs/whispertab.cpp index 2d295dc14..d0a29797f 100644 --- a/src/gui/widgets/tabs/whispertab.cpp +++ b/src/gui/widgets/tabs/whispertab.cpp @@ -56,8 +56,8 @@ void WhisperTab::handleInput(const std::string &msg) newMsg = ChatWindow::doReplace(msg); Net::getChatHandler()->privateMessage(mNick, newMsg); - if (player_node) - chatLog(player_node->getName(), newMsg); + if (localPlayer) + chatLog(localPlayer->getName(), newMsg); else chatLog("?", newMsg); } @@ -79,8 +79,8 @@ void WhisperTab::handleCommand(const std::string &msg) { std::string str = strprintf("*%s*", args.c_str()); Net::getChatHandler()->privateMessage(mNick, str); - if (player_node) - chatLog(player_node->getName(), str); + if (localPlayer) + chatLog(localPlayer->getName(), str); else chatLog("?", str); } diff --git a/src/gui/windows/botcheckerwindow.cpp b/src/gui/windows/botcheckerwindow.cpp index e4ab62b1a..d0130ed7a 100644 --- a/src/gui/windows/botcheckerwindow.cpp +++ b/src/gui/windows/botcheckerwindow.cpp @@ -194,7 +194,7 @@ void BotCheckerWindow::reset() Being *const being = dynamic_cast<Being*>(*i); if (being && being->getType() == ActorType::PLAYER - && being != player_node && being->getName() != "") + && being != localPlayer && being->getName() != "") { being->resetCounters(); } diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index d4ae8ed14..3bf1366f5 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -182,7 +182,7 @@ ChatWindow::ChatWindow() : updateTabsMargin(); fillCommands(); - if (player_node && player_node->isGM()) + if (localPlayer && localPlayer->isGM()) loadGMCommands(); initTradeFilter(); loadCustomList(); @@ -998,10 +998,10 @@ void ChatWindow::addWhisper(const std::string &restrict nick, const std::string &restrict mes, const ChatMsgType::Type own) { - if (mes.empty() || !player_node) + if (mes.empty() || !localPlayer) return; - std::string playerName = player_node->getName(); + std::string playerName = localPlayer->getName(); std::string tempNick = nick; toLower(playerName); @@ -1062,7 +1062,7 @@ void ChatWindow::addWhisper(const std::string &restrict nick, { tab->chatLog(nick, mes); } - player_node->afkRespond(tab, nick); + localPlayer->afkRespond(tab, nick); } } else if (localChatTab) @@ -1079,8 +1079,8 @@ void ChatWindow::addWhisper(const std::string &restrict nick, { localChatTab->chatLog(std::string(nick).append( " : ").append(mes), ChatMsgType::ACT_WHISPER, false); - if (player_node) - player_node->afkRespond(nullptr, nick); + if (localPlayer) + localPlayer->afkRespond(nullptr, nick); } } } @@ -1088,10 +1088,10 @@ void ChatWindow::addWhisper(const std::string &restrict nick, WhisperTab *ChatWindow::addWhisperTab(const std::string &nick, const bool switchTo) { - if (!player_node) + if (!localPlayer) return nullptr; - std::string playerName = player_node->getName(); + std::string playerName = localPlayer->getName(); std::string tempNick = nick; toLower(playerName); @@ -1125,10 +1125,10 @@ WhisperTab *ChatWindow::addWhisperTab(const std::string &nick, WhisperTab *ChatWindow::getWhisperTab(const std::string &nick) const { - if (!player_node) + if (!localPlayer) return nullptr; - std::string playerName = player_node->getName(); + std::string playerName = localPlayer->getName(); std::string tempNick = nick; toLower(playerName); @@ -1566,10 +1566,10 @@ void ChatWindow::updateOnline(const std::set<std::string> &onlinePlayers) const { const Party *party = nullptr; const Guild *guild = nullptr; - if (player_node) + if (localPlayer) { - party = player_node->getParty(); - guild = player_node->getGuild(); + party = localPlayer->getParty(); + guild = localPlayer->getGuild(); } FOR_EACH (TabMap::const_iterator, iter, mWhispers) { @@ -1740,25 +1740,25 @@ void ChatWindow::displayAwayLog() const void ChatWindow::parseHighlights() { mHighlights.clear(); - if (!player_node) + if (!localPlayer) return; splitToStringVector(mHighlights, config.getStringValue( "highlightWords"), ','); - mHighlights.push_back(player_node->getName()); + mHighlights.push_back(localPlayer->getName()); } void ChatWindow::parseGlobalsFilter() { mGlobalsFilter.clear(); - if (!player_node) + if (!localPlayer) return; splitToStringVector(mGlobalsFilter, config.getStringValue( "globalsFilter"), ','); - mHighlights.push_back(player_node->getName()); + mHighlights.push_back(localPlayer->getName()); } bool ChatWindow::findHighlight(const std::string &str) diff --git a/src/gui/windows/debugwindow.cpp b/src/gui/windows/debugwindow.cpp index c12fb962b..6ddeaea8b 100644 --- a/src/gui/windows/debugwindow.cpp +++ b/src/gui/windows/debugwindow.cpp @@ -110,8 +110,8 @@ void DebugWindow::slowLogic() break; } - if (player_node) - player_node->tryPingRequest(); + if (localPlayer) + localPlayer->tryPingRequest(); BLOCK_END("DebugWindow::slowLogic") } @@ -120,9 +120,9 @@ void DebugWindow::draw(Graphics *g) BLOCK_START("DebugWindow::draw") Window::draw(g); - if (player_node) + if (localPlayer) { - const Being *const target = player_node->getTarget(); + const Being *const target = localPlayer->getTarget(); if (target) { target->draw(g, -target->getPixelX() + mapTileSize / 2 diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index 7ec505160..8a558236a 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -381,7 +381,7 @@ void EquipmentWindow::mouseReleased(MouseEvent &event) { return; } - Inventory *const inventory = player_node + Inventory *const inventory = localPlayer ? PlayerInfo::getInventory() : nullptr; if (!inventory) return; diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp index b5189b455..6ec3df5a0 100644 --- a/src/gui/windows/killstats.cpp +++ b/src/gui/windows/killstats.cpp @@ -127,7 +127,7 @@ KillStats::KillStats() : // TRANSLATORS: kill stats window label mLine1 = new Label(this, strprintf(_("Level: %d at %f%%"), - player_node->getLevel(), static_cast<double>(xp) + localPlayer->getLevel(), static_cast<double>(xp) / static_cast<double>(xpNextLevel) * 100.0)); // TRANSLATORS: kill stats window label @@ -240,7 +240,7 @@ void KillStats::gainXp(int xp) const int exp = PlayerInfo::getAttribute(Attributes::EXP); // TRANSLATORS: kill stats window label mLine1->setCaption(strprintf(_("Level: %d at %f%%"), - player_node->getLevel(), static_cast<double>(exp) + localPlayer->getLevel(), static_cast<double>(exp) / static_cast<double>(xpNextLevel) * 100.0)); // TRANSLATORS: kill stats window label @@ -468,7 +468,7 @@ void KillStats::jackoAlive(const int id) void KillStats::validateJacko() { - if (!actorManager || !player_node) + if (!actorManager || !localPlayer) return; const Map *const currentMap = Game::instance()->getCurrentMap(); @@ -477,10 +477,10 @@ void KillStats::validateJacko() if (currentMap->getProperty("_realfilename") == "018-1" || currentMap->getProperty("_realfilename") == "maps/018-1.tmx") { - if (player_node->getTileX() >= 167 - && player_node->getTileX() <= 175 - && player_node->getTileY() >= 21 - && player_node->getTileY() <= 46) + if (localPlayer->getTileX() >= 167 + && localPlayer->getTileX() <= 175 + && localPlayer->getTileY() >= 21 + && localPlayer->getTileY() <= 46) { const Being *const dstBeing = actorManager->findBeingByName( diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 859d45b9e..f8eaddd4b 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -242,7 +242,7 @@ void Minimap::draw(Graphics *graphics) BLOCK_START("Minimap::draw") Window::draw(graphics); - if (!userPalette || !player_node || !viewport) + if (!userPalette || !localPlayer || !viewport) { BLOCK_END("Minimap::draw") return; @@ -268,7 +268,7 @@ void Minimap::draw(Graphics *graphics) const int h = rect.h; if (w > a.width || h > a.height) { - const Vector &p = player_node->getPosition(); + const Vector &p = localPlayer->getPosition(); mMapOriginX = (a.width / 2) - (p.x + static_cast<float>( viewport->getCameraRelativeX()) * mWidthProportion) / 32; @@ -304,7 +304,7 @@ void Minimap::draw(Graphics *graphics) int dotSize = 2; int type = UserPalette::PC; - if (being == player_node) + if (being == localPlayer) { type = UserPalette::SELF; dotSize = 3; @@ -313,8 +313,8 @@ void Minimap::draw(Graphics *graphics) { type = UserPalette::GM; } - else if (being->getGuild() == player_node->getGuild() - || being->getGuildName() == player_node->getGuildName()) + else if (being->getGuild() == localPlayer->getGuild() + || being->getGuildName() == localPlayer->getGuildName()) { type = UserPalette::GUILD; } @@ -357,13 +357,13 @@ void Minimap::draw(Graphics *graphics) + mMapOriginY - offsetHeight, dotSize, dotSize)); } - if (player_node->isInParty()) + if (localPlayer->isInParty()) { - const Party *const party = player_node->getParty(); + const Party *const party = localPlayer->getParty(); if (party) { const PartyMember *const m = party->getMember( - player_node->getName()); + localPlayer->getName()); const Party::MemberList *const members = party->getMembers(); if (m && members) { @@ -401,7 +401,7 @@ void Minimap::draw(Graphics *graphics) } } - const Vector &pos = player_node->getPosition(); + const Vector &pos = localPlayer->getPosition(); const int gw = graphics->getWidth(); const int gh = graphics->getHeight(); @@ -442,7 +442,7 @@ void Minimap::mouseReleased(MouseEvent &event) { Window::mouseReleased(event); - if (!player_node || !viewport) + if (!localPlayer || !viewport) return; if (event.getButton() == MouseButton::LEFT) @@ -451,7 +451,7 @@ void Minimap::mouseReleased(MouseEvent &event) int y = event.getY(); screenToMap(x, y); - player_node->navigateTo(x, y); + localPlayer->navigateTo(x, y); } else if (event.getButton() == MouseButton::RIGHT) { diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 7196a8df7..61d3f4cab 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -339,12 +339,12 @@ void MiniStatusWindow::mouseMoved(MouseEvent &event) else if (event.getSource() == mXpBar) { std::string level; - if (player_node && player_node->isGM()) + if (localPlayer && localPlayer->isGM()) { // TRANSLATORS: status bar label level = strprintf(_("Level: %d (GM %d)"), PlayerInfo::getAttribute(Attributes::LEVEL), - player_node->getGMLevel()); + localPlayer->getGMLevel()); } else { diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index 69c890c4e..9b8d1aa61 100644 --- a/src/gui/windows/questswindow.cpp +++ b/src/gui/windows/questswindow.cpp @@ -382,11 +382,11 @@ void QuestsWindow::rebuild(const bool playSound) switch (newCompleteStatus) { case 0: - effectManager->trigger(mNewQuestEffectId, player_node); + effectManager->trigger(mNewQuestEffectId, localPlayer); break; case 1: effectManager->trigger(mCompleteQuestEffectId, - player_node); + localPlayer); break; default: break; diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index eac966fa8..96ac002fa 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -238,15 +238,15 @@ void ShopWindow::action(const ActionEvent &event) && mBuyShopItemList->getSelected() >= 0) { mBuyShopItems->del(mBuyShopItemList->getSelected()); - if (isShopEmpty() && player_node) - player_node->updateStatus(); + if (isShopEmpty() && localPlayer) + localPlayer->updateStatus(); } else if (eventId == "delete sell" && mSellShopItemList && mSellShopItemList->getSelected() >= 0) { mSellShopItems->del(mSellShopItemList->getSelected()); - if (isShopEmpty() && player_node) - player_node->updateStatus(); + if (isShopEmpty() && localPlayer) + localPlayer->updateStatus(); } else if (eventId == "announce buy" && mBuyShopItems && mBuyShopItems->getNumberOfElements() > 0) @@ -345,8 +345,8 @@ void ShopWindow::addBuyItem(const Item *const item, const int amount, const bool emp = isShopEmpty(); mBuyShopItems->addItemNoDup(item->getId(), item->getColor(), amount, price); - if (emp && player_node) - player_node->updateStatus(); + if (emp && localPlayer) + localPlayer->updateStatus(); updateButtonsAndLabels(); } @@ -359,8 +359,8 @@ void ShopWindow::addSellItem(const Item *const item, const int amount, const bool emp = isShopEmpty(); mSellShopItems->addItemNoDup(item->getId(), item->getColor(), amount, price); - if (emp && player_node) - player_node->updateStatus(); + if (emp && localPlayer) + localPlayer->updateStatus(); updateButtonsAndLabels(); } @@ -701,7 +701,7 @@ void ShopWindow::showList(const std::string &nick, std::string data) void ShopWindow::processRequest(const std::string &nick, std::string data, const int mode) { - if (!player_node || !mTradeNick.empty() || PlayerInfo::isTrading() + if (!localPlayer || !mTradeNick.empty() || PlayerInfo::isTrading() || !actorManager || !actorManager->findBeingByName(nick, ActorType::PLAYER)) { @@ -857,7 +857,7 @@ bool ShopWindow::findShopItem(const ShopItem *const shopItem, int ShopWindow::sumAmount(const Item *const shopItem) { - if (!player_node || !shopItem) + if (!localPlayer || !shopItem) return 0; const Inventory *const inv = PlayerInfo::getInventory(); diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index f90f0a84c..5cd79c600 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -151,9 +151,9 @@ void SkillDialog::action(const ActionEvent &event) if (tab) { const SkillInfo *const info = tab->getSelectedInfo(); - if (info && player_node && player_node->getTarget()) + if (info && localPlayer && localPlayer->getTarget()) { - const Being *const being = player_node->getTarget(); + const Being *const being = localPlayer->getTarget(); if (being) { Net::getSkillHandler()->useBeing(info->level, @@ -420,9 +420,9 @@ void SkillDialog::useItem(const int itemId) const return; const SkillInfo *const info = (*it).second; - if (info && player_node && player_node->getTarget()) + if (info && localPlayer && localPlayer->getTarget()) { - const Being *const being = player_node->getTarget(); + const Being *const being = localPlayer->getTarget(); if (being) { Net::getSkillHandler()->useBeing(info->level, @@ -477,6 +477,6 @@ void SkillDialog::playUpdateEffect(const int id) const if (it != mSkills.end()) { if (it->second) - effectManager->trigger(effectId, player_node); + effectManager->trigger(effectId, localPlayer); } } diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index d5ef89d0c..bbfa91a81 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -148,11 +148,11 @@ void SocialWindow::postInit() mPickupFilter = nullptr; } - if (player_node && player_node->getParty()) - addTab(player_node->getParty()); + if (localPlayer && localPlayer->getParty()) + addTab(localPlayer->getParty()); - if (player_node && player_node->getGuild()) - addTab(player_node->getGuild()); + if (localPlayer && localPlayer->getGuild()) + addTab(localPlayer->getGuild()); enableVisibleSound(true); updateButtons(); @@ -488,10 +488,10 @@ void SocialWindow::showPartyInvite(const std::string &restrict partyName, void SocialWindow::showPartyCreate() { - if (!player_node) + if (!localPlayer) return; - if (player_node->getParty()) + if (localPlayer->getParty()) { // TRANSLATORS: party creation message new OkDialog(_("Create Party"), @@ -623,10 +623,10 @@ void SocialWindow::updatePickupFilter() void SocialWindow::updateParty() { - if (!player_node) + if (!localPlayer) return; - Party *const party = player_node->getParty(); + Party *const party = localPlayer->getParty(); if (party) { PartyMap::iterator it = mParties.find(party); @@ -657,10 +657,10 @@ void SocialWindow::setCounter(const SocialTab *const tab, void SocialWindow::updateGuildCounter(const int online, const int total) { - if (!player_node) + if (!localPlayer) return; - Guild *const guild = player_node->getGuild(); + Guild *const guild = localPlayer->getGuild(); if (guild) { GuildMap::iterator it = mGuilds.find(guild); diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index c5f2b29d3..6fa51c568 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -65,7 +65,7 @@ StatusWindow *statusWindow = nullptr; StatusWindow::StatusWindow() : - Window(player_node ? player_node->getName() : + Window(localPlayer ? localPlayer->getName() : "?", false, nullptr, "status.xml"), ActionListener(), AttributeListener(), @@ -105,10 +105,10 @@ StatusWindow::StatusWindow() : setDefaultSize((windowContainer->getWidth() - 480) / 2, (windowContainer->getHeight() - 500) / 2, 480, 500); - if (player_node && !player_node->getRaceName().empty()) + if (localPlayer && !localPlayer->getRaceName().empty()) { - setCaption(strprintf("%s (%s)", player_node->getName().c_str(), - player_node->getRaceName().c_str())); + setCaption(strprintf("%s (%s)", localPlayer->getName().c_str(), + localPlayer->getRaceName().c_str())); } int max = PlayerInfo::getAttribute(Attributes::MAX_HP); @@ -242,12 +242,12 @@ StatusWindow::StatusWindow() : PlayerInfo::getAttribute(Attributes::CHAR_POINTS))); mCharacterPointsLabel->adjustSize(); - if (player_node && player_node->isGM()) + if (localPlayer && localPlayer->isGM()) { // TRANSLATORS: status window label mLvlLabel->setCaption(strprintf(_("Level: %d (GM %d)"), PlayerInfo::getAttribute(Attributes::LEVEL), - player_node->getGMLevel())); + localPlayer->getGMLevel())); } else { diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index 21144b341..7707bf360 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -439,7 +439,7 @@ void TradeWindow::addAutoMoney(const std::string &nick, const int money) void TradeWindow::initTrade(const std::string &nick) { - if (!player_node) + if (!localPlayer) return; if (!mAutoAddToNick.empty() && mAutoAddToNick == nick) diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index 00187a31d..fc4c8cbc4 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -194,7 +194,7 @@ void WhoIsOnline::handleLink(const std::string& link, MouseEvent *event) } else if (event->getButton() == MouseButton::RIGHT) { - if (player_node && link == player_node->getName()) + if (localPlayer && link == localPlayer->getName()) return; if (viewport) @@ -751,17 +751,17 @@ void WhoIsOnline::setNeutralColor(OnlinePlayer *const player) if (!player) return; - if (actorManager && player_node) + if (actorManager && localPlayer) { const std::string &nick = player->getNick(); - if (nick == player_node->getName()) + if (nick == localPlayer->getName()) { player->setText("s"); return; } - if (player_node->isInParty()) + if (localPlayer->isInParty()) { - const Party *const party = player_node->getParty(); + const Party *const party = localPlayer->getParty(); if (party) { if (party->getMember(nick)) @@ -775,7 +775,7 @@ void WhoIsOnline::setNeutralColor(OnlinePlayer *const player) const Being *const being = actorManager->findBeingByName(nick); if (being) { - const Guild *const guild2 = player_node->getGuild(); + const Guild *const guild2 = localPlayer->getGuild(); if (guild2) { const Guild *const guild1 = being->getGuild(); |