mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-31 14:15:32 +00:00
3d5860d6f4
Conflicts: apps/openmw-mp/Player.cpp apps/openmw-mp/Script/Functions/Settings.cpp apps/openmw-mp/Script/Functions/Settings.hpp apps/openmw-mp/Script/Functions/World.cpp apps/openmw-mp/Script/Functions/World.hpp apps/openmw/mwgui/container.cpp apps/openmw/mwmp/LocalActor.cpp apps/openmw/mwmp/LocalPlayer.cpp apps/openmw/mwmp/WorldEvent.cpp apps/openmw/mwmp/processors/world/ProcessorContainer.hpp components/openmw-mp/Base/BaseEvent.hpp components/openmw-mp/Log.cpp components/openmw-mp/Log.hpp
55 lines
2 KiB
C++
55 lines
2 KiB
C++
#ifndef OPENMW_PROCESSORGAMESETTINGS_HPP
|
|
#define OPENMW_PROCESSORGAMESETTINGS_HPP
|
|
|
|
#include "apps/openmw/mwbase/environment.hpp"
|
|
#include "apps/openmw/mwworld/worldimp.hpp"
|
|
#include "apps/openmw/mwgui/windowmanagerimp.hpp"
|
|
|
|
#include "../PlayerProcessor.hpp"
|
|
|
|
namespace mwmp
|
|
{
|
|
class ProcessorGameSettings final: public PlayerProcessor
|
|
{
|
|
public:
|
|
ProcessorGameSettings()
|
|
{
|
|
BPP_INIT(ID_GAME_SETTINGS)
|
|
}
|
|
|
|
virtual void Do(PlayerPacket &packet, BasePlayer *player)
|
|
{
|
|
static const int initialLogLevel = Log::GetLevel();
|
|
|
|
if (isLocal())
|
|
{
|
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_SETTINGS");
|
|
|
|
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
|
{
|
|
if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Console && !player->consoleAllowed)
|
|
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
|
else if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Rest &&
|
|
(!player->bedRestAllowed || !player->wildernessRestAllowed || !player->waitAllowed))
|
|
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
|
}
|
|
|
|
if (player->enforcedLogLevel > -1)
|
|
{
|
|
LOG_APPEND(Log::LOG_INFO, "- server is enforcing log level %i", player->enforcedLogLevel);
|
|
|
|
Log::Get().SetLevel(player->enforcedLogLevel);
|
|
}
|
|
else if (initialLogLevel != Log::GetLevel())
|
|
{
|
|
LOG_APPEND(Log::LOG_INFO, "- log level has been reset to initial value %i", initialLogLevel);
|
|
Log::Get().SetLevel(initialLogLevel);
|
|
}
|
|
|
|
MWBase::Environment::get().getWorld()->setPhysicsFramerate(player->physicsFramerate);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
#endif //OPENMW_PROCESSORGAMESETTINGS_HPP
|