From aa448523f8c0affc25df21eb993a8e327b391878 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Wed, 31 Jan 2018 23:23:52 +0200 Subject: [PATCH] [Client] Clean up WorldEvent::runConsoleCommands() slightly --- apps/openmw/mwmp/WorldEvent.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwmp/WorldEvent.cpp b/apps/openmw/mwmp/WorldEvent.cpp index 6f2a84031..c62aed004 100644 --- a/apps/openmw/mwmp/WorldEvent.cpp +++ b/apps/openmw/mwmp/WorldEvent.cpp @@ -485,24 +485,20 @@ void WorldEvent::runConsoleCommands(MWWorld::CellStore* cellStore) if (worldObject.isPlayer) { - BasePlayer *player = 0; - if (worldObject.guid == Main::get().getLocalPlayer()->guid) { - player = Main::get().getLocalPlayer(); - LOG_APPEND(Log::LOG_VERBOSE, "-- running on local player"); - windowManager->setConsolePtr(static_cast(player)->getPlayerPtr()); + windowManager->setConsolePtr(Main::get().getLocalPlayer()->getPlayerPtr()); windowManager->executeCommandInConsole(consoleCommand); } else { - player = PlayerList::getPlayer(worldObject.guid); + DedicatedPlayer *player = PlayerList::getPlayer(worldObject.guid); if (player != 0) { LOG_APPEND(Log::LOG_VERBOSE, "-- running on player %s", player->npc.mName.c_str()); - windowManager->setConsolePtr(static_cast(player)->getPtr()); + windowManager->setConsolePtr(player->getPtr()); windowManager->executeCommandInConsole(consoleCommand); } } @@ -525,7 +521,7 @@ void WorldEvent::runConsoleCommands(MWWorld::CellStore* cellStore) } windowManager->clearConsolePtr(); - } + } } void WorldEvent::setLocalShorts(MWWorld::CellStore* cellStore)